[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mnaganov at chromium.org mnaganov at chromium.org
Wed Dec 22 15:33:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ccce4021500b4347d4ee6680513d081fe5925b52
Author: mnaganov at chromium.org <mnaganov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 8 13:38:46 2010 +0000

    2010-11-08  Mikhail Naganov  <mnaganov at chromium.org>
    
            Reviewed by Adam Barth.
    
            Web Inspector [Chromium]: Make CPU profiling to survive navigation.
    
            https://bugs.webkit.org/show_bug.cgi?id=48843
    
            * inspector/Inspector.idl:
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::restoreInspectorStateFromCookie):
            (WebCore::InspectorController::reuseFrontend):
            (WebCore::InspectorController::disconnectFrontend):
            (WebCore::InspectorController::populateScriptObjects):
            (WebCore::InspectorController::restoreProfiler):
            (WebCore::InspectorController::didCommitLoad):
            (WebCore::InspectorController::startUserInitiatedProfiling):
            (WebCore::InspectorController::stopUserInitiatedProfiling):
            * inspector/InspectorController.h:
            (WebCore::InspectorController::startProfiling):
            (WebCore::InspectorController::stopProfiling):
            * inspector/InspectorProfilerAgent.cpp:
            (WebCore::InspectorProfilerAgent::startUserInitiatedProfiling):
            (WebCore::InspectorProfilerAgent::stopUserInitiatedProfiling):
            * inspector/InspectorProfilerAgent.h:
            * inspector/InspectorState.cpp:
            (WebCore::InspectorState::InspectorState):
            * inspector/InspectorState.h:
            * inspector/front-end/ProfilesPanel.js:
            (WebInspector.ProfilesPanel.prototype.hasTemporaryProfile):
            (WebInspector.ProfilesPanel.prototype.hasProfile):
            * inspector/front-end/inspector.js:
            (WebInspector.setRecordingProfile):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71511 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 69f1fb8..30d6458 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-11-08  Mikhail Naganov  <mnaganov at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Web Inspector [Chromium]: Make CPU profiling to survive navigation.
+
+        https://bugs.webkit.org/show_bug.cgi?id=48843
+
+        * inspector/Inspector.idl:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::restoreInspectorStateFromCookie):
+        (WebCore::InspectorController::reuseFrontend):
+        (WebCore::InspectorController::disconnectFrontend):
+        (WebCore::InspectorController::populateScriptObjects):
+        (WebCore::InspectorController::restoreProfiler):
+        (WebCore::InspectorController::didCommitLoad):
+        (WebCore::InspectorController::startUserInitiatedProfiling):
+        (WebCore::InspectorController::stopUserInitiatedProfiling):
+        * inspector/InspectorController.h:
+        (WebCore::InspectorController::startProfiling):
+        (WebCore::InspectorController::stopProfiling):
+        * inspector/InspectorProfilerAgent.cpp:
+        (WebCore::InspectorProfilerAgent::startUserInitiatedProfiling):
+        (WebCore::InspectorProfilerAgent::stopUserInitiatedProfiling):
+        * inspector/InspectorProfilerAgent.h:
+        * inspector/InspectorState.cpp:
+        (WebCore::InspectorState::InspectorState):
+        * inspector/InspectorState.h:
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfilesPanel.prototype.hasTemporaryProfile):
+        (WebInspector.ProfilesPanel.prototype.hasProfile):
+        * inspector/front-end/inspector.js:
+        (WebInspector.setRecordingProfile):
+
 2010-11-08  Renata Hodovan  <reni at webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl
index 58a49b6..93d5396 100644
--- a/WebCore/inspector/Inspector.idl
+++ b/WebCore/inspector/Inspector.idl
@@ -149,8 +149,8 @@ module core {
         [handler=Controller] void enableProfiler(in boolean always);
         [handler=Controller] void disableProfiler(in boolean always);
 
-        [handler=Profiler] void startProfiling();
-        [handler=Profiler] void stopProfiling();
+        [handler=Controller] void startProfiling();
+        [handler=Controller] void stopProfiling();
 
         [handler=Profiler] void getProfileHeaders(out Array headers);
         [handler=Profiler] void getProfile(in String type, in unsigned long uid, out Object profile);
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index ed4381b..72dc5e1 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -237,6 +237,8 @@ void InspectorController::restoreInspectorStateFromCookie(const String& inspecto
     m_state->restoreFromInspectorCookie(inspectorStateCookie);
     if (m_state->getBoolean(InspectorState::timelineProfilerEnabled))
         startTimelineProfiler();
+    if (m_state->getBoolean(InspectorState::userInitiatedProfiling))
+        startUserInitiatedProfiling();
 }
 
 void InspectorController::inspect(Node* node)
@@ -508,7 +510,7 @@ void InspectorController::reuseFrontend()
 {
     connectFrontend();
     restoreDebugger();
-    restoreProfiler();
+    restoreProfiler(ProfilerRestoreResetAgent);
 }
 
 void InspectorController::show()
@@ -577,7 +579,7 @@ void InspectorController::disconnectFrontend()
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     m_profilerAgent->setFrontend(0);
-    m_profilerAgent->stopUserInitiatedProfiling();
+    m_profilerAgent->stopUserInitiatedProfiling(true);
 #endif
 
     releaseFrontendLifetimeAgents();
@@ -656,7 +658,7 @@ void InspectorController::populateScriptObjects()
     m_pendingEvaluateTestCommands.clear();
 
     restoreDebugger();
-    restoreProfiler();
+    restoreProfiler(ProfilerRestoreNoAction);
 }
 
 void InspectorController::restoreDebugger()
