Title: [261233] trunk/Source
Revision
261233
Author
drou...@apple.com
Date
2020-05-06 09:15:16 -0700 (Wed, 06 May 2020)

Log Message

ASSERT_WITH_MESSAGE(m_isOwnedByMainThread == isMainThread()) when web inspecting
https://bugs.webkit.org/show_bug.cgi?id=203638
<rdar://problem/56761893>

Reviewed by Brian Burg.

Source/_javascript_Core:

Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it
return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists.
By not using a `RefPtr`, an additional `copyRef` can be avoided.

* inspector/InspectorEnvironment.h:

* inspector/JSGlobalObjectInspectorController.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::executionStopwatch const): Added.
(Inspector::JSGlobalObjectInspectorController::executionStopwatch): Deleted.

* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::didPause):
(Inspector::InspectorDebuggerAgent::breakpointActionProbe):
(Inspector::InspectorDebuggerAgent::didContinue):
* inspector/agents/InspectorHeapAgent.cpp:
(Inspector::InspectorHeapAgent::snapshot):
(Inspector::InspectorHeapAgent::willGarbageCollect):
(Inspector::InspectorHeapAgent::didGarbageCollect):
* inspector/agents/InspectorScriptProfilerAgent.cpp:
(Inspector::InspectorScriptProfilerAgent::startTracking):
(Inspector::InspectorScriptProfilerAgent::willEvaluateScript):
(Inspector::InspectorScriptProfilerAgent::didEvaluateScript):
(Inspector::InspectorScriptProfilerAgent::trackingComplete):
* runtime/SamplingProfiler.h:
* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::SamplingProfiler):
* runtime/VM.h:
* runtime/VM.cpp:
(JSC::VM::ensureSamplingProfiler):

Source/WebCore:

Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it
return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists.
By not using a `RefPtr`, an additional `copyRef` can be avoided.

* inspector/InspectorController.h:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::executionStopwatch const): Added.
(WebCore::InspectorController::executionStopwatch): Deleted.
* inspector/WorkerInspectorController.h:
(WebCore::WorkerInspectorController::executionStopwatch const): Added.
(WebCore::WorkerInspectorController::executionStopwatch): Deleted.

* inspector/agents/InspectorAnimationAgent.cpp:
(WebCore::InspectorAnimationAgent::startTracking):
(WebCore::InspectorAnimationAgent::stopTracking):
(WebCore::InspectorAnimationAgent::willApplyKeyframeEffect):
(WebCore::InspectorAnimationAgent::stopTrackingDeclarativeAnimation):
* inspector/agents/InspectorCPUProfilerAgent.cpp:
(WebCore::InspectorCPUProfilerAgent::startTracking):
(WebCore::InspectorCPUProfilerAgent::stopTracking):
(WebCore::InspectorCPUProfilerAgent::collectSample):
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::mediaMetricsTimerFired):
* inspector/agents/InspectorMemoryAgent.cpp:
(WebCore::InspectorMemoryAgent::startTracking):
(WebCore::InspectorMemoryAgent::stopTracking):
(WebCore::InspectorMemoryAgent::didHandleMemoryPressure):
(WebCore::InspectorMemoryAgent::collectSample):
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::buildObjectForTiming):
(WebCore::InspectorNetworkAgent::timestamp):
(WebCore::InspectorNetworkAgent::didFinishLoading):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::enable):
(WebCore::InspectorPageAgent::timestamp):
* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::timestamp):

Source/WTF:

* wtf/Stopwatch.h:
(WTF::Stopwatch::elapsedTime const): Added.
(WTF::Stopwatch::elapsedTimeSince const): Added.
(WTF::Stopwatch::elapsedTime): Deleted.
(WTF::Stopwatch::elapsedTimeSince): Deleted.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (261232 => 261233)


