[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
loislo at chromium.org
loislo at chromium.org
Sun Feb 20 23:31:49 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit c73ebd917f85f6e0c4a48786a9dfab74c103d7ef
Author: loislo at chromium.org <loislo at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 21 09:24:44 2011 +0000
2011-01-21 Ilya Tikhonovsky <loislo at chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: switch page/Console implementation from InspectorController to InspectorInstrumentation.
There are some places in WebCore where we still using direct InspectorController calls.
The idea is to pass all the Inspector related calls via InspectorInstrumentaion which is the
Inspector facade for WebCore.
https://bugs.webkit.org/show_bug.cgi?id=52869
* inspector/InspectorController.cpp:
* inspector/InspectorController.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::addProfileImpl):
(WebCore::InspectorInstrumentation::profilerEnabledImpl):
(WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::addProfile):
(WebCore::InspectorInstrumentation::profilerEnabled):
(WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileName):
* page/Console.cpp:
(WebCore::Console::profile):
(WebCore::Console::profileEnd):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index c426728..2899ee5 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2011-01-21 Ilya Tikhonovsky <loislo at chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: switch page/Console implementation from InspectorController to InspectorInstrumentation.
+
+ There are some places in WebCore where we still using direct InspectorController calls.
+ The idea is to pass all the Inspector related calls via InspectorInstrumentaion which is the
+ Inspector facade for WebCore.
+
+ https://bugs.webkit.org/show_bug.cgi?id=52869
+
+ * inspector/InspectorController.cpp:
+ * inspector/InspectorController.h:
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::addProfileImpl):
+ (WebCore::InspectorInstrumentation::profilerEnabledImpl):
+ (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl):
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::addProfile):
+ (WebCore::InspectorInstrumentation::profilerEnabled):
+ (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileName):
+ * page/Console.cpp:
+ (WebCore::Console::profile):
+ (WebCore::Console::profileEnd):
+
2011-01-20 Sam Weinig <sam at webkit.org>
Reviewed by Gavin Barraclough.
diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp
index d11f720..64b9494 100644
--- a/Source/WebCore/inspector/InspectorController.cpp
+++ b/Source/WebCore/inspector/InspectorController.cpp
@@ -983,23 +983,11 @@ void InspectorController::didCloseWebSocket(unsigned long identifier)
#endif // ENABLE(WEB_SOCKETS)
#if ENABLE(JAVASCRIPT_DEBUGGER)
-void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL)
-{
- if (!enabled())
- return;
- m_profilerAgent->addProfile(prpProfile, lineNumber, sourceURL);
-}
-
bool InspectorController::isRecordingUserInitiatedProfile() const
{
return m_profilerAgent->isRecordingUserInitiatedProfile();
}
-String InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber)
-{
- return m_profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber);
-}
-
void InspectorController::startUserInitiatedProfiling()
{
if (!enabled())
diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h
index dcdf7bc..eaaa1e5 100644
--- a/Source/WebCore/inspector/InspectorController.h
+++ b/Source/WebCore/inspector/InspectorController.h
@@ -227,9 +227,7 @@ public:
void drawElementTitle(GraphicsContext&, const IntRect& boundingBox, const FloatRect& overlayRect, WebCore::Settings*) const;
#if ENABLE(JAVASCRIPT_DEBUGGER)
- void addProfile(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
bool isRecordingUserInitiatedProfile() const;
- String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
void startProfiling() { startUserInitiatedProfiling(); }
void startUserInitiatedProfiling();
void stopProfiling() { stopUserInitiatedProfiling(); }
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp
index c28a82a..5f8d105 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp
+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp
@@ -552,6 +552,33 @@ void InspectorInstrumentation::addStartProfilingMessageToConsoleImpl(InspectorCo
if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent())
profilerAgent->addStartProfilingMessageToConsole(title, lineNumber, sourceURL);
}
+
+void InspectorInstrumentation::addProfileImpl(InspectorController* inspectorController, RefPtr<ScriptProfile> profile, ScriptCallStack* callStack)
+{
+ if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent()) {
+ const ScriptCallFrame& lastCaller = callStack->at(0);
+ profilerAgent->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL());
+ }
+}
+
+bool InspectorInstrumentation::profilerEnabledImpl(InspectorController* inspectorController)
+{
+ if (inspectorController->enabled())
+ return false;
+
+ InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent();
+ if (!profilerAgent)
+ return false;
+
+ return profilerAgent->enabled();
+}
+
+String InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(InspectorController* inspectorController, bool incrementProfileNumber)
+{
+ if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent())
+ return profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber);
+ return "";
+}
#endif
#if ENABLE(DATABASE)
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h
index 28867cb..7a7ee43 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.h
+++ b/Source/WebCore/inspector/InspectorInstrumentation.h
@@ -139,6 +139,9 @@ public:
#if ENABLE(JAVASCRIPT_DEBUGGER)
static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, const String& sourceURL);
+ static void addProfile(Page*, RefPtr<ScriptProfile>, ScriptCallStack*);
+ static bool profilerEnabled(Page*);
+ static String getCurrentUserInitiatedProfileName(Page*, bool incrementProfileNumber);
#endif
#if ENABLE(DATABASE)
@@ -246,6 +249,9 @@ private:
#if ENABLE(JAVASCRIPT_DEBUGGER)
static void addStartProfilingMessageToConsoleImpl(InspectorController*, const String& title, unsigned lineNumber, const String& sourceURL);
+ static void addProfileImpl(InspectorController*, RefPtr<ScriptProfile>, ScriptCallStack*);
+ static bool profilerEnabledImpl(InspectorController*);
+ static String getCurrentUserInitiatedProfileNameImpl(InspectorController*, bool incrementProfileNumber);
#endif
#if ENABLE(DATABASE)
@@ -881,6 +887,32 @@ inline void InspectorInstrumentation::addStartProfilingMessageToConsole(Page* pa
addStartProfilingMessageToConsoleImpl(inspectorController, title, lineNumber, sourceURL);
#endif
}
+
+inline void InspectorInstrumentation::addProfile(Page* page, RefPtr<ScriptProfile> profile, ScriptCallStack* callStack)
+{
+#if ENABLE(INSPECTOR)
+ if (InspectorController* inspectorController = inspectorControllerForPage(page))
+ addProfileImpl(inspectorController, profile, callStack);
+#endif
+}
+
+inline bool InspectorInstrumentation::profilerEnabled(Page* page)
+{
+#if ENABLE(INSPECTOR)
+ if (InspectorController* inspectorController = inspectorControllerForPage(page))
+ return profilerEnabledImpl(inspectorController);
+#endif
+ return false;
+}
+
+inline String InspectorInstrumentation::getCurrentUserInitiatedProfileName(Page* page, bool incrementProfileNumber)
+{
+#if ENABLE(INSPECTOR)
+ if (InspectorController* inspectorController = inspectorControllerForPage(page))
+ return InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(inspectorController, incrementProfileNumber);
+#endif
+ return "";
+}
#endif
#if ENABLE(INSPECTOR)
@@ -936,6 +968,7 @@ inline InspectorController* InspectorInstrumentation::inspectorControllerWithFro
}
return 0;
}
+
#endif
} // namespace WebCore
diff --git a/Source/WebCore/page/Console.cpp b/Source/WebCore/page/Console.cpp
index d4aed41..0c19421 100644
--- a/Source/WebCore/page/Console.cpp
+++ b/Source/WebCore/page/Console.cpp
@@ -262,20 +262,13 @@ void Console::profile(const String& title, ScriptState* state, PassRefPtr<Script
if (!page)
return;
-#if ENABLE(INSPECTOR)
- InspectorController* controller = page->inspectorController();
// FIXME: log a console message when profiling is disabled.
- if (!controller->profilerEnabled())
+ if (!InspectorInstrumentation::profilerEnabled(page))
return;
-#endif
String resolvedTitle = title;
if (title.isNull()) // no title so give it the next user initiated profile title.
-#if ENABLE(INSPECTOR)
- resolvedTitle = controller->getCurrentUserInitiatedProfileName(true);
-#else
- resolvedTitle = "";
-#endif
+ resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfileName(page, true);
ScriptProfiler::start(state, resolvedTitle);
@@ -289,22 +282,15 @@ void Console::profileEnd(const String& title, ScriptState* state, PassRefPtr<Scr
if (!page)
return;
-#if ENABLE(INSPECTOR)
- InspectorController* controller = page->inspectorController();
- if (!controller->profilerEnabled())
+ if (!InspectorInstrumentation::profilerEnabled(page))
return;
-#endif
RefPtr<ScriptProfile> profile = ScriptProfiler::stop(state, title);
if (!profile)
return;
m_profiles.append(profile);
-
-#if ENABLE(INSPECTOR)
- const ScriptCallFrame& lastCaller = callStack->at(0);
- controller->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL());
-#endif
+ InspectorInstrumentation::addProfile(page, profile, callStack.get());
}
#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list