Unreviewed, rolling out r250114.
[WebKit-https.git] / Source / WebCore / inspector / InspectorInstrumentation.h
1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 *     * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *     * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 *     * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #pragma once
33
34 #include "CSSSelector.h"
35 #include "CallTracerTypes.h"
36 #include "CanvasBase.h"
37 #include "CanvasRenderingContext.h"
38 #include "Database.h"
39 #include "DocumentThreadableLoader.h"
40 #include "Element.h"
41 #include "EventTarget.h"
42 #include "FormData.h"
43 #include "Frame.h"
44 #include "HitTestResult.h"
45 #include "InspectorController.h"
46 #include "InspectorInstrumentationCookie.h"
47 #include "InspectorInstrumentationPublic.h"
48 #include "OffscreenCanvas.h"
49 #include "Page.h"
50 #include "StorageArea.h"
51 #include "WorkerGlobalScope.h"
52 #include "WorkerInspectorController.h"
53 #include <JavaScriptCore/JSCInlines.h>
54 #include <initializer_list>
55 #include <wtf/CompletionHandler.h>
56 #include <wtf/MemoryPressureHandler.h>
57 #include <wtf/RefPtr.h>
58
59 #if ENABLE(WEBGL)
60 #include "WebGLRenderingContextBase.h"
61 #endif
62
63 #if ENABLE(WEBGPU)
64 #include "GPUCanvasContext.h"
65 #include "WebGPUDevice.h"
66 #endif
67
68 namespace Inspector {
69 class ConsoleMessage;
70 class ScriptArguments;
71 class ScriptCallStack;
72 }
73
74 namespace WebCore {
75
76 class CachedResource;
77 class CharacterData;
78 class DOMWindow;
79 class DOMWrapperWorld;
80 class Document;
81 class DocumentLoader;
82 class EventListener;
83 class HTTPHeaderMap;
84 class InspectorTimelineAgent;
85 class InstrumentingAgents;
86 class NetworkLoadMetrics;
87 class Node;
88 class PseudoElement;
89 class RegisteredEventListener;
90 class RenderLayer;
91 class RenderObject;
92 class ResourceLoader;
93 class ResourceRequest;
94 class ResourceResponse;
95 class ScriptExecutionContext;
96 class SecurityOrigin;
97 class ShadowRoot;
98 class SharedBuffer;
99 class TimerBase;
100 class WebKitNamedFlow;
101 class WorkerInspectorProxy;
102
103 #if ENABLE(WEBGL)
104 class WebGLProgram;
105 #endif
106
107 #if ENABLE(WEBGPU)
108 class WebGPUSwapChain;
109 #endif
110
111 enum class StorageType;
112
113 struct WebSocketFrame;
114
115 class InspectorInstrumentation {
116 public:
117     static void didClearWindowObjectInWorld(Frame&, DOMWrapperWorld&);
118     static bool isDebuggerPaused(Frame*);
119
120     static int identifierForNode(Node&);
121     static void addEventListenersToNode(Node&);
122     static void willInsertDOMNode(Document&, Node& parent);
123     static void didInsertDOMNode(Document&, Node&);
124     static void willRemoveDOMNode(Document&, Node&);
125     static void didRemoveDOMNode(Document&, Node&);
126     static void willModifyDOMAttr(Document&, Element&, const AtomString& oldValue, const AtomString& newValue);
127     static void didModifyDOMAttr(Document&, Element&, const AtomString& name, const AtomString& value);
128     static void didRemoveDOMAttr(Document&, Element&, const AtomString& name);
129     static void characterDataModified(Document&, CharacterData&);
130     static void willInvalidateStyleAttr(Element&);
131     static void didInvalidateStyleAttr(Element&);
132     static void documentDetached(Document&);
133     static void frameWindowDiscarded(Frame&, DOMWindow*);
134     static void mediaQueryResultChanged(Document&);
135     static void activeStyleSheetsUpdated(Document&);
136     static void didPushShadowRoot(Element& host, ShadowRoot&);
137     static void willPopShadowRoot(Element& host, ShadowRoot&);
138     static void didChangeCustomElementState(Element&);
139     static void pseudoElementCreated(Page*, PseudoElement&);
140     static void pseudoElementDestroyed(Page*, PseudoElement&);
141     static void didCreateNamedFlow(Document*, WebKitNamedFlow&);
142     static void willRemoveNamedFlow(Document*, WebKitNamedFlow&);
143     static void didChangeRegionOverset(Document&, WebKitNamedFlow&);
144     static void didRegisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr);
145     static void didUnregisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement);
146
147     static void mouseDidMoveOverElement(Page&, const HitTestResult&, unsigned modifierFlags);
148     static bool handleMousePress(Frame&);
149     static bool handleTouchEvent(Frame&, Node&);
150     static bool forcePseudoState(const Element&, CSSSelector::PseudoClassType);
151
152     static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
153     static void willFetch(ScriptExecutionContext&, const String& url);
154     static void didInstallTimer(ScriptExecutionContext&, int timerId, Seconds timeout, bool singleShot);
155     static void didRemoveTimer(ScriptExecutionContext&, int timerId);
156
157     static void didPostMessage(Frame&, TimerBase&, JSC::ExecState&);
158     static void didFailPostMessage(Frame&, TimerBase&);
159     static void willDispatchPostMessage(Frame&, TimerBase&);
160     static void didDispatchPostMessage(Frame&, TimerBase&);
161
162     static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine, int scriptColumn);
163     static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
164     static void didAddEventListener(EventTarget&, const AtomString& eventType, EventListener&, bool capture);
165     static void willRemoveEventListener(EventTarget&, const AtomString& eventType, EventListener&, bool capture);
166     static bool isEventListenerDisabled(EventTarget&, const AtomString& eventType, EventListener&, bool capture);
167     static InspectorInstrumentationCookie willDispatchEvent(Document&, const Event&, bool hasEventListeners);
168     static void didDispatchEvent(const InspectorInstrumentationCookie&, bool defaultPrevented);
169     static void willHandleEvent(ScriptExecutionContext&, Event&, const RegisteredEventListener&);
170     static void didHandleEvent(ScriptExecutionContext&);
171     static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event&, DOMWindow&);
172     static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&, bool defaultPrevented);
173     static void eventDidResetAfterDispatch(const Event&);
174     static InspectorInstrumentationCookie willEvaluateScript(Frame&, const String& url, int lineNumber, int columnNumber);
175     static void didEvaluateScript(const InspectorInstrumentationCookie&, Frame&);
176     static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext&, int timerId, bool oneShot);
177     static void didFireTimer(const InspectorInstrumentationCookie&);
178     static void didInvalidateLayout(Frame&);
179     static InspectorInstrumentationCookie willLayout(Frame&);
180     static void didLayout(const InspectorInstrumentationCookie&, RenderObject&);
181     static void didScroll(Page&);
182     static void willComposite(Frame&);
183     static void didComposite(Frame&);
184     static void willPaint(RenderObject&);
185     static void didPaint(RenderObject&, const LayoutRect&);
186     static InspectorInstrumentationCookie willRecalculateStyle(Document&);
187     static void didRecalculateStyle(const InspectorInstrumentationCookie&);
188     static void didScheduleStyleRecalculation(Document&);
189     static void applyUserAgentOverride(Frame&, String&);
190     static void applyEmulatedMedia(Frame&, String&);
191
192     static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
193     static void didLoadResourceFromMemoryCache(Page&, DocumentLoader*, CachedResource*);
194     static void didReceiveResourceResponse(Frame&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
195     static void didReceiveThreadableLoaderResponse(DocumentThreadableLoader&, unsigned long identifier);
196     static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
197     static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, const NetworkLoadMetrics&, ResourceLoader*);
198     static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
199
200     static void willSendRequest(WorkerGlobalScope&, unsigned long identifier, ResourceRequest&);
201     static void didReceiveResourceResponse(WorkerGlobalScope&, unsigned long identifier, const ResourceResponse&);
202     static void didReceiveData(WorkerGlobalScope&, unsigned long identifier, const char* data, int dataLength);
203     static void didFinishLoading(WorkerGlobalScope&, unsigned long identifier, const NetworkLoadMetrics&);
204     static void didFailLoading(WorkerGlobalScope&, unsigned long identifier, const ResourceError&);
205
206     // Some network requests do not go through the normal network loading path.
207     // These network requests have to issue their own willSendRequest / didReceiveResponse / didFinishLoading / didFailLoading
208     // instrumentation calls. Some of these loads are for resources that lack a CachedResource::Type.
209     enum class LoadType { Ping, Beacon };
210     static void willSendRequestOfType(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, LoadType);
211
212     static void continueAfterXFrameOptionsDenied(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&);
213     static void continueWithPolicyDownload(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&);
214     static void continueWithPolicyIgnore(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&);
215     static void willLoadXHRSynchronously(ScriptExecutionContext*);
216     static void didLoadXHRSynchronously(ScriptExecutionContext*);
217     static void scriptImported(ScriptExecutionContext&, unsigned long identifier, const String& sourceString);
218     static void scriptExecutionBlockedByCSP(ScriptExecutionContext*, const String& directiveText);
219     static void didReceiveScriptResponse(ScriptExecutionContext*, unsigned long identifier);
220     static void domContentLoadedEventFired(Frame&);
221     static void loadEventFired(Frame*);
222     static void frameDetachedFromParent(Frame&);
223     static void didCommitLoad(Frame&, DocumentLoader*);
224     static void frameDocumentUpdated(Frame&);
225     static void loaderDetachedFromFrame(Frame&, DocumentLoader&);
226     static void frameStartedLoading(Frame&);
227     static void frameStoppedLoading(Frame&);
228     static void frameScheduledNavigation(Frame&, Seconds delay);
229     static void frameClearedScheduledNavigation(Frame&);
230     static void defaultAppearanceDidChange(Page&, bool useDarkAppearance);
231     static void willDestroyCachedResource(CachedResource&);
232
233     static bool willInterceptRequest(const Frame*, const ResourceRequest&);
234     static bool shouldInterceptResponse(const Frame&, const ResourceResponse&);
235     static void interceptResponse(const Frame&, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&);
236
237     static void addMessageToConsole(Page&, std::unique_ptr<Inspector::ConsoleMessage>);
238     static void addMessageToConsole(WorkerGlobalScope&, std::unique_ptr<Inspector::ConsoleMessage>);
239
240     static void consoleCount(Page&, JSC::ExecState*, const String& label);
241     static void consoleCount(WorkerGlobalScope&, JSC::ExecState*, const String& label);
242     static void consoleCountReset(Page&, JSC::ExecState*, const String& label);
243     static void consoleCountReset(WorkerGlobalScope&, JSC::ExecState*, const String& label);
244
245     static void takeHeapSnapshot(Frame&, const String& title);
246     static void startConsoleTiming(Frame&, JSC::ExecState*, const String& label);
247     static void startConsoleTiming(WorkerGlobalScope&, JSC::ExecState*, const String& label);
248     static void logConsoleTiming(Frame&, JSC::ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&);
249     static void logConsoleTiming(WorkerGlobalScope&, JSC::ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&);
250     static void stopConsoleTiming(Frame&, JSC::ExecState*, const String& label);
251     static void stopConsoleTiming(WorkerGlobalScope&, JSC::ExecState*, const String& label);
252     static void consoleTimeStamp(Frame&, Ref<Inspector::ScriptArguments>&&);
253     static void startProfiling(Page&, JSC::ExecState*, const String& title);
254     static void stopProfiling(Page&, JSC::ExecState*, const String& title);
255     static void consoleStartRecordingCanvas(CanvasRenderingContext&, JSC::ExecState&, JSC::JSObject* options);
256
257     static void didRequestAnimationFrame(Document&, int callbackId);
258     static void didCancelAnimationFrame(Document&, int callbackId);
259     static InspectorInstrumentationCookie willFireAnimationFrame(Document&, int callbackId);
260     static void didFireAnimationFrame(const InspectorInstrumentationCookie&);
261
262     static InspectorInstrumentationCookie willFireObserverCallback(ScriptExecutionContext&, const String& callbackType);
263     static void didFireObserverCallback(const InspectorInstrumentationCookie&);
264
265     static void didOpenDatabase(Database&);
266
267     static void didDispatchDOMStorageEvent(Page&, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*);
268
269     static bool shouldWaitForDebuggerOnStart(ScriptExecutionContext&);
270     static void workerStarted(ScriptExecutionContext&, WorkerInspectorProxy*, const URL&);
271     static void workerTerminated(ScriptExecutionContext&, WorkerInspectorProxy*);
272
273     static void didCreateWebSocket(Document*, unsigned long identifier, const URL& requestURL);
274     static void willSendWebSocketHandshakeRequest(Document*, unsigned long identifier, const ResourceRequest&);
275     static void didReceiveWebSocketHandshakeResponse(Document*, unsigned long identifier, const ResourceResponse&);
276     static void didCloseWebSocket(Document*, unsigned long identifier);
277     static void didReceiveWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&);
278     static void didSendWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&);
279     static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
280
281 #if ENABLE(RESOURCE_USAGE)
282     static void didHandleMemoryPressure(Page&, Critical);
283 #endif
284
285     static void didChangeCSSCanvasClientNodes(CanvasBase&);
286     static void didCreateCanvasRenderingContext(CanvasRenderingContext&);
287     static void didChangeCanvasMemory(CanvasRenderingContext&);
288     static void recordCanvasAction(CanvasRenderingContext&, const String&, std::initializer_list<RecordCanvasActionVariant>&& = { });
289     static void didFinishRecordingCanvasFrame(CanvasRenderingContext&, bool forceDispatch = false);
290 #if ENABLE(WEBGL)
291     static void didEnableExtension(WebGLRenderingContextBase&, const String&);
292     static void didCreateProgram(WebGLRenderingContextBase&, WebGLProgram&);
293     static void willDeleteProgram(WebGLRenderingContextBase&, WebGLProgram&);
294     static bool isShaderProgramDisabled(WebGLRenderingContextBase&, WebGLProgram&);
295     static bool isShaderProgramHighlighted(WebGLRenderingContextBase&, WebGLProgram&);
296 #endif
297 #if ENABLE(WEBGPU)
298     static void didCreateWebGPUDevice(WebGPUDevice&);
299     static void willDestroyWebGPUDevice(WebGPUDevice&);
300     static void willConfigureSwapChain(GPUCanvasContext&, WebGPUSwapChain&);
301 #endif
302
303     static void networkStateChanged(Page&);
304     static void updateApplicationCacheStatus(Frame*);
305
306     static void layerTreeDidChange(Page*);
307     static void renderLayerDestroyed(Page*, const RenderLayer&);
308
309     static void frontendCreated();
310     static void frontendDeleted();
311     static bool hasFrontends() { return InspectorInstrumentationPublic::hasFrontends(); }
312
313     static void firstFrontendCreated();
314     static void lastFrontendDeleted();
315
316     static bool consoleAgentEnabled(ScriptExecutionContext*);
317     static bool timelineAgentTracking(ScriptExecutionContext*);
318
319     static InstrumentingAgents* instrumentingAgentsForPage(Page*);
320
321     static void registerInstrumentingAgents(InstrumentingAgents&);
322     static void unregisterInstrumentingAgents(InstrumentingAgents&);
323
324 private:
325     static void didClearWindowObjectInWorldImpl(InstrumentingAgents&, Frame&, DOMWrapperWorld&);
326     static bool isDebuggerPausedImpl(InstrumentingAgents&);
327
328     static int identifierForNodeImpl(InstrumentingAgents&, Node&);
329     static void addEventListenersToNodeImpl(InstrumentingAgents&, Node&);
330     static void willInsertDOMNodeImpl(InstrumentingAgents&, Node& parent);
331     static void didInsertDOMNodeImpl(InstrumentingAgents&, Node&);
332     static void willRemoveDOMNodeImpl(InstrumentingAgents&, Node&);
333     static void didRemoveDOMNodeImpl(InstrumentingAgents&, Node&);
334     static void willModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomString& oldValue, const AtomString& newValue);
335     static void didModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomString& name, const AtomString& value);
336     static void didRemoveDOMAttrImpl(InstrumentingAgents&, Element&, const AtomString& name);
337     static void characterDataModifiedImpl(InstrumentingAgents&, CharacterData&);
338     static void willInvalidateStyleAttrImpl(InstrumentingAgents&, Element&);
339     static void didInvalidateStyleAttrImpl(InstrumentingAgents&, Element&);
340     static void documentDetachedImpl(InstrumentingAgents&, Document&);
341     static void frameWindowDiscardedImpl(InstrumentingAgents&, DOMWindow*);
342     static void mediaQueryResultChangedImpl(InstrumentingAgents&);
343     static void activeStyleSheetsUpdatedImpl(InstrumentingAgents&, Document&);
344     static void didPushShadowRootImpl(InstrumentingAgents&, Element& host, ShadowRoot&);
345     static void willPopShadowRootImpl(InstrumentingAgents&, Element& host, ShadowRoot&);
346     static void didChangeCustomElementStateImpl(InstrumentingAgents&, Element&);
347     static void pseudoElementCreatedImpl(InstrumentingAgents&, PseudoElement&);
348     static void pseudoElementDestroyedImpl(InstrumentingAgents&, PseudoElement&);
349     static void didCreateNamedFlowImpl(InstrumentingAgents&, Document*, WebKitNamedFlow&);
350     static void willRemoveNamedFlowImpl(InstrumentingAgents&, Document*, WebKitNamedFlow&);
351     static void didChangeRegionOversetImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&);
352     static void didRegisterNamedFlowContentElementImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr);
353     static void didUnregisterNamedFlowContentElementImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&, Node& contentElement);
354
355     static void mouseDidMoveOverElementImpl(InstrumentingAgents&, const HitTestResult&, unsigned modifierFlags);
356     static bool handleMousePressImpl(InstrumentingAgents&);
357     static bool handleTouchEventImpl(InstrumentingAgents&, Node&);
358     static bool forcePseudoStateImpl(InstrumentingAgents&, const Element&, CSSSelector::PseudoClassType);
359
360     static void willSendXMLHttpRequestImpl(InstrumentingAgents&, const String& url);
361     static void willFetchImpl(InstrumentingAgents&, const String& url);
362     static void didInstallTimerImpl(InstrumentingAgents&, int timerId, Seconds timeout, bool singleShot, ScriptExecutionContext&);
363     static void didRemoveTimerImpl(InstrumentingAgents&, int timerId, ScriptExecutionContext&);
364
365     static void didPostMessageImpl(InstrumentingAgents&, const TimerBase&, JSC::ExecState&);
366     static void didFailPostMessageImpl(InstrumentingAgents&, const TimerBase&);
367     static void willDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&);
368     static void didDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&);
369
370     static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext*);
371     static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
372     static void didAddEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomString& eventType, EventListener&, bool capture);
373     static void willRemoveEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomString& eventType, EventListener&, bool capture);
374     static bool isEventListenerDisabledImpl(InstrumentingAgents&, EventTarget&, const AtomString& eventType, EventListener&, bool capture);
375     static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents&, Document&, const Event&, bool hasEventListeners);
376     static void willHandleEventImpl(InstrumentingAgents&, Event&, const RegisteredEventListener&);
377     static void didHandleEventImpl(InstrumentingAgents&);
378     static void didDispatchEventImpl(const InspectorInstrumentationCookie&, bool defaultPrevented);
379     static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents&, const Event&, DOMWindow&);
380     static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&, bool defaultPrevented);
381     static void eventDidResetAfterDispatchImpl(InstrumentingAgents&, const Event&);
382     static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber, int columnNumber);
383     static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&, Frame&);
384     static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents&, int timerId, bool oneShot, ScriptExecutionContext&);
385     static void didFireTimerImpl(const InspectorInstrumentationCookie&);
386     static void didInvalidateLayoutImpl(InstrumentingAgents&, Frame&);
387     static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents&, Frame&);
388     static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject&);
389     static void didScrollImpl(InstrumentingAgents&);
390     static void willCompositeImpl(InstrumentingAgents&, Frame&);
391     static void didCompositeImpl(InstrumentingAgents&);
392     static void willPaintImpl(InstrumentingAgents&, RenderObject&);
393     static void didPaintImpl(InstrumentingAgents&, RenderObject&, const LayoutRect&);
394     static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents&, Document&);
395     static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
396     static void didScheduleStyleRecalculationImpl(InstrumentingAgents&, Document&);
397     static void applyUserAgentOverrideImpl(InstrumentingAgents&, String&);
398     static void applyEmulatedMediaImpl(InstrumentingAgents&, String&);
399
400     static void willSendRequestImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
401     static void willSendRequestOfTypeImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, ResourceRequest&, LoadType);
402     static void markResourceAsCachedImpl(InstrumentingAgents&, unsigned long identifier);
403     static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents&, DocumentLoader*, CachedResource*);
404     static void didReceiveResourceResponseImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
405     static void didReceiveThreadableLoaderResponseImpl(InstrumentingAgents&, DocumentThreadableLoader&, unsigned long identifier);
406     static void didReceiveDataImpl(InstrumentingAgents&, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
407     static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const NetworkLoadMetrics&, ResourceLoader*);
408     static void didFailLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceError&);
409     static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&);
410     static void didLoadXHRSynchronouslyImpl(InstrumentingAgents&);
411     static void scriptImportedImpl(InstrumentingAgents&, unsigned long identifier, const String& sourceString);
412     static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents&, const String& directiveText);
413     static void didReceiveScriptResponseImpl(InstrumentingAgents&, unsigned long identifier);
414     static void domContentLoadedEventFiredImpl(InstrumentingAgents&, Frame&);
415     static void loadEventFiredImpl(InstrumentingAgents&, Frame*);
416     static void frameDetachedFromParentImpl(InstrumentingAgents&, Frame&);
417     static void didCommitLoadImpl(InstrumentingAgents&, Frame&, DocumentLoader*);
418     static void frameDocumentUpdatedImpl(InstrumentingAgents&, Frame&);
419     static void loaderDetachedFromFrameImpl(InstrumentingAgents&, DocumentLoader&);
420     static void frameStartedLoadingImpl(InstrumentingAgents&, Frame&);
421     static void frameStoppedLoadingImpl(InstrumentingAgents&, Frame&);
422     static void frameScheduledNavigationImpl(InstrumentingAgents&, Frame&, Seconds delay);
423     static void frameClearedScheduledNavigationImpl(InstrumentingAgents&, Frame&);
424     static void defaultAppearanceDidChangeImpl(InstrumentingAgents&, bool useDarkAppearance);
425     static void willDestroyCachedResourceImpl(CachedResource&);
426
427     static bool willInterceptRequestImpl(InstrumentingAgents&, const ResourceRequest&);
428     static bool shouldInterceptResponseImpl(InstrumentingAgents&, const ResourceResponse&);
429     static void interceptResponseImpl(InstrumentingAgents&, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&);
430
431     static void addMessageToConsoleImpl(InstrumentingAgents&, std::unique_ptr<Inspector::ConsoleMessage>);
432
433     static void consoleCountImpl(InstrumentingAgents&, JSC::ExecState*, const String& label);
434     static void consoleCountResetImpl(InstrumentingAgents&, JSC::ExecState*, const String& label);
435     static void takeHeapSnapshotImpl(InstrumentingAgents&, const String& title);
436     static void startConsoleTimingImpl(InstrumentingAgents&, Frame&, JSC::ExecState*, const String& label);
437     static void startConsoleTimingImpl(InstrumentingAgents&, JSC::ExecState*, const String& label);
438     static void logConsoleTimingImpl(InstrumentingAgents&, JSC::ExecState*, const String& label, Ref<Inspector::ScriptArguments>&&);
439     static void stopConsoleTimingImpl(InstrumentingAgents&, Frame&, JSC::ExecState*, const String& label);
440     static void stopConsoleTimingImpl(InstrumentingAgents&, JSC::ExecState*, const String& label);
441     static void consoleTimeStampImpl(InstrumentingAgents&, Frame&, Ref<Inspector::ScriptArguments>&&);
442     static void startProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title);
443     static void stopProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title);
444     static void consoleStartRecordingCanvasImpl(InstrumentingAgents&, CanvasRenderingContext&, JSC::ExecState&, JSC::JSObject* options);
445
446     static void didRequestAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&);
447     static void didCancelAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&);
448     static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&);
449     static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&);
450
451     static InspectorInstrumentationCookie willFireObserverCallbackImpl(InstrumentingAgents&, const String&, ScriptExecutionContext&);
452     static void didFireObserverCallbackImpl(const InspectorInstrumentationCookie&);
453
454     static void didOpenDatabaseImpl(InstrumentingAgents&, Database&);
455
456     static void didDispatchDOMStorageEventImpl(InstrumentingAgents&, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*);
457
458     static bool shouldWaitForDebuggerOnStartImpl(InstrumentingAgents&);
459     static void workerStartedImpl(InstrumentingAgents&, WorkerInspectorProxy*, const URL&);
460     static void workerTerminatedImpl(InstrumentingAgents&, WorkerInspectorProxy*);
461
462     static void didCreateWebSocketImpl(InstrumentingAgents&, unsigned long identifier, const URL& requestURL);
463     static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents&, unsigned long identifier, const ResourceRequest&);
464     static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents&, unsigned long identifier, const ResourceResponse&);
465     static void didCloseWebSocketImpl(InstrumentingAgents&, unsigned long identifier);
466     static void didReceiveWebSocketFrameImpl(InstrumentingAgents&, unsigned long identifier, const WebSocketFrame&);
467     static void didSendWebSocketFrameImpl(InstrumentingAgents&, unsigned long identifier, const WebSocketFrame&);
468     static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents&, unsigned long identifier, const String&);
469
470 #if ENABLE(RESOURCE_USAGE)
471     static void didHandleMemoryPressureImpl(InstrumentingAgents&, Critical);
472 #endif
473
474     static void networkStateChangedImpl(InstrumentingAgents&);
475     static void updateApplicationCacheStatusImpl(InstrumentingAgents&, Frame&);
476
477     static void didChangeCSSCanvasClientNodesImpl(InstrumentingAgents&, CanvasBase&);
478     static void didCreateCanvasRenderingContextImpl(InstrumentingAgents&, CanvasRenderingContext&);
479     static void didChangeCanvasMemoryImpl(InstrumentingAgents&, CanvasRenderingContext&);
480     static void recordCanvasActionImpl(InstrumentingAgents&, CanvasRenderingContext&, const String&, std::initializer_list<RecordCanvasActionVariant>&& = { });
481     static void didFinishRecordingCanvasFrameImpl(InstrumentingAgents&, CanvasRenderingContext&, bool forceDispatch = false);
482 #if ENABLE(WEBGL)
483     static void didEnableExtensionImpl(InstrumentingAgents&, WebGLRenderingContextBase&, const String&);
484     static void didCreateProgramImpl(InstrumentingAgents&, WebGLRenderingContextBase&, WebGLProgram&);
485     static void willDeleteProgramImpl(InstrumentingAgents&, WebGLProgram&);
486     static bool isShaderProgramDisabledImpl(InstrumentingAgents&, WebGLProgram&);
487     static bool isShaderProgramHighlightedImpl(InstrumentingAgents&, WebGLProgram&);
488 #endif
489 #if ENABLE(WEBGPU)
490     static void didCreateWebGPUDeviceImpl(InstrumentingAgents&, WebGPUDevice&);
491     static void willDestroyWebGPUDeviceImpl(InstrumentingAgents&, WebGPUDevice&);
492     static void willConfigureSwapChainImpl(InstrumentingAgents&, GPUCanvasContext&, WebGPUSwapChain&);
493 #endif
494
495     static void layerTreeDidChangeImpl(InstrumentingAgents&);
496     static void renderLayerDestroyedImpl(InstrumentingAgents&, const RenderLayer&);
497
498     static InstrumentingAgents& instrumentingAgentsForPage(Page&);
499     static InstrumentingAgents& instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope&);
500
501     static InstrumentingAgents* instrumentingAgentsForFrame(const Frame&);
502     static InstrumentingAgents* instrumentingAgentsForFrame(const Frame*);
503     static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*);
504     static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext&);
505     static InstrumentingAgents* instrumentingAgentsForDocument(Document&);
506     static InstrumentingAgents* instrumentingAgentsForDocument(Document*);
507     static InstrumentingAgents* instrumentingAgentsForRenderer(RenderObject&);
508     static InstrumentingAgents* instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope*);
509
510     static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
511 };
512
513 inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame& frame, DOMWrapperWorld& world)
514 {
515     FAST_RETURN_IF_NO_FRONTENDS(void());
516     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
517         didClearWindowObjectInWorldImpl(*instrumentingAgents, frame, world);
518 }
519
520 inline bool InspectorInstrumentation::isDebuggerPaused(Frame* frame)
521 {
522     FAST_RETURN_IF_NO_FRONTENDS(false);
523     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
524         return isDebuggerPausedImpl(*instrumentingAgents);
525     return false;
526 }
527
528 inline int InspectorInstrumentation::identifierForNode(Node& node)
529 {
530     FAST_RETURN_IF_NO_FRONTENDS(0);
531     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(node.document()))
532         return identifierForNodeImpl(*instrumentingAgents, node);
533     return 0;
534 }
535
536 inline void InspectorInstrumentation::addEventListenersToNode(Node& node)
537 {
538     FAST_RETURN_IF_NO_FRONTENDS(void());
539     if (auto* instrumentingAgents = instrumentingAgentsForDocument(node.document()))
540         addEventListenersToNodeImpl(*instrumentingAgents, node);
541 }
542
543 inline void InspectorInstrumentation::willInsertDOMNode(Document& document, Node& parent)
544 {
545     FAST_RETURN_IF_NO_FRONTENDS(void());
546     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
547         willInsertDOMNodeImpl(*instrumentingAgents, parent);
548 }
549
550 inline void InspectorInstrumentation::didInsertDOMNode(Document& document, Node& node)
551 {
552     FAST_RETURN_IF_NO_FRONTENDS(void());
553     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
554         didInsertDOMNodeImpl(*instrumentingAgents, node);
555 }
556
557 inline void InspectorInstrumentation::willRemoveDOMNode(Document& document, Node& node)
558 {
559     FAST_RETURN_IF_NO_FRONTENDS(void());
560     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
561         willRemoveDOMNodeImpl(*instrumentingAgents, node);
562 }
563
564 inline void InspectorInstrumentation::didRemoveDOMNode(Document& document, Node& node)
565 {
566     FAST_RETURN_IF_NO_FRONTENDS(void());
567     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
568         didRemoveDOMNodeImpl(*instrumentingAgents, node);
569 }
570
571 inline void InspectorInstrumentation::willModifyDOMAttr(Document& document, Element& element, const AtomString& oldValue, const AtomString& newValue)
572 {
573     FAST_RETURN_IF_NO_FRONTENDS(void());
574     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
575         willModifyDOMAttrImpl(*instrumentingAgents, element, oldValue, newValue);
576 }
577
578 inline void InspectorInstrumentation::didModifyDOMAttr(Document& document, Element& element, const AtomString& name, const AtomString& value)
579 {
580     FAST_RETURN_IF_NO_FRONTENDS(void());
581     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
582         didModifyDOMAttrImpl(*instrumentingAgents, element, name, value);
583 }
584
585 inline void InspectorInstrumentation::didRemoveDOMAttr(Document& document, Element& element, const AtomString& name)
586 {
587     FAST_RETURN_IF_NO_FRONTENDS(void());
588     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
589         didRemoveDOMAttrImpl(*instrumentingAgents, element, name);
590 }
591
592 inline void InspectorInstrumentation::willInvalidateStyleAttr(Element& element)
593 {
594     FAST_RETURN_IF_NO_FRONTENDS(void());
595     if (auto* instrumentingAgents = instrumentingAgentsForDocument(element.document()))
596         willInvalidateStyleAttrImpl(*instrumentingAgents, element);
597 }
598
599 inline void InspectorInstrumentation::didInvalidateStyleAttr(Element& element)
600 {
601     FAST_RETURN_IF_NO_FRONTENDS(void());
602     if (auto* instrumentingAgents = instrumentingAgentsForDocument(element.document()))
603         didInvalidateStyleAttrImpl(*instrumentingAgents, element);
604 }
605
606 inline void InspectorInstrumentation::documentDetached(Document& document)
607 {
608     FAST_RETURN_IF_NO_FRONTENDS(void());
609     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
610         documentDetachedImpl(*instrumentingAgents, document);
611 }
612
613 inline void InspectorInstrumentation::frameWindowDiscarded(Frame& frame, DOMWindow* domWindow)
614 {
615     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
616         frameWindowDiscardedImpl(*instrumentingAgents, domWindow);
617 }
618
619 inline void InspectorInstrumentation::mediaQueryResultChanged(Document& document)
620 {
621     FAST_RETURN_IF_NO_FRONTENDS(void());
622     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
623         mediaQueryResultChangedImpl(*instrumentingAgents);
624 }
625
626 inline void InspectorInstrumentation::activeStyleSheetsUpdated(Document& document)
627 {
628     FAST_RETURN_IF_NO_FRONTENDS(void());
629     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
630         activeStyleSheetsUpdatedImpl(*instrumentingAgents, document);
631 }
632
633 inline void InspectorInstrumentation::didPushShadowRoot(Element& host, ShadowRoot& root)
634 {
635     FAST_RETURN_IF_NO_FRONTENDS(void());
636     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host.document()))
637         didPushShadowRootImpl(*instrumentingAgents, host, root);
638 }
639
640 inline void InspectorInstrumentation::willPopShadowRoot(Element& host, ShadowRoot& root)
641 {
642     FAST_RETURN_IF_NO_FRONTENDS(void());
643     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host.document()))
644         willPopShadowRootImpl(*instrumentingAgents, host, root);
645 }
646
647 inline void InspectorInstrumentation::didChangeCustomElementState(Element& element)
648 {
649     FAST_RETURN_IF_NO_FRONTENDS(void());
650     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(element.document()))
651         didChangeCustomElementStateImpl(*instrumentingAgents, element);
652 }
653
654 inline void InspectorInstrumentation::pseudoElementCreated(Page* page, PseudoElement& pseudoElement)
655 {
656     FAST_RETURN_IF_NO_FRONTENDS(void());
657     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
658         pseudoElementCreatedImpl(*instrumentingAgents, pseudoElement);
659 }
660
661 inline void InspectorInstrumentation::pseudoElementDestroyed(Page* page, PseudoElement& pseudoElement)
662 {
663     FAST_RETURN_IF_NO_FRONTENDS(void());
664     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
665         pseudoElementDestroyedImpl(*instrumentingAgents, pseudoElement);
666 }
667
668 inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow& namedFlow)
669 {
670     FAST_RETURN_IF_NO_FRONTENDS(void());
671     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
672         didCreateNamedFlowImpl(*instrumentingAgents, document, namedFlow);
673 }
674
675 inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow& namedFlow)
676 {
677     FAST_RETURN_IF_NO_FRONTENDS(void());
678     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
679         willRemoveNamedFlowImpl(*instrumentingAgents, document, namedFlow);
680 }
681
682 inline void InspectorInstrumentation::didChangeRegionOverset(Document& document, WebKitNamedFlow& namedFlow)
683 {
684     FAST_RETURN_IF_NO_FRONTENDS(void());
685     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
686         didChangeRegionOversetImpl(*instrumentingAgents, document, namedFlow);
687 }
688
689 inline void InspectorInstrumentation::didRegisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement, Node* nextContentElement)
690 {
691     FAST_RETURN_IF_NO_FRONTENDS(void());
692     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
693         didRegisterNamedFlowContentElementImpl(*instrumentingAgents, document, namedFlow, contentElement, nextContentElement);
694 }
695
696 inline void InspectorInstrumentation::didUnregisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement)
697 {
698     FAST_RETURN_IF_NO_FRONTENDS(void());
699     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
700         didUnregisterNamedFlowContentElementImpl(*instrumentingAgents, document, namedFlow, contentElement);
701 }
702
703 inline void InspectorInstrumentation::mouseDidMoveOverElement(Page& page, const HitTestResult& result, unsigned modifierFlags)
704 {
705     FAST_RETURN_IF_NO_FRONTENDS(void());
706     mouseDidMoveOverElementImpl(instrumentingAgentsForPage(page), result, modifierFlags);
707 }
708
709 inline bool InspectorInstrumentation::handleTouchEvent(Frame& frame, Node& node)
710 {
711     FAST_RETURN_IF_NO_FRONTENDS(false);
712     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
713         return handleTouchEventImpl(*instrumentingAgents, node);
714     return false;
715 }
716
717 inline bool InspectorInstrumentation::handleMousePress(Frame& frame)
718 {
719     FAST_RETURN_IF_NO_FRONTENDS(false);
720     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
721         return handleMousePressImpl(*instrumentingAgents);
722     return false;
723 }
724
725 inline bool InspectorInstrumentation::forcePseudoState(const Element& element, CSSSelector::PseudoClassType pseudoState)
726 {
727     FAST_RETURN_IF_NO_FRONTENDS(false);
728     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(element.document()))
729         return forcePseudoStateImpl(*instrumentingAgents, element, pseudoState);
730     return false;
731 }
732
733 inline void InspectorInstrumentation::characterDataModified(Document& document, CharacterData& characterData)
734 {
735     FAST_RETURN_IF_NO_FRONTENDS(void());
736     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
737         characterDataModifiedImpl(*instrumentingAgents, characterData);
738 }
739
740 inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url)
741 {
742     FAST_RETURN_IF_NO_FRONTENDS(void());
743     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
744         willSendXMLHttpRequestImpl(*instrumentingAgents, url);
745 }
746
747 inline void InspectorInstrumentation::willFetch(ScriptExecutionContext& context, const String& url)
748 {
749     FAST_RETURN_IF_NO_FRONTENDS(void());
750     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
751         willFetchImpl(*instrumentingAgents, url);
752 }
753
754 inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext& context, int timerId, Seconds timeout, bool singleShot)
755 {
756     FAST_RETURN_IF_NO_FRONTENDS(void());
757     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
758         didInstallTimerImpl(*instrumentingAgents, timerId, timeout, singleShot, context);
759 }
760
761 inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext& context, int timerId)
762 {
763     FAST_RETURN_IF_NO_FRONTENDS(void());
764     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
765         didRemoveTimerImpl(*instrumentingAgents, timerId, context);
766 }
767
768 inline void InspectorInstrumentation::didAddEventListener(EventTarget& target, const AtomString& eventType, EventListener& listener, bool capture)
769 {
770     FAST_RETURN_IF_NO_FRONTENDS(void());
771     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(target.scriptExecutionContext()))
772         didAddEventListenerImpl(*instrumentingAgents, target, eventType, listener, capture);
773 }
774
775 inline void InspectorInstrumentation::willRemoveEventListener(EventTarget& target, const AtomString& eventType, EventListener& listener, bool capture)
776 {
777     FAST_RETURN_IF_NO_FRONTENDS(void());
778     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(target.scriptExecutionContext()))
779         willRemoveEventListenerImpl(*instrumentingAgents, target, eventType, listener, capture);
780 }
781
782 inline bool InspectorInstrumentation::isEventListenerDisabled(EventTarget& target, const AtomString& eventType, EventListener& listener, bool capture)
783 {
784     FAST_RETURN_IF_NO_FRONTENDS(false);
785     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(target.scriptExecutionContext()))
786         return isEventListenerDisabledImpl(*instrumentingAgents, target, eventType, listener, capture);
787     return false;
788 }
789
790 inline void InspectorInstrumentation::didPostMessage(Frame& frame, TimerBase& timer, JSC::ExecState& state)
791 {
792     FAST_RETURN_IF_NO_FRONTENDS(void());
793     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
794         didPostMessageImpl(*instrumentingAgents, timer, state);
795 }
796
797 inline void InspectorInstrumentation::didFailPostMessage(Frame& frame, TimerBase& timer)
798 {
799     FAST_RETURN_IF_NO_FRONTENDS(void());
800     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
801         didFailPostMessageImpl(*instrumentingAgents, timer);
802 }
803
804 inline void InspectorInstrumentation::willDispatchPostMessage(Frame& frame, TimerBase& timer)
805 {
806     FAST_RETURN_IF_NO_FRONTENDS(void());
807     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
808         willDispatchPostMessageImpl(*instrumentingAgents, timer);
809 }
810
811 inline void InspectorInstrumentation::didDispatchPostMessage(Frame& frame, TimerBase& timer)
812 {
813     FAST_RETURN_IF_NO_FRONTENDS(void());
814     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
815         didDispatchPostMessageImpl(*instrumentingAgents, timer);
816 }
817
818 inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine, int scriptColumn)
819 {
820     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
821     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
822         return willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, scriptColumn, context);
823     return InspectorInstrumentationCookie();
824 }
825
826 inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie, ScriptExecutionContext* context)
827 {
828     FAST_RETURN_IF_NO_FRONTENDS(void());
829     if (cookie.isValid())
830         didCallFunctionImpl(cookie, context);
831 }
832
833 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document& document, const Event& event, bool hasEventListeners)
834 {
835     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
836     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
837         return willDispatchEventImpl(*instrumentingAgents, document, event, hasEventListeners);
838     return InspectorInstrumentationCookie();
839 }
840
841 inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrumentationCookie& cookie, bool defaultPrevented)
842 {
843     FAST_RETURN_IF_NO_FRONTENDS(void());
844     if (cookie.isValid())
845         didDispatchEventImpl(cookie, defaultPrevented);
846 }
847
848 inline void InspectorInstrumentation::willHandleEvent(ScriptExecutionContext& context, Event& event, const RegisteredEventListener& listener)
849 {
850     FAST_RETURN_IF_NO_FRONTENDS(void());
851     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
852         return willHandleEventImpl(*instrumentingAgents, event, listener);
853 }
854
855 inline void InspectorInstrumentation::didHandleEvent(ScriptExecutionContext& context)
856 {
857     FAST_RETURN_IF_NO_FRONTENDS(void());
858     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
859         return didHandleEventImpl(*instrumentingAgents);
860 }
861
862 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow& window)
863 {
864     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
865     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
866         return willDispatchEventOnWindowImpl(*instrumentingAgents, event, window);
867     return InspectorInstrumentationCookie();
868 }
869
870 inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorInstrumentationCookie& cookie, bool defaultPrevented)
871 {
872     FAST_RETURN_IF_NO_FRONTENDS(void());
873     if (cookie.isValid())
874         didDispatchEventOnWindowImpl(cookie, defaultPrevented);
875 }
876
877 inline void InspectorInstrumentation::eventDidResetAfterDispatch(const Event& event)
878 {
879     FAST_RETURN_IF_NO_FRONTENDS(void());
880
881     if (!is<Node>(event.target()))
882         return;
883
884     auto* node = downcast<Node>(event.target());
885     if (auto* instrumentingAgents = instrumentingAgentsForContext(node->scriptExecutionContext()))
886         return eventDidResetAfterDispatchImpl(*instrumentingAgents, event);
887 }
888
889 inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber, int columnNumber)
890 {
891     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
892     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
893         return willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber, columnNumber);
894     return InspectorInstrumentationCookie();
895 }
896
897 inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie, Frame& frame)
898 {
899     FAST_RETURN_IF_NO_FRONTENDS(void());
900     if (cookie.isValid())
901         didEvaluateScriptImpl(cookie, frame);
902 }
903
904 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext& context, int timerId, bool oneShot)
905 {
906     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
907     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
908         return willFireTimerImpl(*instrumentingAgents, timerId, oneShot, context);
909     return InspectorInstrumentationCookie();
910 }
911
912 inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentationCookie& cookie)
913 {
914     FAST_RETURN_IF_NO_FRONTENDS(void());
915     if (cookie.isValid())
916         didFireTimerImpl(cookie);
917 }
918
919 inline void InspectorInstrumentation::didInvalidateLayout(Frame& frame)
920 {
921     FAST_RETURN_IF_NO_FRONTENDS(void());
922     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
923         didInvalidateLayoutImpl(*instrumentingAgents, frame);
924 }
925
926 inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame& frame)
927 {
928     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
929     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
930         return willLayoutImpl(*instrumentingAgents, frame);
931     return InspectorInstrumentationCookie();
932 }
933
934 inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie, RenderObject& root)
935 {
936     FAST_RETURN_IF_NO_FRONTENDS(void());
937     if (cookie.isValid())
938         didLayoutImpl(cookie, root);
939 }
940
941 inline void InspectorInstrumentation::didScroll(Page& page)
942 {
943     FAST_RETURN_IF_NO_FRONTENDS(void());
944     didScrollImpl(instrumentingAgentsForPage(page));
945 }
946
947 inline void InspectorInstrumentation::willComposite(Frame& frame)
948 {
949     FAST_RETURN_IF_NO_FRONTENDS(void());
950     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
951         willCompositeImpl(*instrumentingAgents, frame);
952 }
953
954 inline void InspectorInstrumentation::didComposite(Frame& frame)
955 {
956     FAST_RETURN_IF_NO_FRONTENDS(void());
957     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
958         didCompositeImpl(*instrumentingAgents);
959 }
960
961 inline void InspectorInstrumentation::willPaint(RenderObject& renderer)
962 {
963     FAST_RETURN_IF_NO_FRONTENDS(void());
964     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer))
965         return willPaintImpl(*instrumentingAgents, renderer);
966 }
967
968 inline void InspectorInstrumentation::didPaint(RenderObject& renderer, const LayoutRect& rect)
969 {
970     FAST_RETURN_IF_NO_FRONTENDS(void());
971     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer))
972         didPaintImpl(*instrumentingAgents, renderer, rect);
973 }
974
975 inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document& document)
976 {
977     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
978     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
979         return willRecalculateStyleImpl(*instrumentingAgents, document);
980     return InspectorInstrumentationCookie();
981 }
982
983 inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie)
984 {
985     FAST_RETURN_IF_NO_FRONTENDS(void());
986     if (cookie.isValid())
987         didRecalculateStyleImpl(cookie);
988 }
989
990 inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document& document)
991 {
992     FAST_RETURN_IF_NO_FRONTENDS(void());
993     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
994         didScheduleStyleRecalculationImpl(*instrumentingAgents, document);
995 }
996
997 inline void InspectorInstrumentation::applyUserAgentOverride(Frame& frame, String& userAgent)
998 {
999     FAST_RETURN_IF_NO_FRONTENDS(void());
1000     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1001         applyUserAgentOverrideImpl(*instrumentingAgents, userAgent);
1002 }
1003
1004 inline void InspectorInstrumentation::applyEmulatedMedia(Frame& frame, String& media)
1005 {
1006     FAST_RETURN_IF_NO_FRONTENDS(void());
1007     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1008         applyEmulatedMediaImpl(*instrumentingAgents, media);
1009 }
1010
1011 inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
1012 {
1013     FAST_RETURN_IF_NO_FRONTENDS(void());
1014     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1015         willSendRequestImpl(*instrumentingAgents, identifier, loader, request, redirectResponse);
1016 }
1017
1018 inline void InspectorInstrumentation::willSendRequest(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, ResourceRequest& request)
1019 {
1020     FAST_RETURN_IF_NO_FRONTENDS(void());
1021     willSendRequestImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, nullptr, request, ResourceResponse { });
1022 }
1023
1024 inline void InspectorInstrumentation::willSendRequestOfType(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, LoadType loadType)
1025 {
1026     FAST_RETURN_IF_NO_FRONTENDS(void());
1027     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1028         willSendRequestOfTypeImpl(*instrumentingAgents, identifier, loader, request, loadType);
1029 }
1030
1031 inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page& page, DocumentLoader* loader, CachedResource* resource)
1032 {
1033     FAST_RETURN_IF_NO_FRONTENDS(void());
1034     didLoadResourceFromMemoryCacheImpl(instrumentingAgentsForPage(page), loader, resource);
1035 }
1036
1037 inline void InspectorInstrumentation::didReceiveResourceResponse(Frame& frame, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
1038 {
1039     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1040         didReceiveResourceResponseImpl(*instrumentingAgents, identifier, loader, response, resourceLoader);
1041 }
1042
1043 inline void InspectorInstrumentation::didReceiveResourceResponse(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, const ResourceResponse& response)
1044 {
1045     didReceiveResourceResponseImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, nullptr, response, nullptr);
1046 }
1047
1048 inline void InspectorInstrumentation::didReceiveThreadableLoaderResponse(DocumentThreadableLoader& documentThreadableLoader, unsigned long identifier)
1049 {
1050     FAST_RETURN_IF_NO_FRONTENDS(void());
1051     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(documentThreadableLoader.document()))
1052         didReceiveThreadableLoaderResponseImpl(*instrumentingAgents, documentThreadableLoader, identifier);
1053 }
1054     
1055 inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
1056 {
1057     FAST_RETURN_IF_NO_FRONTENDS(void());
1058     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1059         didReceiveDataImpl(*instrumentingAgents, identifier, data, dataLength, encodedDataLength);
1060 }
1061
1062 inline void InspectorInstrumentation::didReceiveData(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, const char* data, int dataLength)
1063 {
1064     FAST_RETURN_IF_NO_FRONTENDS(void());
1065     didReceiveDataImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, data, dataLength, dataLength);
1066 }
1067
1068 inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const NetworkLoadMetrics& networkLoadMetrics, ResourceLoader* resourceLoader)
1069 {
1070     FAST_RETURN_IF_NO_FRONTENDS(void());
1071     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1072         didFinishLoadingImpl(*instrumentingAgents, identifier, loader, networkLoadMetrics, resourceLoader);
1073 }
1074
1075 inline void InspectorInstrumentation::didFinishLoading(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, const NetworkLoadMetrics& networkLoadMetrics)
1076 {
1077     FAST_RETURN_IF_NO_FRONTENDS(void());
1078     didFinishLoadingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, nullptr, networkLoadMetrics, nullptr);
1079 }
1080
1081 inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
1082 {
1083     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1084         didFailLoadingImpl(*instrumentingAgents, identifier, loader, error);
1085 }
1086
1087 inline void InspectorInstrumentation::didFailLoading(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, const ResourceError& error)
1088 {
1089     didFailLoadingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, nullptr, error);
1090 }
1091
1092 inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame& frame, unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response)
1093 {
1094     // Treat the same as didReceiveResponse.
1095     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1096         didReceiveResourceResponseImpl(*instrumentingAgents, identifier, &loader, response, nullptr);
1097 }
1098
1099 inline void InspectorInstrumentation::continueWithPolicyDownload(Frame& frame, unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response)
1100 {
1101     // Treat the same as didReceiveResponse.
1102     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1103         didReceiveResourceResponseImpl(*instrumentingAgents, identifier, &loader, response, nullptr);
1104 }
1105
1106 inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame& frame, unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response)
1107 {
1108     // Treat the same as didReceiveResponse.
1109     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1110         didReceiveResourceResponseImpl(*instrumentingAgents, identifier, &loader, response, nullptr);
1111 }
1112
1113 inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context)
1114 {
1115     FAST_RETURN_IF_NO_FRONTENDS(void());
1116     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1117         willLoadXHRSynchronouslyImpl(*instrumentingAgents);
1118 }
1119
1120 inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context)
1121 {
1122     FAST_RETURN_IF_NO_FRONTENDS(void());
1123     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1124         didLoadXHRSynchronouslyImpl(*instrumentingAgents);
1125 }
1126
1127 inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext& context, unsigned long identifier, const String& sourceString)
1128 {
1129     FAST_RETURN_IF_NO_FRONTENDS(void());
1130     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1131         scriptImportedImpl(*instrumentingAgents, identifier, sourceString);
1132 }
1133
1134 inline void InspectorInstrumentation::scriptExecutionBlockedByCSP(ScriptExecutionContext* context, const String& directiveText)
1135 {
1136     FAST_RETURN_IF_NO_FRONTENDS(void());
1137     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1138         scriptExecutionBlockedByCSPImpl(*instrumentingAgents, directiveText);
1139 }
1140
1141 inline void InspectorInstrumentation::didReceiveScriptResponse(ScriptExecutionContext* context, unsigned long identifier)
1142 {
1143     FAST_RETURN_IF_NO_FRONTENDS(void());
1144     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1145         didReceiveScriptResponseImpl(*instrumentingAgents, identifier);
1146 }
1147
1148 inline void InspectorInstrumentation::domContentLoadedEventFired(Frame& frame)
1149 {
1150     FAST_RETURN_IF_NO_FRONTENDS(void());
1151     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1152         domContentLoadedEventFiredImpl(*instrumentingAgents, frame);
1153 }
1154
1155 inline void InspectorInstrumentation::loadEventFired(Frame* frame)
1156 {
1157     FAST_RETURN_IF_NO_FRONTENDS(void());
1158     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1159         loadEventFiredImpl(*instrumentingAgents, frame);
1160 }
1161
1162 inline void InspectorInstrumentation::frameDetachedFromParent(Frame& frame)
1163 {
1164     FAST_RETURN_IF_NO_FRONTENDS(void());
1165     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1166         frameDetachedFromParentImpl(*instrumentingAgents, frame);
1167 }
1168
1169 inline void InspectorInstrumentation::didCommitLoad(Frame& frame, DocumentLoader* loader)
1170 {
1171     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1172         didCommitLoadImpl(*instrumentingAgents, frame, loader);
1173 }
1174
1175 inline void InspectorInstrumentation::frameDocumentUpdated(Frame& frame)
1176 {
1177     FAST_RETURN_IF_NO_FRONTENDS(void());
1178     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1179         frameDocumentUpdatedImpl(*instrumentingAgents, frame);
1180 }
1181
1182 inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame& frame, DocumentLoader& loader)
1183 {
1184     FAST_RETURN_IF_NO_FRONTENDS(void());
1185     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1186         loaderDetachedFromFrameImpl(*instrumentingAgents, loader);
1187 }
1188
1189 inline void InspectorInstrumentation::frameStartedLoading(Frame& frame)
1190 {
1191     FAST_RETURN_IF_NO_FRONTENDS(void());
1192     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1193         frameStartedLoadingImpl(*instrumentingAgents, frame);
1194 }
1195
1196 inline void InspectorInstrumentation::frameStoppedLoading(Frame& frame)
1197 {
1198     FAST_RETURN_IF_NO_FRONTENDS(void());
1199     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1200         frameStoppedLoadingImpl(*instrumentingAgents, frame);
1201 }
1202
1203 inline void InspectorInstrumentation::frameScheduledNavigation(Frame& frame, Seconds delay)
1204 {
1205     FAST_RETURN_IF_NO_FRONTENDS(void());
1206     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1207         frameScheduledNavigationImpl(*instrumentingAgents, frame, delay);
1208 }
1209
1210 inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& frame)
1211 {
1212     FAST_RETURN_IF_NO_FRONTENDS(void());
1213     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1214         frameClearedScheduledNavigationImpl(*instrumentingAgents, frame);
1215 }
1216
1217 inline void InspectorInstrumentation::defaultAppearanceDidChange(Page& page, bool useDarkAppearance)
1218 {
1219     FAST_RETURN_IF_NO_FRONTENDS(void());
1220     defaultAppearanceDidChangeImpl(instrumentingAgentsForPage(page), useDarkAppearance);
1221 }
1222
1223 inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource& cachedResource)
1224 {
1225     FAST_RETURN_IF_NO_FRONTENDS(void());
1226     willDestroyCachedResourceImpl(cachedResource);
1227 }
1228
1229 inline bool InspectorInstrumentation::willInterceptRequest(const Frame* frame, const ResourceRequest& request)
1230 {
1231     FAST_RETURN_IF_NO_FRONTENDS(false);
1232     if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
1233         return willInterceptRequestImpl(*instrumentingAgents, request);
1234     return false;
1235 }
1236
1237 inline bool InspectorInstrumentation::shouldInterceptResponse(const Frame& frame, const ResourceResponse& response)
1238 {
1239     ASSERT(InspectorInstrumentationPublic::hasFrontends());
1240     if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
1241         return shouldInterceptResponseImpl(*instrumentingAgents, response);
1242     return false;
1243 }
1244
1245 inline void InspectorInstrumentation::interceptResponse(const Frame& frame, const ResourceResponse& response, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&& handler)
1246 {
1247     ASSERT(InspectorInstrumentation::shouldInterceptResponse(frame, response));
1248     if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
1249         interceptResponseImpl(*instrumentingAgents, response, identifier, WTFMove(handler));
1250 }
1251
1252 inline void InspectorInstrumentation::didOpenDatabase(Database& database)
1253 {
1254     FAST_RETURN_IF_NO_FRONTENDS(void());
1255     if (auto* instrumentingAgents = instrumentingAgentsForContext(database.document()))
1256         didOpenDatabaseImpl(*instrumentingAgents, database);
1257 }
1258
1259 inline void InspectorInstrumentation::didDispatchDOMStorageEvent(Page& page, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin)
1260 {
1261     FAST_RETURN_IF_NO_FRONTENDS(void());
1262     didDispatchDOMStorageEventImpl(instrumentingAgentsForPage(page), key, oldValue, newValue, storageType, securityOrigin);
1263 }
1264
1265 inline bool InspectorInstrumentation::shouldWaitForDebuggerOnStart(ScriptExecutionContext& context)
1266 {
1267     FAST_RETURN_IF_NO_FRONTENDS(false);
1268     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1269         return shouldWaitForDebuggerOnStartImpl(*instrumentingAgents);
1270     return false;
1271 }
1272
1273 inline void InspectorInstrumentation::workerStarted(ScriptExecutionContext& context, WorkerInspectorProxy* proxy, const URL& url)
1274 {
1275     FAST_RETURN_IF_NO_FRONTENDS(void());
1276     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1277         workerStartedImpl(*instrumentingAgents, proxy, url);
1278 }
1279
1280 inline void InspectorInstrumentation::workerTerminated(ScriptExecutionContext& context, WorkerInspectorProxy* proxy)
1281 {
1282     FAST_RETURN_IF_NO_FRONTENDS(void());
1283     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1284         workerTerminatedImpl(*instrumentingAgents, proxy);
1285 }
1286
1287 inline void InspectorInstrumentation::didCreateWebSocket(Document* document, unsigned long identifier, const URL& requestURL)
1288 {
1289     FAST_RETURN_IF_NO_FRONTENDS(void());
1290     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1291         didCreateWebSocketImpl(*instrumentingAgents, identifier, requestURL);
1292 }
1293
1294 inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(Document* document, unsigned long identifier, const ResourceRequest& request)
1295 {
1296     FAST_RETURN_IF_NO_FRONTENDS(void());
1297     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1298         willSendWebSocketHandshakeRequestImpl(*instrumentingAgents, identifier, request);
1299 }
1300
1301 inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(Document* document, unsigned long identifier, const ResourceResponse& response)
1302 {
1303     FAST_RETURN_IF_NO_FRONTENDS(void());
1304     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1305         didReceiveWebSocketHandshakeResponseImpl(*instrumentingAgents, identifier, response);
1306 }
1307
1308 inline void InspectorInstrumentation::didCloseWebSocket(Document* document, unsigned long identifier)
1309 {
1310     FAST_RETURN_IF_NO_FRONTENDS(void());
1311     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1312         didCloseWebSocketImpl(*instrumentingAgents, identifier);
1313 }
1314
1315 inline void InspectorInstrumentation::didReceiveWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1316 {
1317     FAST_RETURN_IF_NO_FRONTENDS(void());
1318     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1319         didReceiveWebSocketFrameImpl(*instrumentingAgents, identifier, frame);
1320 }
1321
1322 inline void InspectorInstrumentation::didReceiveWebSocketFrameError(Document* document, unsigned long identifier, const String& errorMessage)
1323 {
1324     FAST_RETURN_IF_NO_FRONTENDS(void());
1325     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1326         didReceiveWebSocketFrameErrorImpl(*instrumentingAgents, identifier, errorMessage);
1327 }
1328
1329 inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1330 {
1331     FAST_RETURN_IF_NO_FRONTENDS(void());
1332     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1333         didSendWebSocketFrameImpl(*instrumentingAgents, identifier, frame);
1334 }
1335
1336 #if ENABLE(RESOURCE_USAGE)
1337 inline void InspectorInstrumentation::didHandleMemoryPressure(Page& page, Critical critical)
1338 {
1339     FAST_RETURN_IF_NO_FRONTENDS(void());
1340     didHandleMemoryPressureImpl(instrumentingAgentsForPage(page), critical);
1341 }
1342 #endif
1343
1344 inline void InspectorInstrumentation::didChangeCSSCanvasClientNodes(CanvasBase& canvasBase)
1345 {
1346     FAST_RETURN_IF_NO_FRONTENDS(void());
1347     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(canvasBase.scriptExecutionContext()))
1348         didChangeCSSCanvasClientNodesImpl(*instrumentingAgents, canvasBase);
1349 }
1350
1351 inline void InspectorInstrumentation::didCreateCanvasRenderingContext(CanvasRenderingContext& context)
1352 {
1353     FAST_RETURN_IF_NO_FRONTENDS(void());
1354     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext()))
1355         didCreateCanvasRenderingContextImpl(*instrumentingAgents, context);
1356 }
1357
1358 inline void InspectorInstrumentation::didChangeCanvasMemory(CanvasRenderingContext& context)
1359 {
1360     FAST_RETURN_IF_NO_FRONTENDS(void());
1361     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext()))
1362         didChangeCanvasMemoryImpl(*instrumentingAgents, context);
1363 }
1364
1365 inline void InspectorInstrumentation::recordCanvasAction(CanvasRenderingContext& context, const String& name, std::initializer_list<RecordCanvasActionVariant>&& parameters)
1366 {
1367     FAST_RETURN_IF_NO_FRONTENDS(void());
1368     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext()))
1369         recordCanvasActionImpl(*instrumentingAgents, context, name, WTFMove(parameters));
1370 }
1371
1372 inline void InspectorInstrumentation::didFinishRecordingCanvasFrame(CanvasRenderingContext& context, bool forceDispatch)
1373 {
1374     FAST_RETURN_IF_NO_FRONTENDS(void());
1375     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext()))
1376         didFinishRecordingCanvasFrameImpl(*instrumentingAgents, context, forceDispatch);
1377 }
1378
1379 #if ENABLE(WEBGL)
1380 inline void InspectorInstrumentation::didEnableExtension(WebGLRenderingContextBase& contextWebGLBase, const String& extension)
1381 {
1382     FAST_RETURN_IF_NO_FRONTENDS(void());
1383     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
1384         didEnableExtensionImpl(*instrumentingAgents, contextWebGLBase, extension);
1385 }
1386
1387 inline void InspectorInstrumentation::didCreateProgram(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
1388 {
1389     FAST_RETURN_IF_NO_FRONTENDS(void());
1390     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
1391         didCreateProgramImpl(*instrumentingAgents, contextWebGLBase, program);
1392 }
1393
1394 inline void InspectorInstrumentation::willDeleteProgram(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
1395 {
1396     FAST_RETURN_IF_NO_FRONTENDS(void());
1397     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
1398         willDeleteProgramImpl(*instrumentingAgents, program);
1399 }
1400
1401 inline bool InspectorInstrumentation::isShaderProgramDisabled(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
1402 {
1403     FAST_RETURN_IF_NO_FRONTENDS(false);
1404     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
1405         return isShaderProgramDisabledImpl(*instrumentingAgents, program);
1406     return false;
1407 }
1408
1409 inline bool InspectorInstrumentation::isShaderProgramHighlighted(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
1410 {
1411     FAST_RETURN_IF_NO_FRONTENDS(false);
1412     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
1413         return isShaderProgramHighlightedImpl(*instrumentingAgents, program);
1414     return false;
1415 }
1416 #endif
1417
1418 #if ENABLE(WEBGPU)
1419 inline void InspectorInstrumentation::didCreateWebGPUDevice(WebGPUDevice& device)
1420 {
1421     FAST_RETURN_IF_NO_FRONTENDS(void());
1422     if (auto* instrumentingAgents = instrumentingAgentsForContext(device.scriptExecutionContext()))
1423         didCreateWebGPUDeviceImpl(*instrumentingAgents, device);
1424 }
1425
1426 inline void InspectorInstrumentation::willDestroyWebGPUDevice(WebGPUDevice& device)
1427 {
1428     FAST_RETURN_IF_NO_FRONTENDS(void());
1429     if (auto* instrumentingAgents = instrumentingAgentsForContext(device.scriptExecutionContext()))
1430         willDestroyWebGPUDeviceImpl(*instrumentingAgents, device);
1431 }
1432
1433 inline void InspectorInstrumentation::willConfigureSwapChain(GPUCanvasContext& contextGPU, WebGPUSwapChain& newSwapChain)
1434 {
1435     FAST_RETURN_IF_NO_FRONTENDS(void());
1436     if (auto* instrumentingAgents = instrumentingAgentsForContext(contextGPU.canvasBase().scriptExecutionContext()))
1437         willConfigureSwapChainImpl(*instrumentingAgents, contextGPU, newSwapChain);
1438 }
1439 #endif
1440
1441 inline void InspectorInstrumentation::networkStateChanged(Page& page)
1442 {
1443     FAST_RETURN_IF_NO_FRONTENDS(void());
1444     networkStateChangedImpl(instrumentingAgentsForPage(page));
1445 }
1446
1447 inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
1448 {
1449     FAST_RETURN_IF_NO_FRONTENDS(void());
1450     if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
1451         updateApplicationCacheStatusImpl(*instrumentingAgents, *frame);
1452 }
1453
1454 inline void InspectorInstrumentation::addMessageToConsole(Page& page, std::unique_ptr<Inspector::ConsoleMessage> message)
1455 {
1456     addMessageToConsoleImpl(instrumentingAgentsForPage(page), WTFMove(message));
1457 }
1458
1459 inline void InspectorInstrumentation::addMessageToConsole(WorkerGlobalScope& workerGlobalScope, std::unique_ptr<Inspector::ConsoleMessage> message)
1460 {
1461     addMessageToConsoleImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), WTFMove(message));
1462 }
1463
1464 inline void InspectorInstrumentation::consoleCount(Page& page, JSC::ExecState* state, const String& label)
1465 {
1466     consoleCountImpl(instrumentingAgentsForPage(page), state, label);
1467 }
1468
1469 inline void InspectorInstrumentation::consoleCount(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* state, const String& label)
1470 {
1471     consoleCountImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), state, label);
1472 }
1473
1474 inline void InspectorInstrumentation::consoleCountReset(Page& page, JSC::ExecState* state, const String& label)
1475 {
1476     consoleCountResetImpl(instrumentingAgentsForPage(page), state, label);
1477 }
1478
1479 inline void InspectorInstrumentation::consoleCountReset(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* state, const String& label)
1480 {
1481     consoleCountResetImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), state, label);
1482 }
1483
1484 inline void InspectorInstrumentation::takeHeapSnapshot(Frame& frame, const String& title)
1485 {
1486     FAST_RETURN_IF_NO_FRONTENDS(void());
1487     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1488         takeHeapSnapshotImpl(*instrumentingAgents, title);
1489 }
1490
1491 inline void InspectorInstrumentation::startConsoleTiming(Frame& frame, JSC::ExecState* exec, const String& label)
1492 {
1493     if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
1494         startConsoleTimingImpl(*instrumentingAgents, frame, exec, label);
1495 }
1496
1497 inline void InspectorInstrumentation::startConsoleTiming(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* exec, const String& label)
1498 {
1499     startConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), exec, label);
1500 }
1501
1502 inline void InspectorInstrumentation::logConsoleTiming(Frame& frame, JSC::ExecState* exec, const String& label, Ref<Inspector::ScriptArguments>&& arguments)
1503 {
1504     if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
1505         logConsoleTimingImpl(*instrumentingAgents, exec, label, WTFMove(arguments));
1506 }
1507
1508 inline void InspectorInstrumentation::logConsoleTiming(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* exec, const String& label, Ref<Inspector::ScriptArguments>&& arguments)
1509 {
1510     logConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), exec, label, WTFMove(arguments));
1511 }
1512
1513 inline void InspectorInstrumentation::stopConsoleTiming(Frame& frame, JSC::ExecState* exec, const String& label)
1514 {
1515     if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame))
1516         stopConsoleTimingImpl(*instrumentingAgents, frame, exec, label);
1517 }
1518
1519 inline void InspectorInstrumentation::stopConsoleTiming(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* exec, const String& label)
1520 {
1521     stopConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), exec, label);
1522 }
1523
1524 inline void InspectorInstrumentation::consoleTimeStamp(Frame& frame, Ref<Inspector::ScriptArguments>&& arguments)
1525 {
1526     FAST_RETURN_IF_NO_FRONTENDS(void());
1527     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1528         consoleTimeStampImpl(*instrumentingAgents, frame, WTFMove(arguments));
1529 }
1530
1531 inline void InspectorInstrumentation::startProfiling(Page& page, JSC::ExecState* exec, const String &title)
1532 {
1533     FAST_RETURN_IF_NO_FRONTENDS(void());
1534     startProfilingImpl(instrumentingAgentsForPage(page), exec, title);
1535 }
1536
1537 inline void InspectorInstrumentation::stopProfiling(Page& page, JSC::ExecState* exec, const String &title)
1538 {
1539     FAST_RETURN_IF_NO_FRONTENDS(void());
1540     stopProfilingImpl(instrumentingAgentsForPage(page), exec, title);
1541 }
1542
1543 inline void InspectorInstrumentation::consoleStartRecordingCanvas(CanvasRenderingContext& context, JSC::ExecState& exec, JSC::JSObject* options)
1544 {
1545     FAST_RETURN_IF_NO_FRONTENDS(void());
1546     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext()))
1547         consoleStartRecordingCanvasImpl(*instrumentingAgents, context, exec, options);
1548 }
1549
1550 inline void InspectorInstrumentation::didRequestAnimationFrame(Document& document, int callbackId)
1551 {
1552     FAST_RETURN_IF_NO_FRONTENDS(void());
1553     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1554         didRequestAnimationFrameImpl(*instrumentingAgents, callbackId, document);
1555 }
1556
1557 inline void InspectorInstrumentation::didCancelAnimationFrame(Document& document, int callbackId)
1558 {
1559     FAST_RETURN_IF_NO_FRONTENDS(void());
1560     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1561         didCancelAnimationFrameImpl(*instrumentingAgents, callbackId, document);
1562 }
1563
1564 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrame(Document& document, int callbackId)
1565 {
1566     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1567     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1568         return willFireAnimationFrameImpl(*instrumentingAgents, callbackId, document);
1569     return InspectorInstrumentationCookie();
1570 }
1571
1572 inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstrumentationCookie& cookie)
1573 {
1574     FAST_RETURN_IF_NO_FRONTENDS(void());
1575     if (cookie.isValid())
1576         didFireAnimationFrameImpl(cookie);
1577 }
1578
1579 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireObserverCallback(ScriptExecutionContext& context, const String& callbackType)
1580 {
1581     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1582     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1583         return willFireObserverCallbackImpl(*instrumentingAgents, callbackType, context);
1584     return InspectorInstrumentationCookie();
1585 }
1586
1587 inline void InspectorInstrumentation::didFireObserverCallback(const InspectorInstrumentationCookie& cookie)
1588 {
1589     FAST_RETURN_IF_NO_FRONTENDS(void());
1590     if (cookie.isValid())
1591         didFireObserverCallbackImpl(cookie);
1592 }
1593
1594 inline void InspectorInstrumentation::layerTreeDidChange(Page* page)
1595 {
1596     FAST_RETURN_IF_NO_FRONTENDS(void());
1597     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1598         layerTreeDidChangeImpl(*instrumentingAgents);
1599 }
1600
1601 inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const RenderLayer& renderLayer)
1602 {
1603     FAST_RETURN_IF_NO_FRONTENDS(void());
1604     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1605         renderLayerDestroyedImpl(*instrumentingAgents, renderLayer);
1606 }
1607
1608 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context)
1609 {
1610     return context ? instrumentingAgentsForContext(*context) : nullptr;
1611 }
1612
1613 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext& context)
1614 {
1615     if (is<Document>(context))
1616         return instrumentingAgentsForPage(downcast<Document>(context).page());
1617     if (is<WorkerGlobalScope>(context))
1618         return &instrumentingAgentsForWorkerGlobalScope(downcast<WorkerGlobalScope>(context));
1619     return nullptr;
1620 }
1621
1622 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(const Frame* frame)
1623 {
1624     return frame ? instrumentingAgentsForFrame(*frame) : nullptr;
1625 }
1626
1627 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(const Frame& frame)
1628 {
1629     return instrumentingAgentsForPage(frame.page());
1630 }
1631
1632 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document* document)
1633 {
1634     return document ? instrumentingAgentsForDocument(*document) : nullptr;
1635 }
1636
1637 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document& document)
1638 {
1639     Page* page = document.page();
1640     if (!page && document.templateDocumentHost())
1641         page = document.templateDocumentHost()->page();
1642     return instrumentingAgentsForPage(page);
1643 }
1644
1645 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page)
1646 {
1647     return page ? &instrumentingAgentsForPage(*page) : nullptr;
1648 }
1649
1650 inline InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForPage(Page& page)
1651 {
1652     ASSERT(isMainThread());
1653     return page.inspectorController().m_instrumentingAgents.get();
1654 }
1655
1656 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope* workerGlobalScope)
1657 {
1658     return workerGlobalScope ? &instrumentingAgentsForWorkerGlobalScope(*workerGlobalScope) : nullptr;
1659 }
1660
1661 inline InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope& workerGlobalScope)
1662 {
1663     return workerGlobalScope.inspectorController().m_instrumentingAgents;
1664 }
1665
1666 inline void InspectorInstrumentation::frontendCreated()
1667 {
1668     ASSERT(isMainThread());
1669     ++InspectorInstrumentationPublic::s_frontendCounter;
1670
1671     if (InspectorInstrumentationPublic::s_frontendCounter == 1)
1672         InspectorInstrumentation::firstFrontendCreated();
1673 }
1674
1675 inline void InspectorInstrumentation::frontendDeleted()
1676 {
1677     ASSERT(isMainThread());
1678     --InspectorInstrumentationPublic::s_frontendCounter;
1679
1680     if (!InspectorInstrumentationPublic::s_frontendCounter)
1681         InspectorInstrumentation::lastFrontendDeleted();
1682 }
1683
1684 } // namespace WebCore