--- trunk/Source/_javascript_Core/ChangeLog	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-05-06 16:15:16 UTC (rev 261233)
@@ -1,3 +1,42 @@
+2020-05-06  Devin Rousso  <drou...@apple.com>
+
+        ASSERT_WITH_MESSAGE(m_isOwnedByMainThread == isMainThread()) when web inspecting
+        https://bugs.webkit.org/show_bug.cgi?id=203638
+        <rdar://problem/56761893>
+
+        Reviewed by Brian Burg.
+
+        Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it
+        return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists.
+        By not using a `RefPtr`, an additional `copyRef` can be avoided.
+
+        * inspector/InspectorEnvironment.h:
+
+        * inspector/JSGlobalObjectInspectorController.h:
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::executionStopwatch const): Added.
+        (Inspector::JSGlobalObjectInspectorController::executionStopwatch): Deleted.
+
+        * inspector/agents/InspectorDebuggerAgent.cpp:
+        (Inspector::InspectorDebuggerAgent::didPause):
+        (Inspector::InspectorDebuggerAgent::breakpointActionProbe):
+        (Inspector::InspectorDebuggerAgent::didContinue):
+        * inspector/agents/InspectorHeapAgent.cpp:
+        (Inspector::InspectorHeapAgent::snapshot):
+        (Inspector::InspectorHeapAgent::willGarbageCollect):
+        (Inspector::InspectorHeapAgent::didGarbageCollect):
+        * inspector/agents/InspectorScriptProfilerAgent.cpp:
+        (Inspector::InspectorScriptProfilerAgent::startTracking):
+        (Inspector::InspectorScriptProfilerAgent::willEvaluateScript):
+        (Inspector::InspectorScriptProfilerAgent::didEvaluateScript):
+        (Inspector::InspectorScriptProfilerAgent::trackingComplete):
+        * runtime/SamplingProfiler.h:
+        * runtime/SamplingProfiler.cpp:
+        (JSC::SamplingProfiler::SamplingProfiler):
+        * runtime/VM.h:
+        * runtime/VM.cpp:
+        (JSC::VM::ensureSamplingProfiler):
+
 2020-05-05  Ross Kirsling  <ross.kirsl...@sony.com>
 
         [ECMA-402] Implement Intl.Locale

Modified: trunk/Source/_javascript_Core/inspector/InspectorEnvironment.h (261232 => 261233)


--- trunk/Source/_javascript_Core/inspector/InspectorEnvironment.h	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/inspector/InspectorEnvironment.h	2020-05-06 16:15:16 UTC (rev 261233)
@@ -51,7 +51,7 @@
     virtual InspectorFunctionCallHandler functionCallHandler() const = 0;
     virtual InspectorEvaluateHandler evaluateHandler() const = 0;
     virtual void frontendInitialized() = 0;
-    virtual Ref<WTF::Stopwatch> executionStopwatch() = 0;
+    virtual WTF::Stopwatch& executionStopwatch() const = 0;
     virtual ScriptDebugServer& scriptDebugServer() = 0;
     virtual JSC::VM& vm() = 0;
 };

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp (261232 => 261233)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -247,9 +247,9 @@
 #endif
 }
 
-Ref<Stopwatch> JSGlobalObjectInspectorController::executionStopwatch()
+Stopwatch& JSGlobalObjectInspectorController::executionStopwatch() const
 {
-    return m_executionStopwatch.copyRef();
+    return m_executionStopwatch;
 }
 
 JSGlobalObjectScriptDebugServer& JSGlobalObjectInspectorController::scriptDebugServer()

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h (261232 => 261233)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h	2020-05-06 16:15:16 UTC (rev 261233)
@@ -88,7 +88,7 @@
     InspectorFunctionCallHandler functionCallHandler() const override;
     InspectorEvaluateHandler evaluateHandler() const override;
     void frontendInitialized() override;
-    Ref<WTF::Stopwatch> executionStopwatch() override;
+    WTF::Stopwatch& executionStopwatch() const final;
     JSGlobalObjectScriptDebugServer& scriptDebugServer() override;
     JSC::VM& vm() override;
 

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp (261232 => 261233)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -1162,9 +1162,9 @@
         m_continueToLocationBreakpointID = JSC::noBreakpointID;
     }
 
