Title: [172051] branches/safari-600.1-branch/Source

Diff

Modified: branches/safari-600.1-branch/Source/WebCore/ChangeLog (172050 => 172051)


--- branches/safari-600.1-branch/Source/WebCore/ChangeLog	2014-08-05 20:01:43 UTC (rev 172050)
+++ branches/safari-600.1-branch/Source/WebCore/ChangeLog	2014-08-05 20:07:28 UTC (rev 172051)
@@ -1,5 +1,44 @@
 2014-08-05  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r171866
+
+    2014-07-31  Joseph Pecoraro  <pecor...@apple.com>
+
+            Web Inspector: console.profile missing profile information
+            https://bugs.webkit.org/show_bug.cgi?id=135432
+
+            Reviewed by Timothy Hatcher.
+
+            By switching console.profile to start/stop the timeline we would
+            not have a chance to recompile JS functions with profiling information.
+            This used to work because whenever the inspector was open we would
+            have profiling information enabled. Go back to that behavior.
+
+            * inspector/InspectorController.cpp:
+            (WebCore::InspectorController::profilerEnabled):
+            Instead of checking if the timeline agent has started, check if the
+            timeline agent has been created. Going back to the normal behavior
+            of always having profiling information when the inspector is open.
+
+            * inspector/InspectorTimelineAgent.h:
+            * inspector/InspectorTimelineAgent.cpp:
+            (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
+            Recompile initializing the timeline agent to include profiling information.
+
+            (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
+            Recompile destrying the timeline agent, only if needed.
+
+            (WebCore::InspectorTimelineAgent::willCallFunction):
+            (WebCore::InspectorTimelineAgent::didCallFunction):
+            (WebCore::InspectorTimelineAgent::willEvaluateScript):
+            (WebCore::InspectorTimelineAgent::didEvaluateScript):
+            Using a boolean to track nested calls would not give expected
+            behavior when un-nesting. Switch to a counter to ensure that
+            as we start profiling in the outermost level we then stop
+            profiling at that same level and not inside an inner nesting.
+
+2014-08-05  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r171851
 
     2014-07-31  Jer Noble  <jer.no...@apple.com>

Modified: branches/safari-600.1-branch/Source/WebCore/inspector/InspectorController.cpp (172050 => 172051)


--- branches/safari-600.1-branch/Source/WebCore/inspector/InspectorController.cpp	2014-08-05 20:01:43 UTC (rev 172050)
+++ branches/safari-600.1-branch/Source/WebCore/inspector/InspectorController.cpp	2014-08-05 20:07:28 UTC (rev 172051)
@@ -380,7 +380,7 @@
 
 bool InspectorController::profilerEnabled() const
 {
-    return m_instrumentingAgents->inspectorTimelineAgent();
+    return m_instrumentingAgents->persistentInspectorTimelineAgent();
 }
 
 void InspectorController::setProfilerEnabled(bool enable)

Modified: branches/safari-600.1-branch/Source/WebCore/inspector/InspectorTimelineAgent.cpp (172050 => 172051)


--- branches/safari-600.1-branch/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2014-08-05 20:01:43 UTC (rev 172050)
+++ branches/safari-600.1-branch/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2014-08-05 20:07:28 UTC (rev 172051)
@@ -76,15 +76,23 @@
     m_backendDispatcher = InspectorTimelineBackendDispatcher::create(backendDispatcher, this);
 
     m_instrumentingAgents->setPersistentInspectorTimelineAgent(this);
+
+    if (m_scriptDebugServer)
+        m_scriptDebugServer->recompileAllJSFunctions();
 }
 
-void InspectorTimelineAgent::willDestroyFrontendAndBackend(InspectorDisconnectReason)
+void InspectorTimelineAgent::willDestroyFrontendAndBackend(InspectorDisconnectReason reason)
 {
     m_frontendDispatcher = nullptr;
     m_backendDispatcher.clear();
 
     m_instrumentingAgents->setPersistentInspectorTimelineAgent(nullptr);
 
+    if (reason != InspectorDisconnectReason::InspectedTargetDestroyed) {
+        if (m_scriptDebugServer)
+            m_scriptDebugServer->recompileAllJSFunctions();
+    }
+
     ErrorString error;
     stop(&error);
 }
@@ -209,26 +217,29 @@
 {
     pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frame);
 
-    if (frame && !m_recordingProfile) {
-        m_recordingProfile = true;
+    if (frame && !m_recordingProfileDepth) {
+        ++m_recordingProfileDepth;
         startProfiling(frame, ASCIILiteral("Timeline FunctionCall"));
     }
 }
 
 void InspectorTimelineAgent::didCallFunction(Frame* frame)
 {
-    if (frame && m_recordingProfile) {
-        if (m_recordStack.isEmpty())
-            return;
+    if (frame && m_recordingProfileDepth) {
+        --m_recordingProfileDepth;
+        ASSERT(m_recordingProfileDepth >= 0);
 
-        TimelineRecordEntry& entry = m_recordStack.last();
-        ASSERT(entry.type == TimelineRecordType::FunctionCall);
+        if (!m_recordingProfileDepth) {
+            if (m_recordStack.isEmpty())
+                return;
 
-        RefPtr<JSC::Profile> profile = "" ASCIILiteral("Timeline FunctionCall"));
-        if (profile)
-            TimelineRecordFactory::appendProfile(entry.data.get(), profile.release());
+            TimelineRecordEntry& entry = m_recordStack.last();
+            ASSERT(entry.type == TimelineRecordType::FunctionCall);
 
-        m_recordingProfile = false;
+            RefPtr<JSC::Profile> profile = "" ASCIILiteral("Timeline FunctionCall"));
+            if (profile)
+                TimelineRecordFactory::appendProfile(entry.data.get(), profile.release());
+        }
     }
 
     didCompleteCurrentRecord(TimelineRecordType::FunctionCall);
@@ -380,26 +391,29 @@
 {
     pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, frame);
 
-    if (frame && !m_recordingProfile) {
-        m_recordingProfile = true;
+    if (frame && !m_recordingProfileDepth) {
+        ++m_recordingProfileDepth;
         startProfiling(frame, ASCIILiteral("Timeline EvaluateScript"));
     }
 }
 
 void InspectorTimelineAgent::didEvaluateScript(Frame* frame)
 {
-    if (frame && m_recordingProfile) {
-        if (m_recordStack.isEmpty())
-            return;
+    if (frame && m_recordingProfileDepth) {
+        --m_recordingProfileDepth;
+        ASSERT(m_recordingProfileDepth >= 0);
+        
+        if (!m_recordingProfileDepth) {
+            if (m_recordStack.isEmpty())
+                return;
 
-        TimelineRecordEntry& entry = m_recordStack.last();
-        ASSERT(entry.type == TimelineRecordType::EvaluateScript);
+            TimelineRecordEntry& entry = m_recordStack.last();
+            ASSERT(entry.type == TimelineRecordType::EvaluateScript);
 
-        RefPtr<JSC::Profile> profile = "" ASCIILiteral("Timeline EvaluateScript"));
-        if (profile)
-            TimelineRecordFactory::appendProfile(entry.data.get(), profile.release());
-
-        m_recordingProfile = false;
+            RefPtr<JSC::Profile> profile = "" ASCIILiteral("Timeline EvaluateScript"));
+            if (profile)
+                TimelineRecordFactory::appendProfile(entry.data.get(), profile.release());
+        }
     }
 
     didCompleteCurrentRecord(TimelineRecordType::EvaluateScript);
@@ -666,8 +680,8 @@
     , m_maxCallStackDepth(5)
     , m_inspectorType(type)
     , m_client(client)
+    , m_recordingProfileDepth(0)
     , m_enabled(false)
-    , m_recordingProfile(false)
 {
 }
 

Modified: branches/safari-600.1-branch/Source/WebCore/inspector/InspectorTimelineAgent.h (172050 => 172051)


--- branches/safari-600.1-branch/Source/WebCore/inspector/InspectorTimelineAgent.h	2014-08-05 20:01:43 UTC (rev 172050)
+++ branches/safari-600.1-branch/Source/WebCore/inspector/InspectorTimelineAgent.h	2014-08-05 20:07:28 UTC (rev 172051)
@@ -282,8 +282,8 @@
 
     Vector<TimelineRecordEntry> m_pendingConsoleProfileRecords;
 
+    int m_recordingProfileDepth;
     bool m_enabled;
-    bool m_recordingProfile;
 };
 
 } // namespace WebCore

