Title: [250672] trunk/Source/WebCore
Revision
250672
Author
[email protected]
Date
2019-10-03 12:38:52 -0700 (Thu, 03 Oct 2019)

Log Message

Web Inspector: remove `InspectorInstrumentationCookie`
https://bugs.webkit.org/show_bug.cgi?id=202487

Reviewed by Matt Baker.

All it does is create a shallow-copy of the `InstrumentingAgents` (it copies a pointer to
the `InstrumentingAgents` object, so any of the pointers to the `InspectorAgent` that are
contained therein are shared between each instance) and save the tracking
`InspectorTimelineAgent`'s id (monotonically increasing integer).

All uses of `InspectorInstrumentationCookie` are local values, so there's no way that the
`InspectorTimelineAgent` (or the id) could change in between an
`InspectorInstrumentation::will*` and an `InspectorInstrumentation::did*`, as both the
tracking state and id are controlled by the frontend and cannot "interrupt".

Removing `InspectorInstrumentationCookie` _can_ cause issues is in situations where the
`ScriptExecutionContext` (or `Page`) changes between the `InspectorInstrumentation::will*`
and the `InspectorInstrumentation::did*`, but this can be avoided so long as a pointer to
the "context" used for `InspectorInstrumentation::will*` is saved.

Covered by existing tests: inspector/timeline/*

* inspector/InspectorInstrumentationCookie.h: Removed.
* inspector/InspectorInstrumentationCookie.cpp: Removed.

* inspector/agents/InspectorTimelineAgent.h:
* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::internalStop):
(WebCore::InspectorTimelineAgent::didDispatchEvent):
(WebCore::InspectorTimelineAgent::didPaint):
(WebCore::InspectorTimelineAgent::clearRecordStack): Deleted.

* bindings/js/JSCallbackData.cpp:
(WebCore::JSCallbackData::invokeCallback):
* bindings/js/JSCustomElementInterface.cpp:
(WebCore::constructCustomElementSynchronously):
(WebCore::JSCustomElementInterface::upgradeElement):
(WebCore::JSCustomElementInterface::invokeCallback):
* bindings/js/JSErrorHandler.cpp:
(WebCore::JSErrorHandler::handleEvent):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSExecState.h:
* bindings/js/JSExecStateInstrumentation.h:
(WebCore::JSExecState::instrumentFunctionInternal):
(WebCore::JSExecState::instrumentFunctionCall):
(WebCore::JSExecState::instrumentFunctionConstruct):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::executeFunctionInContext):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::evaluateInWorld):
(WebCore::ScriptController::evaluateModule):
* dom/Document.cpp:
(WebCore::Document::resolveStyle):
* dom/EventTarget.cpp:
(WebCore::EventTarget::innerInvokeEventListeners):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::deliver):
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
* page/DOMTimer.cpp:
(WebCore::DOMTimer::fired):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::dispatchEvent):
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::layout):
* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::notify):
* page/PerformanceObserver.cpp:
(WebCore::PerformanceObserver::deliver):

* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willCallFunction):
(WebCore::InspectorInstrumentation::didCallFunction):
(WebCore::InspectorInstrumentation::willDispatchEvent):
(WebCore::InspectorInstrumentation::didDispatchEvent):
(WebCore::InspectorInstrumentation::willDispatchEventOnWindow):
(WebCore::InspectorInstrumentation::didDispatchEventOnWindow):
(WebCore::InspectorInstrumentation::willEvaluateScript):
(WebCore::InspectorInstrumentation::didEvaluateScript):
(WebCore::InspectorInstrumentation::willFireTimer):
(WebCore::InspectorInstrumentation::didFireTimer):
(WebCore::InspectorInstrumentation::willLayout):
(WebCore::InspectorInstrumentation::didLayout):
(WebCore::InspectorInstrumentation::willRecalculateStyle):
(WebCore::InspectorInstrumentation::didRecalculateStyle):
(WebCore::InspectorInstrumentation::willFireAnimationFrame):
(WebCore::InspectorInstrumentation::didFireAnimationFrame):
(WebCore::InspectorInstrumentation::willFireObserverCallback):
(WebCore::InspectorInstrumentation::didFireObserverCallback):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willCallFunctionImpl):
(WebCore::InspectorInstrumentation::didCallFunctionImpl):
(WebCore::InspectorInstrumentation::willDispatchEventImpl):
(WebCore::InspectorInstrumentation::didDispatchEventImpl):
(WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
(WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
(WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
(WebCore::InspectorInstrumentation::didEvaluateScriptImpl):
(WebCore::InspectorInstrumentation::willFireTimerImpl):
(WebCore::InspectorInstrumentation::didFireTimerImpl):
(WebCore::InspectorInstrumentation::willLayoutImpl):
(WebCore::InspectorInstrumentation::didLayoutImpl):
(WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
(WebCore::InspectorInstrumentation::didRecalculateStyleImpl):
(WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
(WebCore::InspectorInstrumentation::didFireAnimationFrameImpl):
(WebCore::InspectorInstrumentation::willFireObserverCallbackImpl):
(WebCore::InspectorInstrumentation::didFireObserverCallbackImpl):
(WebCore::InspectorInstrumentation::retrieveTimelineAgent): Deleted.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (250671 => 250672)


--- trunk/Source/WebCore/ChangeLog	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/ChangeLog	2019-10-03 19:38:52 UTC (rev 250672)
@@ -1,3 +1,119 @@
+2019-10-03  Devin Rousso  <[email protected]>
+
+        Web Inspector: remove `InspectorInstrumentationCookie`
+        https://bugs.webkit.org/show_bug.cgi?id=202487
+
+        Reviewed by Matt Baker.
+
+        All it does is create a shallow-copy of the `InstrumentingAgents` (it copies a pointer to
+        the `InstrumentingAgents` object, so any of the pointers to the `InspectorAgent` that are
+        contained therein are shared between each instance) and save the tracking
+        `InspectorTimelineAgent`'s id (monotonically increasing integer).
+
+        All uses of `InspectorInstrumentationCookie` are local values, so there's no way that the
+        `InspectorTimelineAgent` (or the id) could change in between an
+        `InspectorInstrumentation::will*` and an `InspectorInstrumentation::did*`, as both the
+        tracking state and id are controlled by the frontend and cannot "interrupt".
+
+        Removing `InspectorInstrumentationCookie` _can_ cause issues is in situations where the
+        `ScriptExecutionContext` (or `Page`) changes between the `InspectorInstrumentation::will*`
+        and the `InspectorInstrumentation::did*`, but this can be avoided so long as a pointer to
+        the "context" used for `InspectorInstrumentation::will*` is saved.
+
+        Covered by existing tests: inspector/timeline/*
+
+        * inspector/InspectorInstrumentationCookie.h: Removed.
+        * inspector/InspectorInstrumentationCookie.cpp: Removed.
+
+        * inspector/agents/InspectorTimelineAgent.h:
+        * inspector/agents/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::internalStop):
+        (WebCore::InspectorTimelineAgent::didDispatchEvent):
+        (WebCore::InspectorTimelineAgent::didPaint):
+        (WebCore::InspectorTimelineAgent::clearRecordStack): Deleted.
+
+        * bindings/js/JSCallbackData.cpp:
+        (WebCore::JSCallbackData::invokeCallback):
+        * bindings/js/JSCustomElementInterface.cpp:
+        (WebCore::constructCustomElementSynchronously):
+        (WebCore::JSCustomElementInterface::upgradeElement):
+        (WebCore::JSCustomElementInterface::invokeCallback):
+        * bindings/js/JSErrorHandler.cpp:
+        (WebCore::JSErrorHandler::handleEvent):
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSEventListener::handleEvent):
+        * bindings/js/JSExecState.h:
+        * bindings/js/JSExecStateInstrumentation.h:
+        (WebCore::JSExecState::instrumentFunctionInternal):
+        (WebCore::JSExecState::instrumentFunctionCall):
+        (WebCore::JSExecState::instrumentFunctionConstruct):
+        * bindings/js/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::executeFunctionInContext):
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::evaluateInWorld):
+        (WebCore::ScriptController::evaluateModule):
+        * dom/Document.cpp:
+        (WebCore::Document::resolveStyle):
+        * dom/EventTarget.cpp:
+        (WebCore::EventTarget::innerInvokeEventListeners):
+        * dom/MutationObserver.cpp:
+        (WebCore::MutationObserver::deliver):
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
+        * page/DOMTimer.cpp:
+        (WebCore::DOMTimer::fired):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::dispatchEvent):
+        * page/FrameViewLayoutContext.cpp:
+        (WebCore::FrameViewLayoutContext::layout):
+        * page/IntersectionObserver.cpp:
+        (WebCore::IntersectionObserver::notify):
+        * page/PerformanceObserver.cpp:
+        (WebCore::PerformanceObserver::deliver):
+
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::willCallFunction):
+        (WebCore::InspectorInstrumentation::didCallFunction):
+        (WebCore::InspectorInstrumentation::willDispatchEvent):
+        (WebCore::InspectorInstrumentation::didDispatchEvent):
+        (WebCore::InspectorInstrumentation::willDispatchEventOnWindow):
+        (WebCore::InspectorInstrumentation::didDispatchEventOnWindow):
+        (WebCore::InspectorInstrumentation::willEvaluateScript):
+        (WebCore::InspectorInstrumentation::didEvaluateScript):
+        (WebCore::InspectorInstrumentation::willFireTimer):
+        (WebCore::InspectorInstrumentation::didFireTimer):
+        (WebCore::InspectorInstrumentation::willLayout):
+        (WebCore::InspectorInstrumentation::didLayout):
+        (WebCore::InspectorInstrumentation::willRecalculateStyle):
+        (WebCore::InspectorInstrumentation::didRecalculateStyle):
+        (WebCore::InspectorInstrumentation::willFireAnimationFrame):
+        (WebCore::InspectorInstrumentation::didFireAnimationFrame):
+        (WebCore::InspectorInstrumentation::willFireObserverCallback):
+        (WebCore::InspectorInstrumentation::didFireObserverCallback):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::willCallFunctionImpl):
+        (WebCore::InspectorInstrumentation::didCallFunctionImpl):
+        (WebCore::InspectorInstrumentation::willDispatchEventImpl):
+        (WebCore::InspectorInstrumentation::didDispatchEventImpl):
+        (WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
+        (WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
+        (WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
+        (WebCore::InspectorInstrumentation::didEvaluateScriptImpl):
+        (WebCore::InspectorInstrumentation::willFireTimerImpl):
+        (WebCore::InspectorInstrumentation::didFireTimerImpl):
+        (WebCore::InspectorInstrumentation::willLayoutImpl):
+        (WebCore::InspectorInstrumentation::didLayoutImpl):
+        (WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
+        (WebCore::InspectorInstrumentation::didRecalculateStyleImpl):
+        (WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
+        (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl):
+        (WebCore::InspectorInstrumentation::willFireObserverCallbackImpl):
+        (WebCore::InspectorInstrumentation::didFireObserverCallbackImpl):
+        (WebCore::InspectorInstrumentation::retrieveTimelineAgent): Deleted.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2019-10-03  Sihui Liu  <[email protected]>
 
         IndexedDB: add size estimate for key path when estimate task size

Modified: trunk/Source/WebCore/Sources.txt (250671 => 250672)


--- trunk/Source/WebCore/Sources.txt	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/Sources.txt	2019-10-03 19:38:52 UTC (rev 250672)
@@ -1346,7 +1346,6 @@
 inspector/InspectorFrontendHost.cpp
 inspector/InspectorHistory.cpp
 inspector/InspectorInstrumentation.cpp
-inspector/InspectorInstrumentationCookie.cpp
 inspector/InspectorInstrumentationPublic.cpp
 inspector/InspectorInstrumentationWebKit.cpp
 inspector/InspectorNodeFinder.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (250671 => 250672)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-10-03 19:38:52 UTC (rev 250672)
@@ -3065,7 +3065,6 @@
 		A578F43C1DE01423003DFC6A /* JSPromiseRejectionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A578F43A1DE013FB003DFC6A /* JSPromiseRejectionEvent.h */; };
 		A578F43F1DE0B630003DFC6A /* RejectedPromiseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = A578F43E1DE0B62B003DFC6A /* RejectedPromiseTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A581ED131FB288CF00CED4EC /* ServiceWorkerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A581ED101FB288C800CED4EC /* ServiceWorkerAgent.h */; };