-    RefPtr<Stopwatch> stopwatch = m_injectedScriptManager.inspectorEnvironment().executionStopwatch();
-    if (stopwatch && stopwatch->isActive()) {
-        stopwatch->stop();
+    auto& stopwatch = m_injectedScriptManager.inspectorEnvironment().executionStopwatch();
+    if (stopwatch.isActive()) {
+        stopwatch.stop();
         m_didPauseStopwatch = true;
     }
 }
@@ -1182,7 +1182,7 @@
         .setProbeId(action.identifier)
         .setBatchId(batchId)
         .setSampleId(sampleId)
-        .setTimestamp(m_injectedScriptManager.inspectorEnvironment().executionStopwatch()->elapsedTime().seconds())
+        .setTimestamp(m_injectedScriptManager.inspectorEnvironment().executionStopwatch().elapsedTime().seconds())
         .setPayload(WTFMove(payload))
         .release();
     m_frontendDispatcher->didSampleProbe(WTFMove(result));
@@ -1192,7 +1192,7 @@
 {
     if (m_didPauseStopwatch) {
         m_didPauseStopwatch = false;
-        m_injectedScriptManager.inspectorEnvironment().executionStopwatch()->start();
+        m_injectedScriptManager.inspectorEnvironment().executionStopwatch().start();
     }
 
     m_pausedGlobalObject = nullptr;

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp (261232 => 261233)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -104,7 +104,7 @@
     HeapSnapshotBuilder snapshotBuilder(vm.ensureHeapProfiler());
     snapshotBuilder.buildSnapshot();
 
-    *timestamp = m_environment.executionStopwatch()->elapsedTime().seconds();
+    *timestamp = m_environment.executionStopwatch().elapsedTime().seconds();
     *snapshotData = snapshotBuilder.json([&] (const HeapSnapshotNode& node) {
         if (Structure* structure = node.cell->structure(vm)) {
             if (JSGlobalObject* globalObject = structure->globalObject()) {
@@ -274,7 +274,7 @@
     if (!m_enabled)
         return;
 
-    m_gcStartTime = m_environment.executionStopwatch()->elapsedTime();
+    m_gcStartTime = m_environment.executionStopwatch().elapsedTime();
 }
 
 void InspectorHeapAgent::didGarbageCollect(CollectionScope scope)
@@ -291,7 +291,7 @@
 
     // FIXME: Include number of bytes freed by collection.
 
-    Seconds endTime = m_environment.executionStopwatch()->elapsedTime();
+    Seconds endTime = m_environment.executionStopwatch().elapsedTime();
     dispatchGarbageCollectedEvent(protocolTypeForHeapOperation(scope), m_gcStartTime, endTime);
 
     m_gcStartTime = Seconds::nan();

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorScriptProfilerAgent.cpp (261232 => 261233)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorScriptProfilerAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorScriptProfilerAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -71,13 +71,15 @@
 
     m_tracking = true;
 
+    auto& stopwatch = m_environment.executionStopwatch();
+
 #if ENABLE(SAMPLING_PROFILER)
     if (includeSamples && *includeSamples) {
         VM& vm = m_environment.scriptDebugServer().vm();
-        SamplingProfiler& samplingProfiler = vm.ensureSamplingProfiler(m_environment.executionStopwatch());
+        SamplingProfiler& samplingProfiler = vm.ensureSamplingProfiler(stopwatch);
 
         LockHolder locker(samplingProfiler.getLock());
-        samplingProfiler.setStopWatch(locker, m_environment.executionStopwatch());
+        samplingProfiler.setStopWatch(locker, stopwatch);
         samplingProfiler.noticeCurrentThreadAsJSCExecutionThread(locker);
         samplingProfiler.start(locker);
         m_enabledSamplingProfiler = true;
@@ -88,7 +90,7 @@
 
     m_environment.scriptDebugServer().setProfilingClient(this);
 
-    m_frontendDispatcher->trackingStart(m_environment.executionStopwatch()->elapsedTime().seconds());
+    m_frontendDispatcher->trackingStart(stopwatch.elapsedTime().seconds());
 }
 
 void InspectorScriptProfilerAgent::stopTracking(ErrorString&)
@@ -121,7 +123,7 @@
     }
 #endif
 
-    return m_environment.executionStopwatch()->elapsedTime();
+    return m_environment.executionStopwatch().elapsedTime();
 }
 
 void InspectorScriptProfilerAgent::didEvaluateScript(Seconds startTime, ProfilingReason reason)
@@ -128,7 +130,7 @@
 {
     m_activeEvaluateScript = false;
 
-    Seconds endTime = m_environment.executionStopwatch()->elapsedTime();
+    Seconds endTime = m_environment.executionStopwatch().elapsedTime();
 
     addEvent(startTime, endTime, reason);
 }
@@ -201,7 +203,7 @@
 
 void InspectorScriptProfilerAgent::trackingComplete()
 {
-    auto timestamp = m_environment.executionStopwatch()->elapsedTime().seconds();
+    auto timestamp = m_environment.executionStopwatch().elapsedTime().seconds();
 
 #if ENABLE(SAMPLING_PROFILER)
     if (m_enabledSamplingProfiler) {

Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp (261232 => 261233)


--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -293,7 +293,7 @@
     void* m_machineFrame;
 };
 
-SamplingProfiler::SamplingProfiler(VM& vm, RefPtr<Stopwatch>&& stopwatch)
+SamplingProfiler::SamplingProfiler(VM& vm, Ref<Stopwatch>&& stopwatch)
     : m_isPaused(false)
     , m_isShutDown(false)
     , m_vm(vm)

Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.h (261232 => 261233)


--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.h	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.h	2020-05-06 16:15:16 UTC (rev 261233)
@@ -166,7 +166,7 @@
         { }
     };
 
-    SamplingProfiler(VM&, RefPtr<Stopwatch>&&);
+    SamplingProfiler(VM&, Ref<Stopwatch>&&);
     ~SamplingProfiler();
     void noticeJSLockAcquisition();
     void noticeVMEntry();
@@ -208,7 +208,7 @@
     bool m_needsReportAtExit { false };
     VM& m_vm;
     WeakRandom m_weakRandom;
-    RefPtr<Stopwatch> m_stopwatch;
+    Ref<Stopwatch> m_stopwatch;
     Vector<StackTrace> m_stackTraces;
     Vector<UnprocessedStackTrace> m_unprocessedStackTraces;
     Seconds m_timingInterval;

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (261232 => 261233)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -741,7 +741,7 @@
 }
 
 #if ENABLE(SAMPLING_PROFILER)
-SamplingProfiler& VM::ensureSamplingProfiler(RefPtr<Stopwatch>&& stopwatch)
+SamplingProfiler& VM::ensureSamplingProfiler(Ref<Stopwatch>&& stopwatch)
 {
     if (!m_samplingProfiler)
         m_samplingProfiler = adoptRef(new SamplingProfiler(*this, WTFMove(stopwatch)));

Modified: trunk/Source/_javascript_Core/runtime/VM.h (261232 => 261233)


--- trunk/Source/_javascript_Core/runtime/VM.h	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2020-05-06 16:15:16 UTC (rev 261233)
@@ -324,7 +324,7 @@
 
 #if ENABLE(SAMPLING_PROFILER)
     SamplingProfiler* samplingProfiler() { return m_samplingProfiler.get(); }
-    JS_EXPORT_PRIVATE SamplingProfiler& ensureSamplingProfiler(RefPtr<Stopwatch>&&);
+    JS_EXPORT_PRIVATE SamplingProfiler& ensureSamplingProfiler(Ref<Stopwatch>&&);
 #endif
 
     FuzzerAgent* fuzzerAgent() const { return m_fuzzerAgent.get(); }

Modified: trunk/Source/WTF/ChangeLog (261232 => 261233)


--- trunk/Source/WTF/ChangeLog	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WTF/ChangeLog	2020-05-06 16:15:16 UTC (rev 261233)
@@ -1,3 +1,17 @@
+2020-05-06  Devin Rousso  <drou...@apple.com>
+
+        ASSERT_WITH_MESSAGE(m_isOwnedByMainThread == isMainThread()) when web inspecting
+        https://bugs.webkit.org/show_bug.cgi?id=203638
+        <rdar://problem/56761893>
+
+        Reviewed by Brian Burg.
+
+        * wtf/Stopwatch.h:
+        (WTF::Stopwatch::elapsedTime const): Added.
+        (WTF::Stopwatch::elapsedTimeSince const): Added.
+        (WTF::Stopwatch::elapsedTime): Deleted.
+        (WTF::Stopwatch::elapsedTimeSince): Deleted.
+
 2020-05-06  Darin Adler  <da...@apple.com>
 
         Reduce HAVE(HOSTED_CORE_ANIMATION)

Modified: trunk/Source/WTF/wtf/Stopwatch.h (261232 => 261233)


--- trunk/Source/WTF/wtf/Stopwatch.h	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WTF/wtf/Stopwatch.h	2020-05-06 16:15:16 UTC (rev 261233)
@@ -41,8 +41,8 @@
     void start();
     void stop();
 
-    Seconds elapsedTime();
-    Seconds elapsedTimeSince(MonotonicTime);
+    Seconds elapsedTime() const;
+    Seconds elapsedTimeSince(MonotonicTime) const;
 
     bool isActive() const { return !std::isnan(m_lastStartTime); }
 private:
@@ -73,7 +73,7 @@
     m_lastStartTime = MonotonicTime::nan();
 }
 
-inline Seconds Stopwatch::elapsedTime()
+inline Seconds Stopwatch::elapsedTime() const
 {
     if (!isActive())
         return m_elapsedTime;
@@ -81,7 +81,7 @@
     return m_elapsedTime + (MonotonicTime::now() - m_lastStartTime);
 }
 
-inline Seconds Stopwatch::elapsedTimeSince(MonotonicTime timeStamp)
+inline Seconds Stopwatch::elapsedTimeSince(MonotonicTime timeStamp) const
 {
     if (!isActive())
         return m_elapsedTime;

Modified: trunk/Source/WebCore/ChangeLog (261232 => 261233)


--- trunk/Source/WebCore/ChangeLog	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/ChangeLog	2020-05-06 16:15:16 UTC (rev 261233)
@@ -1,3 +1,49 @@
+2020-05-06  Devin Rousso  <drou...@apple.com>
+
+        ASSERT_WITH_MESSAGE(m_isOwnedByMainThread == isMainThread()) when web inspecting
+        https://bugs.webkit.org/show_bug.cgi?id=203638
+        <rdar://problem/56761893>
+
+        Reviewed by Brian Burg.
+
+        Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it
+        return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists.
+        By not using a `RefPtr`, an additional `copyRef` can be avoided.
+
+        * inspector/InspectorController.h:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::executionStopwatch const): Added.
+        (WebCore::InspectorController::executionStopwatch): Deleted.
+        * inspector/WorkerInspectorController.h:
+        (WebCore::WorkerInspectorController::executionStopwatch const): Added.
+        (WebCore::WorkerInspectorController::executionStopwatch): Deleted.
+
+        * inspector/agents/InspectorAnimationAgent.cpp:
+        (WebCore::InspectorAnimationAgent::startTracking):
+        (WebCore::InspectorAnimationAgent::stopTracking):
+        (WebCore::InspectorAnimationAgent::willApplyKeyframeEffect):
+        (WebCore::InspectorAnimationAgent::stopTrackingDeclarativeAnimation):
+        * inspector/agents/InspectorCPUProfilerAgent.cpp:
+        (WebCore::InspectorCPUProfilerAgent::startTracking):
+        (WebCore::InspectorCPUProfilerAgent::stopTracking):
+        (WebCore::InspectorCPUProfilerAgent::collectSample):
+        * inspector/agents/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::mediaMetricsTimerFired):
+        * inspector/agents/InspectorMemoryAgent.cpp:
+        (WebCore::InspectorMemoryAgent::startTracking):
+        (WebCore::InspectorMemoryAgent::stopTracking):
+        (WebCore::InspectorMemoryAgent::didHandleMemoryPressure):
+        (WebCore::InspectorMemoryAgent::collectSample):
+        * inspector/agents/InspectorNetworkAgent.cpp:
+        (WebCore::InspectorNetworkAgent::buildObjectForTiming):
+        (WebCore::InspectorNetworkAgent::timestamp):
+        (WebCore::InspectorNetworkAgent::didFinishLoading):
+        * inspector/agents/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::enable):
+        (WebCore::InspectorPageAgent::timestamp):
+        * inspector/agents/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::timestamp):
+
 2020-05-06  Darin Adler  <da...@apple.com>
 
         Eliminate checks of USE(DICTATION_ALTERNATIVES) in Cocoa-specific code

Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (261232 => 261233)


