- Revision
- 171866
- Author
- [email protected]
- Date
- 2014-07-31 10:34:48 -0700 (Thu, 31 Jul 2014)
Log Message
Web Inspector: console.profile missing profile information
https://bugs.webkit.org/show_bug.cgi?id=135432
Patch by Joseph Pecoraro <[email protected]> on 2014-07-31
Reviewed by Timothy Hatcher.
Source/WebCore:
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.
Source/WebInspectorUI:
* 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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (171865 => 171866)
--- trunk/Source/WebCore/ChangeLog 2014-07-31 17:24:38 UTC (rev 171865)
+++ trunk/Source/WebCore/ChangeLog 2014-07-31 17:34:48 UTC (rev 171866)
@@ -1,3 +1,38 @@
+2014-07-31 Joseph Pecoraro <[email protected]>
+
+ 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-07-31 Wenson Hsieh <[email protected]>
Refactor EventHandler to call ScrollAnimator::handleWheelEvent for overflow scrolling
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (171865 => 171866)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2014-07-31 17:24:38 UTC (rev 171865)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2014-07-31 17:34:48 UTC (rev 171866)
@@ -380,7 +380,7 @@
bool InspectorController::profilerEnabled() const
{
- return m_instrumentingAgents->inspectorTimelineAgent();
+ return m_instrumentingAgents->persistentInspectorTimelineAgent();
}
void InspectorController::setProfilerEnabled(bool enable)
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (171865 => 171866)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2014-07-31 17:24:38 UTC (rev 171865)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2014-07-31 17:34:48 UTC (rev 171866)
@@ -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: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (171865 => 171866)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2014-07-31 17:24:38 UTC (rev 171865)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2014-07-31 17:34:48 UTC (rev 171866)
@@ -282,8 +282,8 @@
Vector<TimelineRecordEntry> m_pendingConsoleProfileRecords;
+ int m_recordingProfileDepth;
bool m_enabled;
- bool m_recordingProfile;
};
} // namespace WebCore
Modified: trunk/Source/WebInspectorUI/ChangeLog (171865 => 171866)
--- trunk/Source/WebInspectorUI/ChangeLog 2014-07-31 17:24:38 UTC (rev 171865)
+++ trunk/Source/WebInspectorUI/ChangeLog 2014-07-31 17:34:48 UTC (rev 171866)
@@ -1,3 +1,14 @@
+2014-07-31 Joseph Pecoraro <[email protected]>
+
+ 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 Brian J. Burg <[email protected]>
Web Inspector: ProbeSetDetailsSection should not create live location links for unresolved breakpoints
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js (171865 => 171866)
--- trunk/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js 2014-07-31 17:24:38 UTC (rev 171865)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js 2014-07-31 17:34:48 UTC (rev 171866)
@@ -284,6 +284,7 @@
return;
var payload = this._profilePayload;
+ delete this._profilePayload;
console.assert(payload.rootNodes instanceof Array);