@@ -672,13 +674,15 @@ void InspectorController::restoreDebugger()
 #endif
 }
 
-void InspectorController::restoreProfiler()
+void InspectorController::restoreProfiler(ProfilerRestoreAction action)
 {
     ASSERT(m_frontend);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     m_profilerAgent->setFrontend(m_frontend.get());
     if (!ScriptProfiler::isProfilerAlwaysEnabled() && m_state->getBoolean(InspectorState::profilerAlwaysEnabled))
         enableProfiler();
+    if (action == ProfilerRestoreResetAgent)
+        m_profilerAgent->resetState();
 #endif
 }
 
@@ -726,6 +730,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
 #endif
 
 #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
+        m_profilerAgent->stopUserInitiatedProfiling(true);
         m_profilerAgent->resetState();
 #endif
 
@@ -1298,6 +1303,7 @@ void InspectorController::startUserInitiatedProfiling()
     if (!enabled())
         return;
     m_profilerAgent->startUserInitiatedProfiling();
+    m_state->setBoolean(InspectorState::userInitiatedProfiling, true);
 }
 
 void InspectorController::stopUserInitiatedProfiling()
@@ -1305,6 +1311,7 @@ void InspectorController::stopUserInitiatedProfiling()
     if (!enabled())
         return;
     m_profilerAgent->stopUserInitiatedProfiling();
+    m_state->setBoolean(InspectorState::userInitiatedProfiling, false);
 }
 
 bool InspectorController::profilerEnabled() const
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 86fea67..2b701c6 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -239,7 +239,9 @@ public:
     void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL);
     bool isRecordingUserInitiatedProfile() const;
     String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
+    void startProfiling() { startUserInitiatedProfiling(); }
     void startUserInitiatedProfiling();
+    void stopProfiling() { stopUserInitiatedProfiling(); }
     void stopUserInitiatedProfiling();
     void enableProfiler(bool always = false, bool skipRecompile = false);
     void disableProfiler(bool always = false);
@@ -280,9 +282,14 @@ private:
     friend class InspectorInstrumentation;
     friend class InjectedScriptHost;
 
+    enum ProfilerRestoreAction {
+        ProfilerRestoreNoAction = 0,
+        ProfilerRestoreResetAgent = 1
+    };
+    
     void populateScriptObjects();
     void restoreDebugger();
-    void restoreProfiler();
+    void restoreProfiler(ProfilerRestoreAction action);
     void unbindAllResources();
     void setSearchingForNode(bool enabled);
 