-		A5840E1D187B74D500843B10 /* InspectorInstrumentationCookie.h in Headers */ = {isa = PBXBuildFile; fileRef = A5840E1B187B74D500843B10 /* InspectorInstrumentationCookie.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A5840E25187B8AC200843B10 /* WebInjectedScriptHost.h in Headers */ = {isa = PBXBuildFile; fileRef = A5840E23187B8AC200843B10 /* WebInjectedScriptHost.h */; };
 		A584FE2618637DAB00843B10 /* CommandLineAPIModuleSource.h in Headers */ = {isa = PBXBuildFile; fileRef = A584FE2518637DAB00843B10 /* CommandLineAPIModuleSource.h */; };
 		A584FE2C1863870F00843B10 /* CommandLineAPIModule.h in Headers */ = {isa = PBXBuildFile; fileRef = A584FE2A1863870F00843B10 /* CommandLineAPIModule.h */; };
@@ -11450,8 +11449,6 @@
 		A578F43E1DE0B62B003DFC6A /* RejectedPromiseTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RejectedPromiseTracker.h; sourceTree = "<group>"; };
 		A581ED101FB288C800CED4EC /* ServiceWorkerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerAgent.h; sourceTree = "<group>"; };
 		A581ED121FB288C900CED4EC /* ServiceWorkerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerAgent.cpp; sourceTree = "<group>"; };
-		A5840E1A187B74D500843B10 /* InspectorInstrumentationCookie.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInstrumentationCookie.cpp; sourceTree = "<group>"; };
-		A5840E1B187B74D500843B10 /* InspectorInstrumentationCookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentationCookie.h; sourceTree = "<group>"; };
 		A5840E22187B8AC200843B10 /* WebInjectedScriptHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInjectedScriptHost.cpp; sourceTree = "<group>"; };
 		A5840E23187B8AC200843B10 /* WebInjectedScriptHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInjectedScriptHost.h; sourceTree = "<group>"; };
 		A584FE2518637DAB00843B10 /* CommandLineAPIModuleSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommandLineAPIModuleSource.h; sourceTree = "<group>"; };
@@ -17117,8 +17114,6 @@
 				7A54857E14E02D51006AE05A /* InspectorHistory.h */,
 				20D629241253690B00081543 /* InspectorInstrumentation.cpp */,
 				20D629251253690B00081543 /* InspectorInstrumentation.h */,
-				A5840E1A187B74D500843B10 /* InspectorInstrumentationCookie.cpp */,
-				A5840E1B187B74D500843B10 /* InspectorInstrumentationCookie.h */,
 				A5860E6A230DE2E100461AAE /* InspectorInstrumentationPublic.cpp */,
 				A5860E6B230DE2E100461AAE /* InspectorInstrumentationPublic.h */,
 				A5860E6C230DE2E200461AAE /* InspectorInstrumentationWebKit.cpp */,
@@ -29795,7 +29790,6 @@
 				7A54858014E02D51006AE05A /* InspectorHistory.h in Headers */,
 				A5B81CAE1FAA44620037D1E6 /* InspectorIndexedDBAgent.h in Headers */,
 				20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */,
-				A5840E1D187B74D500843B10 /* InspectorInstrumentationCookie.h in Headers */,
 				A5860E6D230DE30300461AAE /* InspectorInstrumentationPublic.h in Headers */,
 				A5860E6E230DE30A00461AAE /* InspectorInstrumentationWebKit.h in Headers */,
 				A5B81CAF1FAA44620037D1E6 /* InspectorLayerTreeAgent.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/JSCallbackData.cpp (250671 => 250672)


--- trunk/Source/WebCore/bindings/js/JSCallbackData.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/bindings/js/JSCallbackData.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -83,12 +83,12 @@
     if (!context)
         return JSValue();
 
-    InspectorInstrumentationCookie cookie = JSExecState::instrumentFunctionCall(context, callType, callData);
+    JSExecState::instrumentFunctionCall(context, callType, callData);
 
     returnedException = nullptr;
     JSValue result = JSExecState::profiledCall(exec, JSC::ProfilingReason::Other, function, callType, callData, thisValue, args, returnedException);
 
-    InspectorInstrumentation::didCallFunction(cookie, context);
+    InspectorInstrumentation::didCallFunction(context);
 
     return result;
 }

Modified: trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp (250671 => 250672)


--- trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -124,11 +124,11 @@
         return nullptr;
     }
 
-    InspectorInstrumentationCookie cookie = JSExecState::instrumentFunctionConstruct(&document, constructType, constructData);
+    JSExecState::instrumentFunctionConstruct(&document, constructType, constructData);
     MarkedArgumentBuffer args;
     ASSERT(!args.hasOverflowed());
     JSValue newElement = construct(&state, constructor, constructType, constructData, args);
-    InspectorInstrumentation::didCallFunction(cookie, &document);
+    InspectorInstrumentation::didCallFunction(&document);
     RETURN_IF_EXCEPTION(scope, nullptr);
 
     ASSERT(!newElement.isEmpty());
@@ -199,9 +199,9 @@
 
     MarkedArgumentBuffer args;
     ASSERT(!args.hasOverflowed());
-    InspectorInstrumentationCookie cookie = JSExecState::instrumentFunctionConstruct(context, constructType, constructData);
+    JSExecState::instrumentFunctionConstruct(context, constructType, constructData);
     JSValue returnedElement = construct(state, m_constructor.get(), constructType, constructData, args);
-    InspectorInstrumentation::didCallFunction(cookie, context);
+    InspectorInstrumentation::didCallFunction(context);
 
     m_constructionStack.removeLast();
 
@@ -248,12 +248,12 @@
     addArguments(state, globalObject, args);
     RELEASE_ASSERT(!args.hasOverflowed());
 
-    InspectorInstrumentationCookie cookie = JSExecState::instrumentFunctionCall(context, callType, callData);
+    JSExecState::instrumentFunctionCall(context, callType, callData);
 
     NakedPtr<JSC::Exception> exception;
     JSExecState::call(state, callback, callType, callData, jsElement, args, exception);
 
-    InspectorInstrumentation::didCallFunction(cookie, context);
+    InspectorInstrumentation::didCallFunction(context);
 
     if (exception)
         reportException(state, exception);

Modified: trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp (250671 => 250672)


--- trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -99,12 +99,12 @@
         VM& vm = globalObject->vm();
         VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject);
 
-        InspectorInstrumentationCookie cookie = JSExecState::instrumentFunctionCall(&scriptExecutionContext, callType, callData);
+        JSExecState::instrumentFunctionCall(&scriptExecutionContext, callType, callData);
 
         NakedPtr<JSC::Exception> exception;
         JSValue returnValue = JSExecState::profiledCall(exec, JSC::ProfilingReason::Other, jsFunction, callType, callData, globalObject, args, exception);
 
-        InspectorInstrumentation::didCallFunction(cookie, &scriptExecutionContext);
+        InspectorInstrumentation::didCallFunction(&scriptExecutionContext);
 
         globalObject->setCurrentEvent(savedEvent);
 

Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (250671 => 250672)


--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -168,13 +168,13 @@
 
     VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject);
 
-    InspectorInstrumentationCookie cookie = JSExecState::instrumentFunctionCall(&scriptExecutionContext, callType, callData);
+    JSExecState::instrumentFunctionCall(&scriptExecutionContext, callType, callData);
 
     JSValue thisValue = handleEventFunction == jsFunction ? toJS(exec, globalObject, event.currentTarget()) : jsFunction;
     NakedPtr<JSC::Exception> exception;
     JSValue retval = JSExecState::profiledCall(exec, JSC::ProfilingReason::Other, handleEventFunction, callType, callData, thisValue, args, exception);
 
-    InspectorInstrumentation::didCallFunction(cookie, &scriptExecutionContext);
+    InspectorInstrumentation::didCallFunction(&scriptExecutionContext);
 
     globalObject->setCurrentEvent(savedEvent);
 

Modified: trunk/Source/WebCore/bindings/js/JSExecState.h (250671 => 250672)


--- trunk/Source/WebCore/bindings/js/JSExecState.h	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/bindings/js/JSExecState.h	2019-10-03 19:38:52 UTC (rev 250672)
@@ -37,7 +37,6 @@
 
 namespace WebCore {
 
-class InspectorInstrumentationCookie;
 class ScriptExecutionContext;
 
 class JSExecState {
@@ -119,8 +118,8 @@
         return returnValue;
     }
 
-    static InspectorInstrumentationCookie instrumentFunctionCall(ScriptExecutionContext*, JSC::CallType, const JSC::CallData&);
-    static InspectorInstrumentationCookie instrumentFunctionConstruct(ScriptExecutionContext*, JSC::ConstructType, const JSC::ConstructData&);
+    static void instrumentFunctionCall(ScriptExecutionContext*, JSC::CallType, const JSC::CallData&);
+    static void instrumentFunctionConstruct(ScriptExecutionContext*, JSC::ConstructType, const JSC::ConstructData&);
 
 private:
     explicit JSExecState(JSC::ExecState* exec)
@@ -150,7 +149,7 @@
         threadGlobalData().setCurrentState(state);
     }
 
-    template<typename Type, Type jsType, typename DataType> static InspectorInstrumentationCookie instrumentFunctionInternal(ScriptExecutionContext*, Type, const DataType&);
+    template<typename Type, Type jsType, typename DataType> static void instrumentFunctionInternal(ScriptExecutionContext*, Type, const DataType&);
 
     JSC::ExecState* m_previousState;
     JSC::JSLockHolder m_lock;

Modified: trunk/Source/WebCore/bindings/js/JSExecStateInstrumentation.h (250671 => 250672)


--- trunk/Source/WebCore/bindings/js/JSExecStateInstrumentation.h	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/bindings/js/JSExecStateInstrumentation.h	2019-10-03 19:38:52 UTC (rev 250672)
@@ -33,10 +33,11 @@
 namespace WebCore {
 
 template<typename Type, Type jsType, class DataType>
-inline InspectorInstrumentationCookie JSExecState::instrumentFunctionInternal(ScriptExecutionContext* context, Type callType, const DataType& callData)
+inline void JSExecState::instrumentFunctionInternal(ScriptExecutionContext* context, Type callType, const DataType& callData)
 {
     if (!InspectorInstrumentation::timelineAgentTracking(context))
-        return InspectorInstrumentationCookie();
+        return;
+
     String resourceName;
     int lineNumber = 1;
     int columnNumber = 1;
@@ -46,17 +47,17 @@
         columnNumber = callData.js.functionExecutable->startColumn();
     } else
         resourceName = "undefined";
-    return InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber, columnNumber);
+    InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber, columnNumber);
 }
 
-inline InspectorInstrumentationCookie JSExecState::instrumentFunctionCall(ScriptExecutionContext* context, JSC::CallType type, const JSC::CallData& data)
+inline void JSExecState::instrumentFunctionCall(ScriptExecutionContext* context, JSC::CallType type, const JSC::CallData& data)
 {
-    return instrumentFunctionInternal<JSC::CallType, JSC::CallType::JS, JSC::CallData>(context, type, data);
+    instrumentFunctionInternal<JSC::CallType, JSC::CallType::JS, JSC::CallData>(context, type, data);
 }
 
-inline InspectorInstrumentationCookie JSExecState::instrumentFunctionConstruct(ScriptExecutionContext* context, JSC::ConstructType type, const JSC::ConstructData& data)
+inline void JSExecState::instrumentFunctionConstruct(ScriptExecutionContext* context, JSC::ConstructType type, const JSC::ConstructData& data)
 {
-    return instrumentFunctionInternal<JSC::ConstructType, JSC::ConstructType::JS, JSC::ConstructData>(context, type, data);
+    instrumentFunctionInternal<JSC::ConstructType, JSC::ConstructType::JS, JSC::ConstructData>(context, type, data);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/ScheduledAction.cpp (250671 => 250672)


--- trunk/Source/WebCore/bindings/js/ScheduledAction.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/bindings/js/ScheduledAction.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -112,12 +112,12 @@
         return;
     }
 
-    InspectorInstrumentationCookie cookie = JSExecState::instrumentFunctionCall(&context, callType, callData);
+    JSExecState::instrumentFunctionCall(&context, callType, callData);
 
     NakedPtr<JSC::Exception> exception;
     JSExecState::profiledCall(exec, JSC::ProfilingReason::Other, m_function.get(), callType, callData, thisValue, arguments, exception);
 
-    InspectorInstrumentation::didCallFunction(cookie, &context);
+    InspectorInstrumentation::didCallFunction(&context);
 
     if (exception)
         reportException(exec, exception);

Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (250671 => 250672)


--- trunk/Source/WebCore/bindings/js/ScriptController.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -127,12 +127,12 @@
 
     Ref<Frame> protector(m_frame);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine(), sourceCode.startColumn());
+    InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine(), sourceCode.startColumn());
 
     NakedPtr<JSC::Exception> evaluationException;
     JSValue returnValue = JSExecState::profiledEvaluate(&exec, JSC::ProfilingReason::Other, jsSourceCode, &proxy, evaluationException);
 
-    InspectorInstrumentation::didEvaluateScript(cookie, m_frame);
+    InspectorInstrumentation::didEvaluateScript(m_frame);
 
     if (evaluationException) {
         reportException(&exec, evaluationException, sourceCode.cachedScript(), exceptionDetails);
@@ -221,10 +221,9 @@
 
     Ref<Frame> protector(m_frame);
 
-    auto cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, jsSourceCode.firstLine().oneBasedInt(), jsSourceCode.startColumn().oneBasedInt());
-
+    InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, jsSourceCode.firstLine().oneBasedInt(), jsSourceCode.startColumn().oneBasedInt());
     auto returnValue = moduleRecord.evaluate(&state);
-    InspectorInstrumentation::didEvaluateScript(cookie, m_frame);
+    InspectorInstrumentation::didEvaluateScript(m_frame);
 
     return returnValue;
 }

Modified: trunk/Source/WebCore/dom/Document.cpp (250671 => 250672)


--- trunk/Source/WebCore/dom/Document.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -1898,7 +1898,7 @@
         frameView.willRecalcStyle();
     }
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(*this);
+    InspectorInstrumentation::willRecalculateStyle(*this);
 
     bool updatedCompositingLayers = false;
     {
@@ -1976,7 +1976,7 @@
         implicitClose();
     }
 
-    InspectorInstrumentation::didRecalculateStyle(cookie);
+    InspectorInstrumentation::didRecalculateStyle(*this);
 
     // Some animated images may now be inside the viewport due to style recalc,
     // resume them if necessary if there is no layout pending. Otherwise, we'll

Modified: trunk/Source/WebCore/dom/EventTarget.cpp (250671 => 250672)


--- trunk/Source/WebCore/dom/EventTarget.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/dom/EventTarget.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -282,9 +282,8 @@
 
     auto& context = *scriptExecutionContext();
     bool contextIsDocument = is<Document>(context);
-    InspectorInstrumentationCookie willDispatchEventCookie;
     if (contextIsDocument)
-        willDispatchEventCookie = InspectorInstrumentation::willDispatchEvent(downcast<Document>(context), event, true);
+        InspectorInstrumentation::willDispatchEvent(downcast<Document>(context), event, true);
 
     for (auto& registeredListener : listeners) {
         if (UNLIKELY(registeredListener->wasRemoved()))
@@ -323,7 +322,7 @@
     }
 
     if (contextIsDocument)
-        InspectorInstrumentation::didDispatchEvent(willDispatchEventCookie, event.defaultPrevented());
+        InspectorInstrumentation::didDispatchEvent(downcast<Document>(context), event.defaultPrevented());
 }
 
 Vector<AtomString> EventTarget::eventTypes()

Modified: trunk/Source/WebCore/dom/MutationObserver.cpp (250671 => 250672)


--- trunk/Source/WebCore/dom/MutationObserver.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/dom/MutationObserver.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -250,9 +250,9 @@
         if (!context)
             return;
 
-        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireObserverCallback(*context, "MutationObserver"_s);
+        InspectorInstrumentation::willFireObserverCallback(*context, "MutationObserver"_s);
         m_callback->handleEvent(*this, records, *this);
-        InspectorInstrumentation::didFireObserverCallback(cookie);
+        InspectorInstrumentation::didFireObserverCallback(*context);
     }
 }
 

Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (250671 => 250672)


--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -212,9 +212,10 @@
         if (callback->m_firedOrCancelled)
             continue;
         callback->m_firedOrCancelled = true;
-        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireAnimationFrame(protectedDocument, callback->m_id);
+
+        InspectorInstrumentation::willFireAnimationFrame(protectedDocument, callback->m_id);
         callback->handleEvent(highResNowMs);
-        InspectorInstrumentation::didFireAnimationFrame(cookie);
+        InspectorInstrumentation::didFireAnimationFrame(protectedDocument);
     }
 
     // Remove any callbacks we fired from the list of pending callbacks.

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (250671 => 250672)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -383,32 +383,25 @@
         webDebuggerAgent->didDispatchPostMessage(timer);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents& instrumentingAgents, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext* context)
+void InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents& instrumentingAgents, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext* context)
 {
-    int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->willCallFunction(scriptName, scriptLine, scriptColumn, frameForScriptExecutionContext(context));
-        timelineAgentId = timelineAgent->id();
-    }
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didCallFunctionImpl(const InspectorInstrumentationCookie& cookie, ScriptExecutionContext* context)
+void InspectorInstrumentation::didCallFunctionImpl(InstrumentingAgents& instrumentingAgents, ScriptExecutionContext* context)
 {
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->didCallFunction(frameForScriptExecutionContext(context));
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InstrumentingAgents& instrumentingAgents, Document& document, const Event& event, bool hasEventListeners)
+void InspectorInstrumentation::willDispatchEventImpl(InstrumentingAgents& instrumentingAgents, Document& document, const Event& event, bool hasEventListeners)
 {
-    int timelineAgentId = 0;
-    InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent();
-    if (timelineAgent && hasEventListeners) {
+    if (!hasEventListeners)
+        return;
+
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->willDispatchEvent(event, document.frame());
-        timelineAgentId = timelineAgent->id();
-    }
-
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
 void InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents& instrumentingAgents, Event& event, const RegisteredEventListener& listener)
@@ -429,27 +422,24 @@
         domDebuggerAgent->didHandleEvent();
 }
 
-void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie, bool defaultPrevented)
+void InspectorInstrumentation::didDispatchEventImpl(InstrumentingAgents& instrumentingAgents, bool defaultPrevented)
 {
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->didDispatchEvent(defaultPrevented);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InstrumentingAgents& instrumentingAgents, const Event& event, DOMWindow& window)
+void InspectorInstrumentation::willDispatchEventOnWindowImpl(InstrumentingAgents& instrumentingAgents, const Event& event, DOMWindow& window)
 {
-    int timelineAgentId = 0;
-    InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent();
-    if (timelineAgent && window.hasEventListeners(event.type())) {
+    if (!window.hasEventListeners(event.type()))
+        return;
+
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->willDispatchEvent(event, window.frame());
-        timelineAgentId = timelineAgent->id();
-    }
-
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie& cookie, bool defaultPrevented)
+void InspectorInstrumentation::didDispatchEventOnWindowImpl(InstrumentingAgents& instrumentingAgents, bool defaultPrevented)
 {
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->didDispatchEvent(defaultPrevented);
 }
 
@@ -459,43 +449,33 @@
         domAgent->eventDidResetAfterDispatch(event);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& url, int lineNumber, int columnNumber)
+void InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& url, int lineNumber, int columnNumber)
 {
-    int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->willEvaluateScript(url, lineNumber, columnNumber, frame);
-        timelineAgentId = timelineAgent->id();
-    }
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didEvaluateScriptImpl(const InspectorInstrumentationCookie& cookie, Frame& frame)
+void InspectorInstrumentation::didEvaluateScriptImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->didEvaluateScript(frame);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InstrumentingAgents& instrumentingAgents, int timerId, bool oneShot, ScriptExecutionContext& context)
+void InspectorInstrumentation::willFireTimerImpl(InstrumentingAgents& instrumentingAgents, int timerId, bool oneShot, ScriptExecutionContext& context)
 {
     if (auto* webDebuggerAgent = instrumentingAgents.webDebuggerAgent())
         webDebuggerAgent->willDispatchAsyncCall(InspectorDebuggerAgent::AsyncCallType::DOMTimer, timerId);
-
-    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
+    if (auto* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
         domDebuggerAgent->willFireTimer(oneShot);
-
-    int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->willFireTimer(timerId, frameForScriptExecutionContext(context));
-        timelineAgentId = timelineAgent->id();
-    }
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCookie& cookie)
+void InspectorInstrumentation::didFireTimerImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (auto* webDebuggerAgent = cookie.instrumentingAgents()->webDebuggerAgent())
+    if (auto* webDebuggerAgent = instrumentingAgents.webDebuggerAgent())
         webDebuggerAgent->didDispatchAsyncCall();
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->didFireTimer();
 }
 
@@ -505,22 +485,17 @@
         timelineAgent->didInvalidateLayout(frame);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
+void InspectorInstrumentation::willLayoutImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
-    int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->willLayout(frame);
-        timelineAgentId = timelineAgent->id();
-    }
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCookie& cookie, RenderObject& root)
+void InspectorInstrumentation::didLayoutImpl(InstrumentingAgents& instrumentingAgents, RenderObject& root)
 {
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->didLayout(root);
-
-    if (InspectorPageAgent* pageAgent = cookie.instrumentingAgents()->inspectorPageAgent())
+    if (auto* pageAgent = instrumentingAgents.inspectorPageAgent())
         pageAgent->didLayout();
 }
 
@@ -551,26 +526,17 @@
         pageAgent->didPaint(renderer, rect);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyleImpl(InstrumentingAgents& instrumentingAgents, Document& document)
+void InspectorInstrumentation::willRecalculateStyleImpl(InstrumentingAgents& instrumentingAgents, Document& document)
 {
-    int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->willRecalculateStyle(document.frame());
-        timelineAgentId = timelineAgent->id();
-    }
     if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent())
         networkAgent->willRecalculateStyle();
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrumentationCookie& cookie)
+void InspectorInstrumentation::didRecalculateStyleImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (!cookie.isValid())
-        return;
-    
-    InstrumentingAgents& instrumentingAgents = *cookie.instrumentingAgents();
-
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->didRecalculateStyle();
     if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent())
         networkAgent->didRecalculateStyle();
@@ -1201,43 +1167,33 @@
         timelineAgent->didCancelAnimationFrame(callbackId, document.frame());
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrameImpl(InstrumentingAgents& instrumentingAgents, int callbackId, Document& document)
+void InspectorInstrumentation::willFireAnimationFrameImpl(InstrumentingAgents& instrumentingAgents, int callbackId, Document& document)
 {
     if (auto* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())
         pageDebuggerAgent->willFireAnimationFrame(callbackId);
-
     if (auto* pageDOMDebuggerAgent = instrumentingAgents.pageDOMDebuggerAgent())
         pageDOMDebuggerAgent->willFireAnimationFrame();
-
-    int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->willFireAnimationFrame(callbackId, document.frame());
-        timelineAgentId = timelineAgent->id();
-    }
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didFireAnimationFrameImpl(const InspectorInstrumentationCookie& cookie)
+void InspectorInstrumentation::didFireAnimationFrameImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (auto* webDebuggerAgent = cookie.instrumentingAgents()->webDebuggerAgent())
+    if (auto* webDebuggerAgent = instrumentingAgents.webDebuggerAgent())
         webDebuggerAgent->didDispatchAsyncCall();
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->didFireAnimationFrame();
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willFireObserverCallbackImpl(InstrumentingAgents& instrumentingAgents, const String& callbackType, ScriptExecutionContext& context)
+void InspectorInstrumentation::willFireObserverCallbackImpl(InstrumentingAgents& instrumentingAgents, const String& callbackType, ScriptExecutionContext& context)
 {
-    int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->willFireObserverCallback(callbackType, frameForScriptExecutionContext(&context));
-        timelineAgentId = timelineAgent->id();
-    }
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didFireObserverCallbackImpl(const InspectorInstrumentationCookie& cookie)
+void InspectorInstrumentation::didFireObserverCallbackImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
         timelineAgent->didFireObserverCallback();
 }
 
@@ -1261,17 +1217,6 @@
     }
 }
 
-InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
-{
-    if (!cookie.isValid())
-        return nullptr;
-
-    InspectorTimelineAgent* timelineAgent = cookie.instrumentingAgents()->trackingInspectorTimelineAgent();
-    if (timelineAgent && cookie.hasMatchingTimelineAgentId(timelineAgent->id()))
-        return timelineAgent;
-    return nullptr;
-}
-
 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForRenderer(RenderObject& renderer)
 {
     return instrumentingAgentsForFrame(renderer.frame());

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (250671 => 250672)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2019-10-03 19:38:52 UTC (rev 250672)
@@ -42,7 +42,6 @@
 #include "FormData.h"
 #include "Frame.h"
 #include "HitTestResult.h"
-#include "InspectorInstrumentationCookie.h"
 #include "InspectorInstrumentationPublic.h"
 #include "Page.h"
 #include "StorageArea.h"
@@ -157,32 +156,32 @@
     static void willDispatchPostMessage(Frame&, TimerBase&);
     static void didDispatchPostMessage(Frame&, TimerBase&);
 
-    static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine, int scriptColumn);
-    static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
+    static void willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine, int scriptColumn);
+    static void didCallFunction(ScriptExecutionContext*);
     static void didAddEventListener(EventTarget&, const AtomString& eventType, EventListener&, bool capture);
     static void willRemoveEventListener(EventTarget&, const AtomString& eventType, EventListener&, bool capture);
     static bool isEventListenerDisabled(EventTarget&, const AtomString& eventType, EventListener&, bool capture);
-    static InspectorInstrumentationCookie willDispatchEvent(Document&, const Event&, bool hasEventListeners);
-    static void didDispatchEvent(const InspectorInstrumentationCookie&, bool defaultPrevented);
+    static void willDispatchEvent(Document&, const Event&, bool hasEventListeners);
+    static void didDispatchEvent(Document&, bool defaultPrevented);
     static void willHandleEvent(ScriptExecutionContext&, Event&, const RegisteredEventListener&);
     static void didHandleEvent(ScriptExecutionContext&);
-    static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event&, DOMWindow&);
-    static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&, bool defaultPrevented);
+    static void willDispatchEventOnWindow(Frame*, const Event&, DOMWindow&);
+    static void didDispatchEventOnWindow(Frame*, bool defaultPrevented);
     static void eventDidResetAfterDispatch(const Event&);
-    static InspectorInstrumentationCookie willEvaluateScript(Frame&, const String& url, int lineNumber, int columnNumber);
-    static void didEvaluateScript(const InspectorInstrumentationCookie&, Frame&);
-    static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext&, int timerId, bool oneShot);
-    static void didFireTimer(const InspectorInstrumentationCookie&);
+    static void willEvaluateScript(Frame&, const String& url, int lineNumber, int columnNumber);
+    static void didEvaluateScript(Frame&);
+    static void willFireTimer(ScriptExecutionContext&, int timerId, bool oneShot);
+    static void didFireTimer(ScriptExecutionContext&);
     static void didInvalidateLayout(Frame&);
-    static InspectorInstrumentationCookie willLayout(Frame&);
-    static void didLayout(const InspectorInstrumentationCookie&, RenderObject&);
+    static void willLayout(Frame&);
+    static void didLayout(Frame&, RenderObject&);
     static void didScroll(Page&);
     static void willComposite(Frame&);
     static void didComposite(Frame&);
     static void willPaint(RenderObject&);
     static void didPaint(RenderObject&, const LayoutRect&);
-    static InspectorInstrumentationCookie willRecalculateStyle(Document&);
-    static void didRecalculateStyle(const InspectorInstrumentationCookie&);
+    static void willRecalculateStyle(Document&);
+    static void didRecalculateStyle(Document&);
     static void didScheduleStyleRecalculation(Document&);
     static void applyUserAgentOverride(Frame&, String&);
     static void applyEmulatedMedia(Frame&, String&);
@@ -254,11 +253,11 @@
 
     static void didRequestAnimationFrame(Document&, int callbackId);
     static void didCancelAnimationFrame(Document&, int callbackId);
-    static InspectorInstrumentationCookie willFireAnimationFrame(Document&, int callbackId);
-    static void didFireAnimationFrame(const InspectorInstrumentationCookie&);
+    static void willFireAnimationFrame(Document&, int callbackId);
+    static void didFireAnimationFrame(Document&);
 
-    static InspectorInstrumentationCookie willFireObserverCallback(ScriptExecutionContext&, const String& callbackType);
-    static void didFireObserverCallback(const InspectorInstrumentationCookie&);
+    static void willFireObserverCallback(ScriptExecutionContext&, const String& callbackType);
+    static void didFireObserverCallback(ScriptExecutionContext&);
 
     static void didOpenDatabase(Database&);
 
@@ -367,32 +366,32 @@
     static void willDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&);
     static void didDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&);
 
-    static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext*);
-    static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
+    static void willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext*);
+    static void didCallFunctionImpl(InstrumentingAgents&, ScriptExecutionContext*);
     static void didAddEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomString& eventType, EventListener&, bool capture);
     static void willRemoveEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomString& eventType, EventListener&, bool capture);
     static bool isEventListenerDisabledImpl(InstrumentingAgents&, EventTarget&, const AtomString& eventType, EventListener&, bool capture);
-    static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents&, Document&, const Event&, bool hasEventListeners);
+    static void willDispatchEventImpl(InstrumentingAgents&, Document&, const Event&, bool hasEventListeners);
     static void willHandleEventImpl(InstrumentingAgents&, Event&, const RegisteredEventListener&);
     static void didHandleEventImpl(InstrumentingAgents&);
-    static void didDispatchEventImpl(const InspectorInstrumentationCookie&, bool defaultPrevented);
-    static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents&, const Event&, DOMWindow&);
-    static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&, bool defaultPrevented);
+    static void didDispatchEventImpl(InstrumentingAgents&, bool defaultPrevented);
+    static void willDispatchEventOnWindowImpl(InstrumentingAgents&, const Event&, DOMWindow&);
+    static void didDispatchEventOnWindowImpl(InstrumentingAgents&, bool defaultPrevented);
     static void eventDidResetAfterDispatchImpl(InstrumentingAgents&, const Event&);
-    static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber, int columnNumber);
-    static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&, Frame&);
-    static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents&, int timerId, bool oneShot, ScriptExecutionContext&);
-    static void didFireTimerImpl(const InspectorInstrumentationCookie&);
+    static void willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber, int columnNumber);
+    static void didEvaluateScriptImpl(InstrumentingAgents&, Frame&);
+    static void willFireTimerImpl(InstrumentingAgents&, int timerId, bool oneShot, ScriptExecutionContext&);
+    static void didFireTimerImpl(InstrumentingAgents&);
     static void didInvalidateLayoutImpl(InstrumentingAgents&, Frame&);
-    static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents&, Frame&);
-    static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject&);
+    static void willLayoutImpl(InstrumentingAgents&, Frame&);
+    static void didLayoutImpl(InstrumentingAgents&, RenderObject&);
     static void didScrollImpl(InstrumentingAgents&);
     static void willCompositeImpl(InstrumentingAgents&, Frame&);
     static void didCompositeImpl(InstrumentingAgents&);
     static void willPaintImpl(InstrumentingAgents&, RenderObject&);
     static void didPaintImpl(InstrumentingAgents&, RenderObject&, const LayoutRect&);
-    static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents&, Document&);
-    static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
+    static void willRecalculateStyleImpl(InstrumentingAgents&, Document&);
+    static void didRecalculateStyleImpl(InstrumentingAgents&);
     static void didScheduleStyleRecalculationImpl(InstrumentingAgents&, Document&);
     static void applyUserAgentOverrideImpl(InstrumentingAgents&, String&);
     static void applyEmulatedMediaImpl(InstrumentingAgents&, String&);
@@ -445,11 +444,11 @@
 
     static void didRequestAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&);
     static void didCancelAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&);
-    static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&);
-    static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&);
+    static void willFireAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&);
+    static void didFireAnimationFrameImpl(InstrumentingAgents&);
 
-    static InspectorInstrumentationCookie willFireObserverCallbackImpl(InstrumentingAgents&, const String&, ScriptExecutionContext&);
-    static void didFireObserverCallbackImpl(const InspectorInstrumentationCookie&);
+    static void willFireObserverCallbackImpl(InstrumentingAgents&, const String&, ScriptExecutionContext&);
+    static void didFireObserverCallbackImpl(InstrumentingAgents&);
 
     static void didOpenDatabaseImpl(InstrumentingAgents&, Database&);
 
@@ -509,8 +508,6 @@
     static InstrumentingAgents* instrumentingAgentsForDocument(Document*);
     static InstrumentingAgents* instrumentingAgentsForRenderer(RenderObject&);
     static InstrumentingAgents* instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope*);
-
-    static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
 };
 
 inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame& frame, DOMWrapperWorld& world)
@@ -818,34 +815,32 @@
         didDispatchPostMessageImpl(*instrumentingAgents, timer);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine, int scriptColumn)
+inline void InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine, int scriptColumn)
 {
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, scriptColumn, context);
-    return InspectorInstrumentationCookie();
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (auto* instrumentingAgents = instrumentingAgentsForContext(context))
+        willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, scriptColumn, context);
 }
 
-inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie, ScriptExecutionContext* context)
+inline void InspectorInstrumentation::didCallFunction(ScriptExecutionContext* context)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didCallFunctionImpl(cookie, context);
+    if (auto* instrumentingAgents = instrumentingAgentsForContext(context))
+        didCallFunctionImpl(*instrumentingAgents, context);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document& document, const Event& event, bool hasEventListeners)
+inline void InspectorInstrumentation::willDispatchEvent(Document& document, const Event& event, bool hasEventListeners)
 {
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        return willDispatchEventImpl(*instrumentingAgents, document, event, hasEventListeners);
-    return InspectorInstrumentationCookie();
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (auto* instrumentingAgents = instrumentingAgentsForDocument(document))
+        willDispatchEventImpl(*instrumentingAgents, document, event, hasEventListeners);
 }
 
-inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrumentationCookie& cookie, bool defaultPrevented)
+inline void InspectorInstrumentation::didDispatchEvent(Document& document, bool defaultPrevented)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didDispatchEventImpl(cookie, defaultPrevented);
+    if (auto* instrumentingAgents = instrumentingAgentsForDocument(document))
+        didDispatchEventImpl(*instrumentingAgents, defaultPrevented);
 }
 
 inline void InspectorInstrumentation::willHandleEvent(ScriptExecutionContext& context, Event& event, const RegisteredEventListener& listener)
@@ -862,19 +857,18 @@
         return didHandleEventImpl(*instrumentingAgents);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow& window)
+inline void InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow& window)
 {
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willDispatchEventOnWindowImpl(*instrumentingAgents, event, window);
-    return InspectorInstrumentationCookie();
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        willDispatchEventOnWindowImpl(*instrumentingAgents, event, window);
 }
 
-inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorInstrumentationCookie& cookie, bool defaultPrevented)
+inline void InspectorInstrumentation::didDispatchEventOnWindow(Frame* frame, bool defaultPrevented)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didDispatchEventOnWindowImpl(cookie, defaultPrevented);
+    if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        didDispatchEventOnWindowImpl(*instrumentingAgents, defaultPrevented);
 }
 
 inline void InspectorInstrumentation::eventDidResetAfterDispatch(const Event& event)
@@ -889,34 +883,32 @@
         return eventDidResetAfterDispatchImpl(*instrumentingAgents, event);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber, int columnNumber)
+inline void InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber, int columnNumber)
 {
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber, columnNumber);
-    return InspectorInstrumentationCookie();
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber, columnNumber);
 }
 
-inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie, Frame& frame)
+inline void InspectorInstrumentation::didEvaluateScript(Frame& frame)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didEvaluateScriptImpl(cookie, frame);
+    if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        didEvaluateScriptImpl(*instrumentingAgents, frame);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext& context, int timerId, bool oneShot)
+inline void InspectorInstrumentation::willFireTimer(ScriptExecutionContext& context, int timerId, bool oneShot)
 {
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willFireTimerImpl(*instrumentingAgents, timerId, oneShot, context);
-    return InspectorInstrumentationCookie();
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (auto* instrumentingAgents = instrumentingAgentsForContext(context))
+        willFireTimerImpl(*instrumentingAgents, timerId, oneShot, context);
 }
 
-inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentationCookie& cookie)
+inline void InspectorInstrumentation::didFireTimer(ScriptExecutionContext& context)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didFireTimerImpl(cookie);
+    if (auto* instrumentingAgents = instrumentingAgentsForContext(context))
+        didFireTimerImpl(*instrumentingAgents);
 }
 
 inline void InspectorInstrumentation::didInvalidateLayout(Frame& frame)
@@ -926,19 +918,18 @@
         didInvalidateLayoutImpl(*instrumentingAgents, frame);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame& frame)
+inline void InspectorInstrumentation::willLayout(Frame& frame)
 {
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willLayoutImpl(*instrumentingAgents, frame);
-    return InspectorInstrumentationCookie();
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        willLayoutImpl(*instrumentingAgents, frame);
 }
 
-inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie, RenderObject& root)
+inline void InspectorInstrumentation::didLayout(Frame& frame, RenderObject& root)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didLayoutImpl(cookie, root);
+    if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        didLayoutImpl(*instrumentingAgents, root);
 }
 
 inline void InspectorInstrumentation::didScroll(Page& page)
@@ -975,19 +966,18 @@
         didPaintImpl(*instrumentingAgents, renderer, rect);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document& document)
+inline void InspectorInstrumentation::willRecalculateStyle(Document& document)
 {
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        return willRecalculateStyleImpl(*instrumentingAgents, document);
-    return InspectorInstrumentationCookie();
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (auto* instrumentingAgents = instrumentingAgentsForDocument(document))
+        willRecalculateStyleImpl(*instrumentingAgents, document);
 }
 
-inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie)
+inline void InspectorInstrumentation::didRecalculateStyle(Document& document)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didRecalculateStyleImpl(cookie);
+    if (auto* instrumentingAgents = instrumentingAgentsForDocument(document))
+        didRecalculateStyleImpl(*instrumentingAgents);
 }
 
 inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document& document)
@@ -1578,34 +1568,32 @@
         didCancelAnimationFrameImpl(*instrumentingAgents, callbackId, document);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrame(Document& document, int callbackId)
+inline void InspectorInstrumentation::willFireAnimationFrame(Document& document, int callbackId)
 {
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        return willFireAnimationFrameImpl(*instrumentingAgents, callbackId, document);
-    return InspectorInstrumentationCookie();
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (auto* instrumentingAgents = instrumentingAgentsForDocument(document))
+        willFireAnimationFrameImpl(*instrumentingAgents, callbackId, document);
 }
 
-inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstrumentationCookie& cookie)
+inline void InspectorInstrumentation::didFireAnimationFrame(Document& document)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didFireAnimationFrameImpl(cookie);
+    if (auto* instrumentingAgents = instrumentingAgentsForDocument(document))
+        didFireAnimationFrameImpl(*instrumentingAgents);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willFireObserverCallback(ScriptExecutionContext& context, const String& callbackType)
+inline void InspectorInstrumentation::willFireObserverCallback(ScriptExecutionContext& context, const String& callbackType)
 {
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willFireObserverCallbackImpl(*instrumentingAgents, callbackType, context);
-    return InspectorInstrumentationCookie();
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (auto* instrumentingAgents = instrumentingAgentsForContext(context))
+        willFireObserverCallbackImpl(*instrumentingAgents, callbackType, context);
 }
 
-inline void InspectorInstrumentation::didFireObserverCallback(const InspectorInstrumentationCookie& cookie)
+inline void InspectorInstrumentation::didFireObserverCallback(ScriptExecutionContext& context)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didFireObserverCallbackImpl(cookie);
+    if (auto* instrumentingAgents = instrumentingAgentsForContext(context))
+        didFireObserverCallbackImpl(*instrumentingAgents);
 }
 
 inline void InspectorInstrumentation::layerTreeDidChange(Page* page)

Deleted: trunk/Source/WebCore/inspector/InspectorInstrumentationCookie.cpp (250671 => 250672)


--- trunk/Source/WebCore/inspector/InspectorInstrumentationCookie.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentationCookie.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -1,67 +0,0 @@
-/*
-* Copyright (C) 2011 Google Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*
-*     * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-*     * Redistributions in binary form must reproduce the above
-* copyright notice, this list of conditions and the following disclaimer
-* in the documentation and/or other materials provided with the
-* distribution.
-*     * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "config.h"
-#include "InspectorInstrumentationCookie.h"
-
-#include "InstrumentingAgents.h"
-
-namespace WebCore {
-
-InspectorInstrumentationCookie::InspectorInstrumentationCookie()
-    : m_timelineAgentId(0)
-{
-}
-
-InspectorInstrumentationCookie::InspectorInstrumentationCookie(InstrumentingAgents& agents, int timelineAgentId)
-    : m_instrumentingAgents(&agents)
-    , m_timelineAgentId(timelineAgentId)
-{
-}
-
-InspectorInstrumentationCookie::InspectorInstrumentationCookie(const InspectorInstrumentationCookie& other)
-    : m_instrumentingAgents(other.m_instrumentingAgents)
-    , m_timelineAgentId(other.m_timelineAgentId)
-{
-}
-
-InspectorInstrumentationCookie& InspectorInstrumentationCookie::operator=(const InspectorInstrumentationCookie& other)
-{
-    if (this != &other) {
-        m_instrumentingAgents = other.m_instrumentingAgents;
-        m_timelineAgentId = other.m_timelineAgentId;
-    }
-
-    return *this;
-}
-
-InspectorInstrumentationCookie::~InspectorInstrumentationCookie() = default;
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/inspector/InspectorInstrumentationCookie.h (250671 => 250672)


--- trunk/Source/WebCore/inspector/InspectorInstrumentationCookie.h	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentationCookie.h	2019-10-03 19:38:52 UTC (rev 250672)
@@ -1,56 +0,0 @@
-/*
-* Copyright (C) 2010 Google Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*
-*     * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-*     * Redistributions in binary form must reproduce the above
-* copyright notice, this list of conditions and the following disclaimer
-* in the documentation and/or other materials provided with the
-* distribution.
-*     * Neither the name of Google Inc. nor the names of its
-* contributors may be used to endorse or promote products derived from
-* this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#pragma once
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class InstrumentingAgents;
-
-class InspectorInstrumentationCookie {
-public:
-    InspectorInstrumentationCookie();
-    InspectorInstrumentationCookie(InstrumentingAgents&, int);
-    InspectorInstrumentationCookie(const InspectorInstrumentationCookie&);
-    InspectorInstrumentationCookie& operator=(const InspectorInstrumentationCookie&);
-    ~InspectorInstrumentationCookie();
-
-    bool isValid() const { return !!m_instrumentingAgents; }
-    InstrumentingAgents* instrumentingAgents() const { return m_instrumentingAgents.get(); }
-    bool hasMatchingTimelineAgentId(int id) const { return m_timelineAgentId == id; }
-
-private:
-    RefPtr<InstrumentingAgents> m_instrumentingAgents;
-    int m_timelineAgentId;
-};
-
-} // namespace WebCore

Modified: trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp (250671 => 250672)


--- trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -252,7 +252,7 @@
         didCompleteCurrentRecord(m_recordStack.last().type);
 #endif
 
-    clearRecordStack();
+    m_recordStack.clear();
 
     m_tracking = false;
     m_startedComposite = false;
@@ -337,6 +337,9 @@
 
 void InspectorTimelineAgent::didDispatchEvent(bool defaultPrevented)
 {
+    if (m_recordStack.isEmpty())
+        return;
+
     auto& entry = m_recordStack.last();
     ASSERT(entry.type == TimelineRecordType::EventDispatch);
     entry.data->setBoolean("defaultPrevented"_s, defaultPrevented);
@@ -405,6 +408,9 @@
 
 void InspectorTimelineAgent::didPaint(RenderObject& renderer, const LayoutRect& clipRect)
 {
+    if (m_recordStack.isEmpty())
+        return;
+
     TimelineRecordEntry& entry = m_recordStack.last();
     ASSERT(entry.type == TimelineRecordType::Paint);
     FloatQuad quad;
@@ -795,12 +801,6 @@
     pushCurrentRecord(createRecordEntry(WTFMove(data), type, captureCallStack, frame));
 }
 
-void InspectorTimelineAgent::clearRecordStack()
-{
-    m_recordStack.clear();
-    m_id++;
-}
-
 void InspectorTimelineAgent::localToPageQuad(const RenderObject& renderer, const LayoutRect& rect, FloatQuad* quad)
 {
     const FrameView& frameView = renderer.view().frameView();

Modified: trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.h (250671 => 250672)


--- trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.h	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.h	2019-10-03 19:38:52 UTC (rev 250672)
@@ -148,8 +148,6 @@
     void startFromConsole(JSC::ExecState*, const String& title);
     void stopFromConsole(JSC::ExecState*, const String& title);
 
-    int id() const { return m_id; }
-
 private:
     void startProgrammaticCapture();
     void stopProgrammaticCapture();
@@ -200,7 +198,6 @@
     void didCompleteCurrentRecord(TimelineRecordType);
 
     void addRecordToTimeline(RefPtr<JSON::Object>&&, TimelineRecordType);
-    void clearRecordStack();
 
     void localToPageQuad(const RenderObject&, const LayoutRect&, FloatQuad*);
 
@@ -211,7 +208,6 @@
     Vector<TimelineRecordEntry> m_recordStack;
     Vector<TimelineRecordEntry> m_pendingConsoleProfileRecords;
 
-    int m_id { 1 };
     int m_maxCallStackDepth { 5 };
 
     bool m_tracking { false };

Modified: trunk/Source/WebCore/page/DOMTimer.cpp (250671 => 250672)


--- trunk/Source/WebCore/page/DOMTimer.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/page/DOMTimer.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -314,7 +314,7 @@
     // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator.
     m_userGestureTokenToForward = nullptr;
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutId, !repeatInterval());
+    InspectorInstrumentation::willFireTimer(context, m_timeoutId, !repeatInterval());
 
     // Simple case for non-one-shot timers.
     if (isActive()) {
@@ -325,9 +325,9 @@
 
         m_action->execute(context);
 
-        InspectorInstrumentation::didFireTimer(cookie);
+        InspectorInstrumentation::didFireTimer(context);
+
         updateThrottlingStateIfNecessary(fireState);
-
         return;
     }
 
@@ -343,7 +343,7 @@
 #endif
     m_action->execute(context);
 
-    InspectorInstrumentation::didFireTimer(cookie);
+    InspectorInstrumentation::didFireTimer(context);
 
     // Check if we should throttle nested single-shot timers.
     if (nestedTimers) {

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (250671 => 250672)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -2168,11 +2168,14 @@
     event.setCurrentTarget(this);
     event.setEventPhase(Event::AT_TARGET);
     event.resetBeforeDispatch();
-    auto cookie = InspectorInstrumentation::willDispatchEventOnWindow(frame(), event, *this);
+
+    auto* protectedFrame = frame();
+    InspectorInstrumentation::willDispatchEventOnWindow(protectedFrame, event, *this);
     // FIXME: We should use EventDispatcher everywhere.
     fireEventListeners(event, EventInvokePhase::Capturing);
     fireEventListeners(event, EventInvokePhase::Bubbling);
-    InspectorInstrumentation::didDispatchEventOnWindow(cookie, event.defaultPrevented());
+    InspectorInstrumentation::didDispatchEventOnWindow(protectedFrame, event.defaultPrevented());
+
     event.resetAfterDispatch();
 }
 

Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (250671 => 250672)


--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -155,7 +155,7 @@
     Ref<FrameView> protectView(view());
     LayoutScope layoutScope(*this);
     TraceScope tracingScope(LayoutStart, LayoutEnd);
-    InspectorInstrumentationCookie inspectorLayoutScope(InspectorInstrumentation::willLayout(view().frame()));
+    InspectorInstrumentation::willLayout(view().frame());
     AnimationUpdateBlock animationUpdateBlock(&view().frame().animation());
     WeakPtr<RenderElement> layoutRoot;
     
@@ -232,7 +232,7 @@
         view().didLayout(layoutRoot);
         runOrScheduleAsynchronousTasks();
     }
-    InspectorInstrumentation::didLayout(inspectorLayoutScope, *layoutRoot);
+    InspectorInstrumentation::didLayout(view().frame(), *layoutRoot);
     DebugPageOverlays::didLayout(view().frame());
 }
 

Modified: trunk/Source/WebCore/page/IntersectionObserver.cpp (250671 => 250672)


--- trunk/Source/WebCore/page/IntersectionObserver.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/page/IntersectionObserver.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -262,12 +262,11 @@
     if (!context)
         return;
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireObserverCallback(*context, "IntersectionObserver"_s);
+    auto takenRecords = takeRecords();
 
-    auto takenRecords = takeRecords();
+    InspectorInstrumentation::willFireObserverCallback(*context, "IntersectionObserver"_s);
     m_callback->handleEvent(WTFMove(takenRecords.records), *this);
-
-    InspectorInstrumentation::didFireObserverCallback(cookie);
+    InspectorInstrumentation::didFireObserverCallback(*context);
 }
 
 bool IntersectionObserver::hasPendingActivity() const

Modified: trunk/Source/WebCore/page/PerformanceObserver.cpp (250671 => 250672)


--- trunk/Source/WebCore/page/PerformanceObserver.cpp	2019-10-03 19:34:38 UTC (rev 250671)
+++ trunk/Source/WebCore/page/PerformanceObserver.cpp	2019-10-03 19:38:52 UTC (rev 250672)
@@ -108,9 +108,9 @@
     Vector<RefPtr<PerformanceEntry>> entries = WTFMove(m_entriesToDeliver);
     auto list = PerformanceObserverEntryList::create(WTFMove(entries));
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireObserverCallback(*context, "PerformanceObserver"_s);
+    InspectorInstrumentation::willFireObserverCallback(*context, "PerformanceObserver"_s);
     m_callback->handleEvent(list, *this);
-    InspectorInstrumentation::didFireObserverCallback(cookie);
+    InspectorInstrumentation::didFireObserverCallback(*context);
 }
 
 Vector<String> PerformanceObserver::supportedEntryTypes()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to