--- trunk/Source/WebCore/inspector/InspectorController.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -485,9 +485,9 @@
 #endif
 }
 
-Ref<Stopwatch> InspectorController::executionStopwatch()
+Stopwatch& InspectorController::executionStopwatch() const
 {
-    return m_executionStopwatch.copyRef();
+    return m_executionStopwatch;
 }
 
 PageScriptDebugServer& InspectorController::scriptDebugServer()

Modified: trunk/Source/WebCore/inspector/InspectorController.h (261232 => 261233)


--- trunk/Source/WebCore/inspector/InspectorController.h	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/InspectorController.h	2020-05-06 16:15:16 UTC (rev 261233)
@@ -117,7 +117,7 @@
     Inspector::InspectorFunctionCallHandler functionCallHandler() const override;
     Inspector::InspectorEvaluateHandler evaluateHandler() const override;
     void frontendInitialized() override;
-    Ref<WTF::Stopwatch> executionStopwatch() override;
+    WTF::Stopwatch& executionStopwatch() const final;
     PageScriptDebugServer& scriptDebugServer() override;
     JSC::VM& vm() override;
 

Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.h (261232 => 261233)


--- trunk/Source/WebCore/inspector/WorkerInspectorController.h	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.h	2020-05-06 16:15:16 UTC (rev 261233)
@@ -64,7 +64,7 @@
     Inspector::InspectorFunctionCallHandler functionCallHandler() const override;
     Inspector::InspectorEvaluateHandler evaluateHandler() const override;
     void frontendInitialized() override { }
-    Ref<WTF::Stopwatch> executionStopwatch() override { return m_executionStopwatch.copyRef(); }
+    WTF::Stopwatch& executionStopwatch() const final { return m_executionStopwatch; }
     WorkerScriptDebugServer& scriptDebugServer() override { return m_scriptDebugServer; }
     JSC::VM& vm() override;
 

Modified: trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp (261232 => 261233)


--- trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -347,7 +347,7 @@
 
     ASSERT(m_trackedDeclarativeAnimationData.isEmpty());
 
-    m_frontendDispatcher->trackingStart(m_environment.executionStopwatch()->elapsedTime().seconds());
+    m_frontendDispatcher->trackingStart(m_environment.executionStopwatch().elapsedTime().seconds());
 }
 
 void InspectorAnimationAgent::stopTracking(ErrorString&)
@@ -359,7 +359,7 @@
 
     m_trackedDeclarativeAnimationData.clear();
 
-    m_frontendDispatcher->trackingComplete(m_environment.executionStopwatch()->elapsedTime().seconds());
+    m_frontendDispatcher->trackingComplete(m_environment.executionStopwatch().elapsedTime().seconds());
 }
 
 static bool isDelayed(ComputedEffectTiming& computedTiming)
@@ -431,7 +431,7 @@
             ASSERT_NOT_REACHED();
     }
 