diff --git a/WebCore/inspector/InspectorProfilerAgent.cpp b/WebCore/inspector/InspectorProfilerAgent.cpp
index 456a0c6..3f107d6 100644
--- a/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -197,6 +197,8 @@ void InspectorProfilerAgent::resetState()
 
 void InspectorProfilerAgent::startUserInitiatedProfiling()
 {
+    if (m_recordingUserInitiatedProfile)
+        return;
     if (!enabled()) {
         enable(false);
         ScriptDebugServer::shared().recompileAllJSFunctions();
@@ -213,8 +215,10 @@ void InspectorProfilerAgent::startUserInitiatedProfiling()
     toggleRecordButton(true);
 }
 
-void InspectorProfilerAgent::stopUserInitiatedProfiling()
+void InspectorProfilerAgent::stopUserInitiatedProfiling(bool ignoreProfile)
 {
+    if (!m_recordingUserInitiatedProfile)
+        return;
     m_recordingUserInitiatedProfile = false;
     String title = getCurrentUserInitiatedProfileName();
 #if USE(JSC)
@@ -225,8 +229,12 @@ void InspectorProfilerAgent::stopUserInitiatedProfiling()
     ScriptState* scriptState = 0;
 #endif
     RefPtr<ScriptProfile> profile = ScriptProfiler::stop(scriptState, title);
-    if (profile)
-        addProfile(profile, 0, String());
+    if (profile) {
+        if (!ignoreProfile)
+            addProfile(profile, 0, String());
+        else
+            addProfileFinishedMessageToConsole(profile, 0, String());
+    }
     toggleRecordButton(false);
 }
 
diff --git a/WebCore/inspector/InspectorProfilerAgent.h b/WebCore/inspector/InspectorProfilerAgent.h
index 421efb0..c1f5db1 100644
--- a/WebCore/inspector/InspectorProfilerAgent.h
+++ b/WebCore/inspector/InspectorProfilerAgent.h
@@ -66,10 +66,8 @@ public:
     void removeProfile(const String& type, unsigned uid);
     void resetState();
     void setFrontend(InspectorFrontend* frontend) { m_frontend = frontend; }
-    void startProfiling() { startUserInitiatedProfiling(); }
     void startUserInitiatedProfiling();
-    void stopProfiling() { stopUserInitiatedProfiling(); }
-    void stopUserInitiatedProfiling();
+    void stopUserInitiatedProfiling(bool ignoreProfile = false);
     void takeHeapSnapshot();
     void toggleRecordButton(bool isProfiling);
 
diff --git a/WebCore/inspector/InspectorState.cpp b/WebCore/inspector/InspectorState.cpp
index e5aaf42..df939ba 100644
--- a/WebCore/inspector/InspectorState.cpp
+++ b/WebCore/inspector/InspectorState.cpp
@@ -48,6 +48,7 @@ InspectorState::InspectorState(InspectorClient* client)
     registerLong(inspectorAttachedHeight, InspectorController::defaultAttachedHeight, (const char*)0, "inspectorAttachedHeight");
     registerLong(pauseOnExceptionsState, 0, "pauseOnExceptionsState", (const char*)0);
     registerBoolean(consoleMessagesEnabled, false, "consoleMessagesEnabled", (const char*)0);
+    registerBoolean(userInitiatedProfiling, false, "userInitiatedProfiling", (const char*)0);
 }
 
 void InspectorState::restoreFromInspectorCookie(const String& json)
diff --git a/WebCore/inspector/InspectorState.h b/WebCore/inspector/InspectorState.h
index 4c96be9..aa2f1ec 100644
--- a/WebCore/inspector/InspectorState.h
+++ b/WebCore/inspector/InspectorState.h
@@ -54,6 +54,7 @@ public:
         inspectorAttachedHeight,
         pauseOnExceptionsState,
         consoleMessagesEnabled,
+        userInitiatedProfiling,
         lastPropertyId
     };
 
diff --git a/WebCore/inspector/front-end/ProfilesPanel.js b/WebCore/inspector/front-end/ProfilesPanel.js
index 5f124ca..0aa4174 100644
--- a/WebCore/inspector/front-end/ProfilesPanel.js
+++ b/WebCore/inspector/front-end/ProfilesPanel.js
@@ -386,6 +386,20 @@ WebInspector.ProfilesPanel.prototype = {
         return result;
     },
 
+    hasTemporaryProfile: function(typeId)
+    {
+        var profilesCount = this._profiles.length;
+        for (var i = 0; i < profilesCount; ++i)
+            if (this._profiles[i].typeId === typeId && this._profiles[i].isTemporary)
+                return true;
+        return false;
+    },
+
+    hasProfile: function(profile)
+    {
+        return !!this._profilesIdMap[this._makeKey(profile.uid, profile.typeId)];
+    },
+
     updateProfile: function(profile)
     {
         var profilesCount = this._profiles.length;
@@ -538,10 +552,11 @@ WebInspector.ProfilesPanel.prototype = {
             profileHeaders.sort(function(a, b) { return a.uid - b.uid; });
             var profileHeadersLength = profileHeaders.length;
             for (var i = 0; i < profileHeadersLength; ++i)
-                WebInspector.addProfileHeader(profileHeaders[i]);
+                if (!this.hasProfile(profileHeaders[i]))
+                    WebInspector.addProfileHeader(profileHeaders[i]);
         }
 
-        InspectorBackend.getProfileHeaders(populateCallback);
+        InspectorBackend.getProfileHeaders(populateCallback.bind(this));
 
         this._profilesWereRequested = true;
     },
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 6efd1e4..8323cad 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1533,7 +1533,7 @@ WebInspector.addProfileHeader = function(profile)
 WebInspector.setRecordingProfile = function(isProfiling)
 {
     this.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).setRecordingProfile(isProfiling);
-    if (this._previousIsProfiling !== isProfiling) {
+    if (this.panels.profiles.hasTemporaryProfile(WebInspector.CPUProfileType.TypeId) !== isProfiling) {
         if (!this._temporaryRecordingProfile) {
             this._temporaryRecordingProfile = {
                 typeId: WebInspector.CPUProfileType.TypeId,
@@ -1542,7 +1542,6 @@ WebInspector.setRecordingProfile = function(isProfiling)
                 isTemporary: true
             };
         }
-        this._previousIsProfiling = isProfiling;
         if (isProfiling)
             this.panels.profiles.addProfileHeader(this._temporaryRecordingProfile);
         else

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list