Modified: branches/safari-600.1-branch/Source/WebInspectorUI/ChangeLog (172050 => 172051)


--- branches/safari-600.1-branch/Source/WebInspectorUI/ChangeLog	2014-08-05 20:01:43 UTC (rev 172050)
+++ branches/safari-600.1-branch/Source/WebInspectorUI/ChangeLog	2014-08-05 20:07:28 UTC (rev 172051)
@@ -1,3 +1,18 @@
+2014-08-05  Lucas Forschler  <lforsch...@apple.com>
+
+        Merge r171866
+
+    2014-07-31  Joseph Pecoraro  <pecor...@apple.com>
+
+            Web Inspector: console.profile missing profile information
+            https://bugs.webkit.org/show_bug.cgi?id=135432
+
+            Reviewed by Timothy Hatcher.
+
+            * UserInterface/Models/ScriptTimelineRecord.js:
+            Delete the payload information as soon as it has been processed.
+            It is no longer needed anymore and can be garbage collected.
+
 2014-07-30  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r171790

Modified: branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js (172050 => 172051)


--- branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js	2014-08-05 20:01:43 UTC (rev 172050)
+++ branches/safari-600.1-branch/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js	2014-08-05 20:07:28 UTC (rev 172051)
@@ -284,6 +284,7 @@
             return;
 
         var payload = this._profilePayload;
+        delete this._profilePayload;
 
         console.assert(payload.rootNodes instanceof Array);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to