-    m_frontendDispatcher->trackingUpdate(m_environment.executionStopwatch()->elapsedTime().seconds(), WTFMove(event));
+    m_frontendDispatcher->trackingUpdate(m_environment.executionStopwatch().elapsedTime().seconds(), WTFMove(event));
 }
 
 void InspectorAnimationAgent::didSetWebAnimationEffect(WebAnimation& animation)
@@ -592,7 +592,7 @@
             .setTrackingAnimationId(it->value.trackingAnimationId)
             .setAnimationState(Inspector::Protocol::Animation::AnimationState::Canceled)
             .release();
-        m_frontendDispatcher->trackingUpdate(m_environment.executionStopwatch()->elapsedTime().seconds(), WTFMove(event));
+        m_frontendDispatcher->trackingUpdate(m_environment.executionStopwatch().elapsedTime().seconds(), WTFMove(event));
     }
 
     m_trackedDeclarativeAnimationData.remove(it);

Modified: trunk/Source/WebCore/inspector/agents/InspectorCPUProfilerAgent.cpp (261232 => 261233)


--- trunk/Source/WebCore/inspector/agents/InspectorCPUProfilerAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/agents/InspectorCPUProfilerAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -70,7 +70,7 @@
 
     m_tracking = true;
 
-    m_frontendDispatcher->trackingStart(m_environment.executionStopwatch()->elapsedTime().seconds());
+    m_frontendDispatcher->trackingStart(m_environment.executionStopwatch().elapsedTime().seconds());
 }
 
 void InspectorCPUProfilerAgent::stopTracking(ErrorString&)
@@ -82,7 +82,7 @@
 
     m_tracking = false;
 
-    m_frontendDispatcher->trackingComplete(m_environment.executionStopwatch()->elapsedTime().seconds());
+    m_frontendDispatcher->trackingComplete(m_environment.executionStopwatch().elapsedTime().seconds());
 }
 
 static Ref<Protocol::CPUProfiler::ThreadInfo> buildThreadInfo(const ThreadCPUInfo& thread)
@@ -108,7 +108,7 @@
 void InspectorCPUProfilerAgent::collectSample(const ResourceUsageData& data)
 {
     auto event = Protocol::CPUProfiler::Event::create()
-        .setTimestamp(m_environment.executionStopwatch()->elapsedTimeSince(data.timestamp).seconds())
+        .setTimestamp(m_environment.executionStopwatch().elapsedTimeSince(data.timestamp).seconds())
         .setUsage(data.cpuExcludingDebuggerThreads)
         .release();
 

Modified: trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (261232 => 261233)


--- trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -262,7 +262,7 @@
             data->setBoolean("enabled"_s, !!node->document().fullscreenManager().fullscreenElement());
 #endif // ENABLE(FULLSCREEN_API)
 
-        auto timestamp = m_domAgent.m_environment.executionStopwatch()->elapsedTime().seconds();
+        auto timestamp = m_domAgent.m_environment.executionStopwatch().elapsedTime().seconds();
         m_domAgent.m_frontendDispatcher->didFireEvent(nodeId, event.type(), timestamp, data->size() ? WTFMove(data) : nullptr);
     }
 
@@ -2591,7 +2591,7 @@
 
             int nodeId = pushNodePathToFrontend(mediaElement);
             if (nodeId) {
-                auto timestamp = m_environment.executionStopwatch()->elapsedTime().seconds();
+                auto timestamp = m_environment.executionStopwatch().elapsedTime().seconds();
                 m_frontendDispatcher->powerEfficientPlaybackStateChanged(nodeId, timestamp, iterator->value.isPowerEfficient);
             }
         }

Modified: trunk/Source/WebCore/inspector/agents/InspectorMemoryAgent.cpp (261232 => 261233)


--- trunk/Source/WebCore/inspector/agents/InspectorMemoryAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/agents/InspectorMemoryAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -92,7 +92,7 @@
 
     m_tracking = true;
 
-    m_frontendDispatcher->trackingStart(m_environment.executionStopwatch()->elapsedTime().seconds());
+    m_frontendDispatcher->trackingStart(m_environment.executionStopwatch().elapsedTime().seconds());
 }
 
 void InspectorMemoryAgent::stopTracking(ErrorString&)
@@ -104,13 +104,13 @@
 
     m_tracking = false;
 
-    m_frontendDispatcher->trackingComplete(m_environment.executionStopwatch()->elapsedTime().seconds());
+    m_frontendDispatcher->trackingComplete(m_environment.executionStopwatch().elapsedTime().seconds());
 }
 
 void InspectorMemoryAgent::didHandleMemoryPressure(Critical critical)
 {
     MemoryFrontendDispatcher::Severity severity = critical == Critical::Yes ? MemoryFrontendDispatcher::Severity::Critical : MemoryFrontendDispatcher::Severity::NonCritical;
-    m_frontendDispatcher->memoryPressure(m_environment.executionStopwatch()->elapsedTime().seconds(), severity);
+    m_frontendDispatcher->memoryPressure(m_environment.executionStopwatch().elapsedTime().seconds(), severity);
 }
 
 void InspectorMemoryAgent::collectSample(const ResourceUsageData& data)
@@ -154,7 +154,7 @@
     categories->addItem(WTFMove(otherCategory));
 
     auto event = Protocol::Memory::Event::create()
-        .setTimestamp(m_environment.executionStopwatch()->elapsedTimeSince(data.timestamp).seconds())
+        .setTimestamp(m_environment.executionStopwatch().elapsedTimeSince(data.timestamp).seconds())
         .setCategories(WTFMove(categories))
         .release();
 

Modified: trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp (261232 => 261233)


--- trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -218,7 +218,7 @@
     auto& loadTiming = resourceLoader.loadTiming();
 
     auto elapsedTimeSince = [&] (const MonotonicTime& time) {
-        return m_environment.executionStopwatch()->elapsedTimeSince(time).seconds();
+        return m_environment.executionStopwatch().elapsedTimeSince(time).seconds();
     };
     Optional<NetworkLoadMetrics> empty;
     if (!timing) {
@@ -415,7 +415,7 @@
 
 double InspectorNetworkAgent::timestamp()
 {
-    return m_environment.executionStopwatch()->elapsedTime().seconds();
+    return m_environment.executionStopwatch().elapsedTime().seconds();
 }
 
 void InspectorNetworkAgent::willSendRequest(unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse, InspectorPageAgent::ResourceType type)
@@ -576,7 +576,7 @@
     double elapsedFinishTime;
     if (resourceLoader && networkLoadMetrics.isComplete()) {
         MonotonicTime fetchStart = resourceLoader->loadTiming().fetchStart();
-        Seconds fetchStartInInspector = m_environment.executionStopwatch()->elapsedTimeSince(fetchStart);
+        Seconds fetchStartInInspector = m_environment.executionStopwatch().elapsedTimeSince(fetchStart);
         elapsedFinishTime = (fetchStartInInspector + networkLoadMetrics.responseEnd).seconds();
     } else
         elapsedFinishTime = timestamp();

Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (261232 => 261233)


--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -352,9 +352,9 @@
 
     m_instrumentingAgents.setInspectorPageAgent(this);
 
-    auto stopwatch = m_environment.executionStopwatch();
-    stopwatch->reset();
-    stopwatch->start();
+    auto& stopwatch = m_environment.executionStopwatch();
+    stopwatch.reset();
+    stopwatch.start();
 
 #if HAVE(OS_DARK_MODE_SUPPORT)
     defaultAppearanceDidChange(m_inspectedPage.defaultUseDarkAppearance());
@@ -392,7 +392,7 @@
 
 double InspectorPageAgent::timestamp()
 {
-    return m_environment.executionStopwatch()->elapsedTime().seconds();
+    return m_environment.executionStopwatch().elapsedTime().seconds();
 }
 
 void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources)

Modified: trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp (261232 => 261233)


--- trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2020-05-06 16:01:44 UTC (rev 261232)
+++ trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2020-05-06 16:15:16 UTC (rev 261233)
@@ -267,7 +267,7 @@
 
 double InspectorTimelineAgent::timestamp()
 {
-    return m_environment.executionStopwatch()->elapsedTime().seconds();
+    return m_environment.executionStopwatch().elapsedTime().seconds();
 }
 
 void InspectorTimelineAgent::startFromConsole(JSC::JSGlobalObject* exec, const String& title)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to