Title: [205034] trunk/Source/_javascript_Core
- Revision
- 205034
- Author
- joep...@webkit.org
- Date
- 2016-08-26 13:22:24 -0700 (Fri, 26 Aug 2016)
Log Message
Web Inspector: ScriptProfilerAgent and HeapAgent should do less work when frontend disconnects
https://bugs.webkit.org/show_bug.cgi?id=161213
<rdar://problem/28017986>
Reviewed by Brian Burg.
* inspector/agents/InspectorHeapAgent.cpp:
(Inspector::InspectorHeapAgent::willDestroyFrontendAndBackend):
Don't take a final snapshot when disconnecting.
* inspector/agents/InspectorScriptProfilerAgent.cpp:
(Inspector::InspectorScriptProfilerAgent::willDestroyFrontendAndBackend):
(Inspector::InspectorScriptProfilerAgent::stopSamplingWhenDisconnecting):
* inspector/agents/InspectorScriptProfilerAgent.h:
* runtime/SamplingProfiler.h:
Don't process samples when disconnecting.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (205033 => 205034)
--- trunk/Source/_javascript_Core/ChangeLog 2016-08-26 20:22:21 UTC (rev 205033)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-08-26 20:22:24 UTC (rev 205034)
@@ -1,5 +1,24 @@
2016-08-26 Joseph Pecoraro <pecor...@apple.com>
+ Web Inspector: ScriptProfilerAgent and HeapAgent should do less work when frontend disconnects
+ https://bugs.webkit.org/show_bug.cgi?id=161213
+ <rdar://problem/28017986>
+
+ Reviewed by Brian Burg.
+
+ * inspector/agents/InspectorHeapAgent.cpp:
+ (Inspector::InspectorHeapAgent::willDestroyFrontendAndBackend):
+ Don't take a final snapshot when disconnecting.
+
+ * inspector/agents/InspectorScriptProfilerAgent.cpp:
+ (Inspector::InspectorScriptProfilerAgent::willDestroyFrontendAndBackend):
+ (Inspector::InspectorScriptProfilerAgent::stopSamplingWhenDisconnecting):
+ * inspector/agents/InspectorScriptProfilerAgent.h:
+ * runtime/SamplingProfiler.h:
+ Don't process samples when disconnecting.
+
+2016-08-26 Joseph Pecoraro <pecor...@apple.com>
+
Web Inspector: HeapProfiler/ScriptProfiler do not destruct safely when JSContext is destroyed
https://bugs.webkit.org/show_bug.cgi?id=161027
<rdar://problem/27871349>
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp (205033 => 205034)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp 2016-08-26 20:22:21 UTC (rev 205033)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp 2016-08-26 20:22:24 UTC (rev 205034)
@@ -127,8 +127,10 @@
void InspectorHeapAgent::willDestroyFrontendAndBackend(DisconnectReason)
{
+ // Stop tracking without taking a snapshot.
+ m_tracking = false;
+
ErrorString ignored;
- stopTracking(ignored);
disable(ignored);
}
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorScriptProfilerAgent.cpp (205033 => 205034)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorScriptProfilerAgent.cpp 2016-08-26 20:22:21 UTC (rev 205033)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorScriptProfilerAgent.cpp 2016-08-26 20:22:24 UTC (rev 205034)
@@ -53,8 +53,15 @@
void InspectorScriptProfilerAgent::willDestroyFrontendAndBackend(DisconnectReason)
{
- ErrorString ignored;
- stopTracking(ignored);
+ // Stop tracking without sending results.
+ if (m_tracking) {
+ m_tracking = false;
+ m_activeEvaluateScript = false;
+ m_environment.scriptDebugServer().setProfilingClient(nullptr);
+
+ // Stop sampling without processing the samples.
+ stopSamplingWhenDisconnecting();
+ }
}
void InspectorScriptProfilerAgent::startTracking(ErrorString&, const bool* includeSamples)
@@ -216,6 +223,23 @@
#endif // ENABLE(SAMPLING_PROFILER)
}
+void InspectorScriptProfilerAgent::stopSamplingWhenDisconnecting()
+{
+#if ENABLE(SAMPLING_PROFILER)
+ if (!m_enabledSamplingProfiler)
+ return;
+
+ JSLockHolder lock(m_environment.scriptDebugServer().vm());
+ SamplingProfiler* samplingProfiler = m_environment.scriptDebugServer().vm().samplingProfiler();
+ RELEASE_ASSERT(samplingProfiler);
+ LockHolder locker(samplingProfiler->getLock());
+ samplingProfiler->pause(locker);
+ samplingProfiler->clearData(locker);
+
+ m_enabledSamplingProfiler = false;
+#endif
+}
+
void InspectorScriptProfilerAgent::programmaticCaptureStarted()
{
m_frontendDispatcher->programmaticCaptureStarted();
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorScriptProfilerAgent.h (205033 => 205034)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorScriptProfilerAgent.h 2016-08-26 20:22:21 UTC (rev 205033)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorScriptProfilerAgent.h 2016-08-26 20:22:24 UTC (rev 205034)
@@ -69,6 +69,7 @@
void addEvent(double startTime, double endTime, JSC::ProfilingReason);
void trackingComplete();
+ void stopSamplingWhenDisconnecting();
std::unique_ptr<ScriptProfilerFrontendDispatcher> m_frontendDispatcher;
RefPtr<ScriptProfilerBackendDispatcher> m_backendDispatcher;
Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.h (205033 => 205034)
--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.h 2016-08-26 20:22:21 UTC (rev 205033)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.h 2016-08-26 20:22:24 UTC (rev 205034)
@@ -150,6 +150,7 @@
void processUnverifiedStackTraces(); // You should call this only after acquiring the lock.
void setStopWatch(const LockHolder&, Ref<Stopwatch>&& stopwatch) { m_stopwatch = WTFMove(stopwatch); }
void pause(const LockHolder&);
+ void clearData(const LockHolder&);
// Used for debugging in the JSC shell/DRT.
void registerForReportAtExit();
@@ -160,7 +161,6 @@
JS_EXPORT_PRIVATE void reportTopBytecodes(PrintStream&);
private:
- void clearData(const LockHolder&);
void createThreadIfNecessary(const LockHolder&);
void timerLoop();
void takeSample(const LockHolder&, std::chrono::microseconds& stackTraceProcessingTime);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes