1/*
2* Copyright (C) 2010 Google Inc. All rights reserved.
3* Copyright (C) 2014 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#ifndef InspectorInstrumentation_h
33#define InspectorInstrumentation_h
34
35#include "CSSSelector.h"
36#include "Element.h"
37#include "FormData.h"
38#include "Frame.h"
39#include "HitTestResult.h"
40#include "InspectorInstrumentationCookie.h"
41#include "Page.h"
42#include "ScriptExecutionContext.h"
43#include "ScriptState.h"
44#include "StorageArea.h"
45#include "WebSocketFrame.h"
46#include <runtime/ConsoleTypes.h>
47#include <wtf/RefPtr.h>
48
49#if ENABLE(WEB_REPLAY)
50#include "ReplaySession.h"
51#include "ReplaySessionSegment.h"
52#endif
53
54
55namespace Deprecated {
56class ScriptObject;
57}
58
59namespace Inspector {
60class ScriptArguments;
61class ScriptCallStack;
62}
63
64namespace JSC {
65class Profile;
66}
67
68namespace WebCore {
69
70class CSSRule;
71class CachedResource;
72class CharacterData;
73class DOMWindow;
74class DOMWrapperWorld;
75class Database;
76class Document;
77class Element;
78class DocumentLoader;
79class DocumentStyleSheetCollection;
80class GraphicsContext;
81class HTTPHeaderMap;
82class InspectorCSSAgent;
83class InspectorCSSOMWrappers;
84class InspectorInstrumentation;
85class InspectorTimelineAgent;
86class InstrumentingAgents;
87class URL;
88class Node;
89class PseudoElement;
90class RenderLayer;
91class RenderLayerBacking;
92class RenderObject;
93class ResourceRequest;
94class ResourceResponse;
95class ScriptExecutionContext;
96class SecurityOrigin;
97class ShadowRoot;
98class StorageArea;
99class StyleResolver;
100class StyleRule;
101class ThreadableLoaderClient;
102class WorkerGlobalScope;
103class WorkerGlobalScopeProxy;
104class XMLHttpRequest;
105
106struct ReplayPosition;
107
108#define FAST_RETURN_IF_NO_FRONTENDS(value) if (LIKELY(!hasFrontends())) return value;
109
110class InspectorInstrumentation {
111public:
112    static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld&);
113    static bool isDebuggerPaused(Frame*);
114
115    static void willInsertDOMNode(Document*, Node* parent);
116    static void didInsertDOMNode(Document*, Node*);
117    static void willRemoveDOMNode(Document*, Node*);
118    static void didRemoveDOMNode(Document*, Node*);
119    static void willModifyDOMAttr(Document*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
120    static void didModifyDOMAttr(Document*, Element*, const AtomicString& name, const AtomicString& value);
121    static void didRemoveDOMAttr(Document*, Element*, const AtomicString& name);
122    static void characterDataModified(Document*, CharacterData*);
123    static void didInvalidateStyleAttr(Document*, Node*);
124    static void frameWindowDiscarded(Frame*, DOMWindow*);
125    static void mediaQueryResultChanged(Document*);
126    static void didPushShadowRoot(Element* host, ShadowRoot*);
127    static void willPopShadowRoot(Element* host, ShadowRoot*);
128    static void didCreateNamedFlow(Document*, WebKitNamedFlow*);
129    static void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
130    static void didChangeRegionOverset(Document*, WebKitNamedFlow*);
131    static void didRegisterNamedFlowContentElement(Document*, WebKitNamedFlow*, Node* contentElement, Node* nextContentElement = nullptr);
132    static void didUnregisterNamedFlowContentElement(Document*, WebKitNamedFlow*, Node* contentElement);
133
134    static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
135    static bool handleMousePress(Page*);
136    static bool handleTouchEvent(Page*, Node*);
137    static bool forcePseudoState(Element*, CSSSelector::PseudoClassType);
138
139    static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
140    static void didScheduleResourceRequest(Document*, const String& url);
141    static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
142    static void didRemoveTimer(ScriptExecutionContext*, int timerId);
143
144    static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine);
145    static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
146    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext*, XMLHttpRequest*);
147    static void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&);
148    static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event&, bool hasEventListeners);
149    static void didDispatchEvent(const InspectorInstrumentationCookie&);
150    static InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, Event*);
151    static void didHandleEvent(const InspectorInstrumentationCookie&);
152    static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
153    static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
154    static InspectorInstrumentationCookie willEvaluateScript(Frame*, const String& url, int lineNumber);
155    static void didEvaluateScript(const InspectorInstrumentationCookie&, Frame*);
156    static void scriptsEnabled(Page*, bool isEnabled);
157    static void didCreateIsolatedContext(Frame*, JSC::ExecState*, SecurityOrigin*);
158    static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext*, int timerId);
159    static void didFireTimer(const InspectorInstrumentationCookie&);
160    static void didInvalidateLayout(Frame*);
161    static InspectorInstrumentationCookie willLayout(Frame*);
162    static void didLayout(const InspectorInstrumentationCookie&, RenderObject*);
163    static void didScroll(Page*);
164    static InspectorInstrumentationCookie willDispatchXHRLoadEvent(ScriptExecutionContext*, XMLHttpRequest*);
165    static void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&);
166    static void willScrollLayer(Frame*);
167    static void didScrollLayer(Frame*);
168    static void willPaint(RenderObject*);
169    static void didPaint(RenderObject*, GraphicsContext*, const LayoutRect&);
170    static InspectorInstrumentationCookie willRecalculateStyle(Document*);
171    static void didRecalculateStyle(const InspectorInstrumentationCookie&);
172    static void didScheduleStyleRecalculation(Document*);
173
174    static void applyEmulatedMedia(Frame*, String*);
175    static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
176    static void continueAfterPingLoader(Frame&, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
177    static void markResourceAsCached(Page*, unsigned long identifier);
178    static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, CachedResource*);
179    static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier, int length);
180    static void didReceiveResourceData(const InspectorInstrumentationCookie&);
181    static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&);
182    static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
183    static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
184    static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
185    static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
186    static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
187    static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime);
188    static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
189    static void documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext*, unsigned long identifier, ThreadableLoaderClient*);
190    static void willLoadXHR(ScriptExecutionContext*, ThreadableLoaderClient*, const String&, const URL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
191    static void didFailXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*);
192    static void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
193    static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
194    static void willLoadXHRSynchronously(ScriptExecutionContext*);
195    static void didLoadXHRSynchronously(ScriptExecutionContext*);
196    static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString);
197    static void scriptExecutionBlockedByCSP(ScriptExecutionContext*, const String& directiveText);
198    static void didReceiveScriptResponse(ScriptExecutionContext*, unsigned long identifier);
199    static void domContentLoadedEventFired(Frame*);
200    static void loadEventFired(Frame*);
201    static void frameDetachedFromParent(Frame*);
202    static void didCommitLoad(Frame*, DocumentLoader*);
203    static void frameDocumentUpdated(Frame*);
204    static void loaderDetachedFromFrame(Frame*, DocumentLoader*);
205    static void frameStartedLoading(Frame&);
206    static void frameStoppedLoading(Frame&);
207    static void frameScheduledNavigation(Frame&, double delay);
208    static void frameClearedScheduledNavigation(Frame&);
209    static InspectorInstrumentationCookie willRunJavaScriptDialog(Page*, const String& message);
210    static void didRunJavaScriptDialog(const InspectorInstrumentationCookie&);
211    static void willDestroyCachedResource(CachedResource*);
212
213    static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned startLine);
214    static void didWriteHTML(const InspectorInstrumentationCookie&, unsigned endLine);
215
216    // FIXME: Remove once we no longer generate stacks outside of Inspector.
217    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>, unsigned long requestIdentifier = 0);
218    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>, unsigned long requestIdentifier = 0);
219    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0);
220
221    // FIXME: Convert to ScriptArguments to match non-worker context.
222    static void addMessageToConsole(WorkerGlobalScope*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>, unsigned long requestIdentifier = 0);
223    static void addMessageToConsole(WorkerGlobalScope*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0);
224
225    static void consoleCount(Page*, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
226    static void startConsoleTiming(Frame*, const String& title);
227    static void stopConsoleTiming(Frame*, const String& title, PassRefPtr<Inspector::ScriptCallStack>);
228    static void consoleTimeStamp(Frame*, PassRefPtr<Inspector::ScriptArguments>);
229
230    static void didRequestAnimationFrame(Document*, int callbackId);
231    static void didCancelAnimationFrame(Document*, int callbackId);
232    static InspectorInstrumentationCookie willFireAnimationFrame(Document*, int callbackId);
233    static void didFireAnimationFrame(const InspectorInstrumentationCookie&);
234
235    static void startProfiling(Page*, JSC::ExecState*, const String& title);
236    static PassRefPtr<JSC::Profile> stopProfiling(Page*, JSC::ExecState*, const String& title);
237
238#if ENABLE(SQL_DATABASE)
239    static void didOpenDatabase(ScriptExecutionContext*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
240#endif
241
242    static void didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
243
244    static bool shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext*);
245    static void didStartWorkerGlobalScope(ScriptExecutionContext*, WorkerGlobalScopeProxy*, const URL&);
246    static void workerGlobalScopeTerminated(ScriptExecutionContext*, WorkerGlobalScopeProxy*);
247    static void willEvaluateWorkerScript(WorkerGlobalScope*, int workerThreadStartMode);
248
249#if ENABLE(WEB_REPLAY)
250    static void sessionCreated(Page*, PassRefPtr<ReplaySession>);
251    static void sessionLoaded(Page*, PassRefPtr<ReplaySession>);
252    static void sessionModified(Page*, PassRefPtr<ReplaySession>);
253
254    static void segmentCreated(Page*, PassRefPtr<ReplaySessionSegment>);
255    static void segmentCompleted(Page*, PassRefPtr<ReplaySessionSegment>);
256    static void segmentLoaded(Page*, PassRefPtr<ReplaySessionSegment>);
257    static void segmentUnloaded(Page*);
258
259    static void captureStarted(Page*);
260    static void captureStopped(Page*);
261
262    static void playbackStarted(Page*);
263    static void playbackPaused(Page*, const ReplayPosition&);
264    static void playbackHitPosition(Page*, const ReplayPosition&);
265    static void playbackFinished(Page*);
266#endif
267
268#if ENABLE(WEB_SOCKETS)
269    static void didCreateWebSocket(Document*, unsigned long identifier, const URL& requestURL, const URL& documentURL, const String& protocol);
270    static void willSendWebSocketHandshakeRequest(Document*, unsigned long identifier, const ResourceRequest&);
271    static void didReceiveWebSocketHandshakeResponse(Document*, unsigned long identifier, const ResourceResponse&);
272    static void didCloseWebSocket(Document*, unsigned long identifier);
273    static void didReceiveWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&);
274    static void didSendWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&);
275    static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
276#endif
277
278    static Deprecated::ScriptObject wrapCanvas2DRenderingContextForInstrumentation(Document*, const Deprecated::ScriptObject&);
279#if ENABLE(WEBGL)
280    static Deprecated::ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const Deprecated::ScriptObject&);
281#endif
282
283    static void networkStateChanged(Page*);
284    static void updateApplicationCacheStatus(Frame*);
285
286#if ENABLE(INSPECTOR)
287    static void frontendCreated() { s_frontendCounter += 1; }
288    static void frontendDeleted() { s_frontendCounter -= 1; }
289    static bool hasFrontends() { return s_frontendCounter; }
290    static bool consoleAgentEnabled(ScriptExecutionContext*);
291    static bool timelineAgentEnabled(ScriptExecutionContext*);
292    static bool replayAgentEnabled(ScriptExecutionContext*);
293#else
294    static bool hasFrontends() { return false; }
295    static bool consoleAgentEnabled(ScriptExecutionContext*) { return false; }
296    static bool runtimeAgentEnabled(Frame*) { return false; }
297    static bool timelineAgentEnabled(ScriptExecutionContext*) { return false; }
298    static bool replayAgentEnabled(ScriptExecutionContext*) { return false; }
299#endif
300
301    static void registerInstrumentingAgents(InstrumentingAgents*);
302    static void unregisterInstrumentingAgents(InstrumentingAgents*);
303
304    static void layerTreeDidChange(Page*);
305    static void renderLayerDestroyed(Page*, const RenderLayer*);
306    static void pseudoElementDestroyed(Page*, PseudoElement*);
307
308private:
309#if ENABLE(INSPECTOR)
310    static void didClearWindowObjectInWorldImpl(InstrumentingAgents*, Frame*, DOMWrapperWorld&);
311    static bool isDebuggerPausedImpl(InstrumentingAgents*);
312
313    static void willInsertDOMNodeImpl(InstrumentingAgents*, Node* parent);
314    static void didInsertDOMNodeImpl(InstrumentingAgents*, Node*);
315    static void willRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
316    static void didRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
317    static void willModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
318    static void didModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name, const AtomicString& value);
319    static void didRemoveDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name);
320    static void characterDataModifiedImpl(InstrumentingAgents*, CharacterData*);
321    static void didInvalidateStyleAttrImpl(InstrumentingAgents*, Node*);
322    static void frameWindowDiscardedImpl(InstrumentingAgents*, DOMWindow*);
323    static void mediaQueryResultChangedImpl(InstrumentingAgents*);
324    static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
325    static void willPopShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
326    static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
327    static void willRemoveNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
328    static void didChangeRegionOversetImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
329    static void didRegisterNamedFlowContentElementImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*, Node* contentElement, Node* nextContentElement = nullptr);
330    static void didUnregisterNamedFlowContentElementImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*, Node* contentElement);
331
332    static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags);
333    static bool handleTouchEventImpl(InstrumentingAgents*, Node*);
334    static bool handleMousePressImpl(InstrumentingAgents*);
335    static bool forcePseudoStateImpl(InstrumentingAgents*, Element*, CSSSelector::PseudoClassType);
336
337    static void willSendXMLHttpRequestImpl(InstrumentingAgents*, const String& url);
338    static void didScheduleResourceRequestImpl(InstrumentingAgents*, const String& url, Frame*);
339    static void didInstallTimerImpl(InstrumentingAgents*, int timerId, int timeout, bool singleShot, ScriptExecutionContext*);
340    static void didRemoveTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
341
342    static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents*, const String& scriptName, int scriptLine, ScriptExecutionContext*);
343    static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
344    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
345    static void didDispatchXHRReadyStateChangeEventImpl(const InspectorInstrumentationCookie&);
346    static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents*, const Event&, bool hasEventListeners, Document*);
347    static InspectorInstrumentationCookie willHandleEventImpl(InstrumentingAgents*, Event*);
348    static void didHandleEventImpl(const InspectorInstrumentationCookie&);
349    static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
350    static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents*, const Event&, DOMWindow*);
351    static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
352    static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents*, const String& url, int lineNumber, Frame*);
353    static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&, Frame*);
354    static void scriptsEnabledImpl(InstrumentingAgents*, bool isEnabled);
355    static void didCreateIsolatedContextImpl(InstrumentingAgents*, Frame*, JSC::ExecState*, SecurityOrigin*);
356    static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
357    static void didFireTimerImpl(const InspectorInstrumentationCookie&);
358    static void didInvalidateLayoutImpl(InstrumentingAgents*, Frame*);
359    static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents*, Frame*);
360    static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject*);
361    static void didScrollImpl(InstrumentingAgents*);
362    static InspectorInstrumentationCookie willDispatchXHRLoadEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
363    static void didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie&);
364    static void willScrollLayerImpl(InstrumentingAgents*, Frame*);
365    static void didScrollLayerImpl(InstrumentingAgents*);
366    static void willPaintImpl(InstrumentingAgents*, RenderObject*);
367    static void didPaintImpl(InstrumentingAgents*, RenderObject*, GraphicsContext*, const LayoutRect&);
368    static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*);
369    static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
370    static void didScheduleStyleRecalculationImpl(InstrumentingAgents*, Document*);
371
372    static void applyEmulatedMediaImpl(InstrumentingAgents*, String*);
373    static void willSendRequestImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
374    static void continueAfterPingLoaderImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
375    static void markResourceAsCachedImpl(InstrumentingAgents*, unsigned long identifier);
376    static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents*, DocumentLoader*, CachedResource*);
377    static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents*, unsigned long identifier, Frame*, int length);
378    static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
379    static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Frame*);
380    static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
381    static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
382    static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
383    static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
384    static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
385    static void didReceiveDataImpl(InstrumentingAgents*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
386    static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, double finishTime);
387    static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, const ResourceError&);
388    static void documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents*, unsigned long identifier, ThreadableLoaderClient*);
389    static void willLoadXHRImpl(InstrumentingAgents*, ThreadableLoaderClient*, const String&, const URL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
390    static void didFailXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*);
391    static void didFinishXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
392    static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier);
393    static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*);
394    static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*);
395    static void scriptImportedImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString);
396    static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents*, const String& directiveText);
397    static void didReceiveScriptResponseImpl(InstrumentingAgents*, unsigned long identifier);
398    static void domContentLoadedEventFiredImpl(InstrumentingAgents*, Frame*);
399    static void loadEventFiredImpl(InstrumentingAgents*, Frame*);
400    static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*);
401    static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*);
402    static void frameDocumentUpdatedImpl(InstrumentingAgents*, Frame*);
403    static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*);
404    static void frameStartedLoadingImpl(InstrumentingAgents&, Frame&);
405    static void frameStoppedLoadingImpl(InstrumentingAgents&, Frame&);
406    static void frameScheduledNavigationImpl(InstrumentingAgents&, Frame&, double delay);
407    static void frameClearedScheduledNavigationImpl(InstrumentingAgents&, Frame&);
408    static InspectorInstrumentationCookie willRunJavaScriptDialogImpl(InstrumentingAgents*, const String& message);
409    static void didRunJavaScriptDialogImpl(const InspectorInstrumentationCookie&);
410    static void willDestroyCachedResourceImpl(CachedResource*);
411
412    static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents*, unsigned startLine, Frame*);
413    static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned endLine);
414
415    static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>, unsigned long requestIdentifier);
416    static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState*, unsigned long requestIdentifier);
417
418    // FIXME: Remove once we no longer generate stacks outside of Inspector.
419    static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>, unsigned long requestIdentifier);
420
421    static void consoleCountImpl(InstrumentingAgents*, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
422    static void startConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title);
423    static void stopConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title, PassRefPtr<Inspector::ScriptCallStack>);
424    static void consoleTimeStampImpl(InstrumentingAgents*, Frame*, PassRefPtr<Inspector::ScriptArguments>);
425
426    static void didRequestAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
427    static void didCancelAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
428    static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
429    static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&);
430
431    static void startProfilingImpl(InstrumentingAgents*, JSC::ExecState*, const String& title);
432    static PassRefPtr<JSC::Profile> stopProfilingImpl(InstrumentingAgents*, JSC::ExecState*, const String& title);
433
434#if ENABLE(SQL_DATABASE)
435    static void didOpenDatabaseImpl(InstrumentingAgents*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
436#endif
437
438    static void didDispatchDOMStorageEventImpl(InstrumentingAgents*, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
439
440    static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents*);
441    static void didStartWorkerGlobalScopeImpl(InstrumentingAgents*, WorkerGlobalScopeProxy*, const URL&);
442    static void workerGlobalScopeTerminatedImpl(InstrumentingAgents*, WorkerGlobalScopeProxy*);
443
444#if ENABLE(WEB_REPLAY)
445    static void sessionCreatedImpl(InstrumentingAgents*, PassRefPtr<ReplaySession>);
446    static void sessionLoadedImpl(InstrumentingAgents*, PassRefPtr<ReplaySession>);
447    static void sessionModifiedImpl(InstrumentingAgents*, PassRefPtr<ReplaySession>);
448
449    static void segmentCreatedImpl(InstrumentingAgents*, PassRefPtr<ReplaySessionSegment>);
450    static void segmentCompletedImpl(InstrumentingAgents*, PassRefPtr<ReplaySessionSegment>);
451    static void segmentLoadedImpl(InstrumentingAgents*, PassRefPtr<ReplaySessionSegment>);
452    static void segmentUnloadedImpl(InstrumentingAgents*);
453
454    static void captureStartedImpl(InstrumentingAgents*);
455    static void captureStoppedImpl(InstrumentingAgents*);
456
457    static void playbackStartedImpl(InstrumentingAgents*);
458    static void playbackPausedImpl(InstrumentingAgents*, const ReplayPosition&);
459    static void playbackHitPositionImpl(InstrumentingAgents*, const ReplayPosition&);
460    static void playbackFinishedImpl(InstrumentingAgents*);
461#endif
462
463#if ENABLE(WEB_SOCKETS)
464    static void didCreateWebSocketImpl(InstrumentingAgents*, unsigned long identifier, const URL& requestURL, const URL& documentURL, const String& protocol, Document*);
465    static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents*, unsigned long identifier, const ResourceRequest&, Document*);
466    static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Document*);
467    static void didCloseWebSocketImpl(InstrumentingAgents*, unsigned long identifier, Document*);
468    static void didReceiveWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
469    static void didSendWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
470    static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents*, unsigned long identifier, const String&);
471#endif
472
473    static void networkStateChangedImpl(InstrumentingAgents*);
474    static void updateApplicationCacheStatusImpl(InstrumentingAgents*, Frame*);
475
476    static InstrumentingAgents* instrumentingAgentsForPage(Page*);
477    static InstrumentingAgents* instrumentingAgentsForFrame(Frame*);
478    static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*);
479    static InstrumentingAgents* instrumentingAgentsForDocument(Document*);
480    static InstrumentingAgents* instrumentingAgentsForRenderer(RenderObject*);
481
482    static InstrumentingAgents* instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope*);
483    static InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ScriptExecutionContext*);
484
485    static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, bool isDOMEvent, const String& eventName, bool synchronous);
486    static void cancelPauseOnNativeEvent(InstrumentingAgents*);
487    static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
488
489    static void layerTreeDidChangeImpl(InstrumentingAgents*);
490    static void renderLayerDestroyedImpl(InstrumentingAgents*, const RenderLayer*);
491    static void pseudoElementDestroyedImpl(InstrumentingAgents*, PseudoElement*);
492
493    static int s_frontendCounter;
494#endif
495};
496
497inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld& world)
498{
499#if ENABLE(INSPECTOR)
500    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
501        didClearWindowObjectInWorldImpl(instrumentingAgents, frame, world);
502#else
503    UNUSED_PARAM(frame);
504    UNUSED_PARAM(world);
505#endif
506}
507
508inline bool InspectorInstrumentation::isDebuggerPaused(Frame* frame)
509{
510#if ENABLE(INSPECTOR)
511    FAST_RETURN_IF_NO_FRONTENDS(false);
512    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
513        return isDebuggerPausedImpl(instrumentingAgents);
514#else
515    UNUSED_PARAM(frame);
516#endif
517    return false;
518}
519
520inline void InspectorInstrumentation::willInsertDOMNode(Document* document, Node* parent)
521{
522#if ENABLE(INSPECTOR)
523    FAST_RETURN_IF_NO_FRONTENDS(void());
524    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
525        willInsertDOMNodeImpl(instrumentingAgents, parent);
526#else
527    UNUSED_PARAM(document);
528    UNUSED_PARAM(parent);
529#endif
530}
531
532inline void InspectorInstrumentation::didInsertDOMNode(Document* document, Node* node)
533{
534#if ENABLE(INSPECTOR)
535    FAST_RETURN_IF_NO_FRONTENDS(void());
536    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
537        didInsertDOMNodeImpl(instrumentingAgents, node);
538#else
539    UNUSED_PARAM(document);
540    UNUSED_PARAM(node);
541#endif
542}
543
544inline void InspectorInstrumentation::willRemoveDOMNode(Document* document, Node* node)
545{
546#if ENABLE(INSPECTOR)
547    FAST_RETURN_IF_NO_FRONTENDS(void());
548    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
549        willRemoveDOMNodeImpl(instrumentingAgents, node);
550#else
551    UNUSED_PARAM(document);
552    UNUSED_PARAM(node);
553#endif
554}
555
556inline void InspectorInstrumentation::didRemoveDOMNode(Document* document, Node* node)
557{
558#if ENABLE(INSPECTOR)
559    FAST_RETURN_IF_NO_FRONTENDS(void());
560    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
561        didRemoveDOMNodeImpl(instrumentingAgents, node);
562#else
563    UNUSED_PARAM(document);
564    UNUSED_PARAM(node);
565#endif
566}
567
568inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element, const AtomicString& oldValue, const AtomicString& newValue)
569{
570#if ENABLE(INSPECTOR)
571    FAST_RETURN_IF_NO_FRONTENDS(void());
572    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
573        willModifyDOMAttrImpl(instrumentingAgents, element, oldValue, newValue);
574#else
575    UNUSED_PARAM(document);
576    UNUSED_PARAM(element);
577    UNUSED_PARAM(oldValue);
578    UNUSED_PARAM(newValue);
579#endif
580}
581
582inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element, const AtomicString& name, const AtomicString& value)
583{
584#if ENABLE(INSPECTOR)
585    FAST_RETURN_IF_NO_FRONTENDS(void());
586    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
587        didModifyDOMAttrImpl(instrumentingAgents, element, name, value);
588#else
589    UNUSED_PARAM(document);
590    UNUSED_PARAM(element);
591    UNUSED_PARAM(name);
592    UNUSED_PARAM(value);
593#endif
594}
595
596inline void InspectorInstrumentation::didRemoveDOMAttr(Document* document, Element* element, const AtomicString& name)
597{
598#if ENABLE(INSPECTOR)
599    FAST_RETURN_IF_NO_FRONTENDS(void());
600    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
601        didRemoveDOMAttrImpl(instrumentingAgents, element, name);
602#else
603    UNUSED_PARAM(document);
604    UNUSED_PARAM(element);
605    UNUSED_PARAM(name);
606#endif
607}
608
609inline void InspectorInstrumentation::didInvalidateStyleAttr(Document* document, Node* node)
610{
611#if ENABLE(INSPECTOR)
612    FAST_RETURN_IF_NO_FRONTENDS(void());
613    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
614        didInvalidateStyleAttrImpl(instrumentingAgents, node);
615#else
616    UNUSED_PARAM(document);
617    UNUSED_PARAM(node);
618#endif
619}
620
621inline void InspectorInstrumentation::frameWindowDiscarded(Frame* frame, DOMWindow* domWindow)
622{
623#if ENABLE(INSPECTOR)
624    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
625        frameWindowDiscardedImpl(instrumentingAgents, domWindow);
626#else
627    UNUSED_PARAM(frame);
628    UNUSED_PARAM(domWindow);
629#endif
630}
631
632inline void InspectorInstrumentation::mediaQueryResultChanged(Document* document)
633{
634#if ENABLE(INSPECTOR)
635    FAST_RETURN_IF_NO_FRONTENDS(void());
636    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
637        mediaQueryResultChangedImpl(instrumentingAgents);
638#else
639    UNUSED_PARAM(document);
640#endif
641}
642
643inline void InspectorInstrumentation::didPushShadowRoot(Element* host, ShadowRoot* root)
644{
645#if ENABLE(INSPECTOR)
646    FAST_RETURN_IF_NO_FRONTENDS(void());
647    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(&host->document()))
648        didPushShadowRootImpl(instrumentingAgents, host, root);
649#else
650    UNUSED_PARAM(host);
651    UNUSED_PARAM(root);
652#endif
653}
654
655inline void InspectorInstrumentation::willPopShadowRoot(Element* host, ShadowRoot* root)
656{
657#if ENABLE(INSPECTOR)
658    FAST_RETURN_IF_NO_FRONTENDS(void());
659    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(&host->document()))
660        willPopShadowRootImpl(instrumentingAgents, host, root);
661#else
662    UNUSED_PARAM(host);
663    UNUSED_PARAM(root);
664#endif
665}
666
667inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
668{
669#if ENABLE(INSPECTOR)
670    FAST_RETURN_IF_NO_FRONTENDS(void());
671    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
672        didCreateNamedFlowImpl(instrumentingAgents, document, namedFlow);
673#else
674    UNUSED_PARAM(document);
675    UNUSED_PARAM(namedFlow);
676#endif
677}
678
679inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
680{
681#if ENABLE(INSPECTOR)
682    FAST_RETURN_IF_NO_FRONTENDS(void());
683    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
684        willRemoveNamedFlowImpl(instrumentingAgents, document, namedFlow);
685#else
686    UNUSED_PARAM(document);
687    UNUSED_PARAM(namedFlow);
688#endif
689}
690
691inline void InspectorInstrumentation::didChangeRegionOverset(Document* document, WebKitNamedFlow* namedFlow)
692{
693#if ENABLE(INSPECTOR)
694    FAST_RETURN_IF_NO_FRONTENDS(void());
695    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
696        didChangeRegionOversetImpl(instrumentingAgents, document, namedFlow);
697#else
698    UNUSED_PARAM(document);
699    UNUSED_PARAM(namedFlow);
700#endif
701}
702
703inline void InspectorInstrumentation::didRegisterNamedFlowContentElement(Document* document, WebKitNamedFlow* namedFlow, Node* contentElement, Node* nextContentElement)
704{
705#if ENABLE(INSPECTOR)
706    FAST_RETURN_IF_NO_FRONTENDS(void());
707    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
708        didRegisterNamedFlowContentElementImpl(instrumentingAgents, document, namedFlow, contentElement, nextContentElement);
709#else
710    UNUSED_PARAM(document);
711    UNUSED_PARAM(namedFlow);
712    UNUSED_PARAM(contentElement);
713    UNUSED_PARAM(nextContentElement);
714#endif
715}
716
717inline void InspectorInstrumentation::didUnregisterNamedFlowContentElement(Document* document, WebKitNamedFlow* namedFlow, Node* contentElement)
718{
719#if ENABLE(INSPECTOR)
720    FAST_RETURN_IF_NO_FRONTENDS(void());
721    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
722        didUnregisterNamedFlowContentElementImpl(instrumentingAgents, document, namedFlow, contentElement);
723#else
724    UNUSED_PARAM(document);
725    UNUSED_PARAM(namedFlow);
726    UNUSED_PARAM(contentElement);
727#endif
728}
729
730inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const HitTestResult& result, unsigned modifierFlags)
731{
732#if ENABLE(INSPECTOR)
733    FAST_RETURN_IF_NO_FRONTENDS(void());
734    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
735        mouseDidMoveOverElementImpl(instrumentingAgents, result, modifierFlags);
736#else
737    UNUSED_PARAM(page);
738    UNUSED_PARAM(result);
739    UNUSED_PARAM(modifierFlags);
740#endif
741}
742
743inline bool InspectorInstrumentation::handleTouchEvent(Page* page, Node* node)
744{
745#if ENABLE(INSPECTOR)
746    FAST_RETURN_IF_NO_FRONTENDS(false);
747    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
748        return handleTouchEventImpl(instrumentingAgents, node);
749#else
750    UNUSED_PARAM(page);
751    UNUSED_PARAM(node);
752#endif
753    return false;
754}
755
756inline bool InspectorInstrumentation::handleMousePress(Page* page)
757{
758#if ENABLE(INSPECTOR)
759    FAST_RETURN_IF_NO_FRONTENDS(false);
760    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
761        return handleMousePressImpl(instrumentingAgents);
762#else
763    UNUSED_PARAM(page);
764#endif
765    return false;
766}
767
768inline bool InspectorInstrumentation::forcePseudoState(Element* element, CSSSelector::PseudoClassType pseudoState)
769{
770#if ENABLE(INSPECTOR)
771    FAST_RETURN_IF_NO_FRONTENDS(false);
772    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(&element->document()))
773        return forcePseudoStateImpl(instrumentingAgents, element, pseudoState);
774#else
775    UNUSED_PARAM(element);
776    UNUSED_PARAM(pseudoState);
777#endif
778    return false;
779}
780
781inline void InspectorInstrumentation::characterDataModified(Document* document, CharacterData* characterData)
782{
783#if ENABLE(INSPECTOR)
784    FAST_RETURN_IF_NO_FRONTENDS(void());
785    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
786        characterDataModifiedImpl(instrumentingAgents, characterData);
787#else
788    UNUSED_PARAM(document);
789    UNUSED_PARAM(characterData);
790#endif
791}
792
793inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url)
794{
795#if ENABLE(INSPECTOR)
796    FAST_RETURN_IF_NO_FRONTENDS(void());
797    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
798        willSendXMLHttpRequestImpl(instrumentingAgents, url);
799#else
800    UNUSED_PARAM(context);
801    UNUSED_PARAM(url);
802#endif
803}
804
805inline void InspectorInstrumentation::didScheduleResourceRequest(Document* document, const String& url)
806{
807#if ENABLE(INSPECTOR)
808    FAST_RETURN_IF_NO_FRONTENDS(void());
809    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
810        didScheduleResourceRequestImpl(instrumentingAgents, url, document->frame());
811#else
812    UNUSED_PARAM(document);
813    UNUSED_PARAM(url);
814#endif
815}
816
817inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot)
818{
819#if ENABLE(INSPECTOR)
820    FAST_RETURN_IF_NO_FRONTENDS(void());
821    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
822        didInstallTimerImpl(instrumentingAgents, timerId, timeout, singleShot, context);
823#else
824    UNUSED_PARAM(context);
825    UNUSED_PARAM(timerId);
826    UNUSED_PARAM(timeout);
827    UNUSED_PARAM(singleShot);
828#endif
829}
830
831inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* context, int timerId)
832{
833#if ENABLE(INSPECTOR)
834    FAST_RETURN_IF_NO_FRONTENDS(void());
835    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
836        didRemoveTimerImpl(instrumentingAgents, timerId, context);
837#else
838    UNUSED_PARAM(context);
839    UNUSED_PARAM(timerId);
840#endif
841}
842
843inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine)
844{
845#if ENABLE(INSPECTOR)
846    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
847    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
848        return willCallFunctionImpl(instrumentingAgents, scriptName, scriptLine, context);
849#else
850    UNUSED_PARAM(context);
851    UNUSED_PARAM(scriptName);
852    UNUSED_PARAM(scriptLine);
853#endif
854    return InspectorInstrumentationCookie();
855}
856
857
858inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie, ScriptExecutionContext* context)
859{
860#if ENABLE(INSPECTOR)
861    FAST_RETURN_IF_NO_FRONTENDS(void());
862    if (cookie.isValid())
863        didCallFunctionImpl(cookie, context);
864#else
865    UNUSED_PARAM(cookie);
866    UNUSED_PARAM(context);
867#endif
868}
869
870inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
871{
872#if ENABLE(INSPECTOR)
873    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
874    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
875        return willDispatchXHRReadyStateChangeEventImpl(instrumentingAgents, request, context);
876#else
877    UNUSED_PARAM(context);
878    UNUSED_PARAM(request);
879#endif
880    return InspectorInstrumentationCookie();
881}
882
883inline void InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie& cookie)
884{
885#if ENABLE(INSPECTOR)
886    FAST_RETURN_IF_NO_FRONTENDS(void());
887    if (cookie.isValid())
888        didDispatchXHRReadyStateChangeEventImpl(cookie);
889#else
890    UNUSED_PARAM(cookie);
891#endif
892}
893
894inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, bool hasEventListeners)
895{
896#if ENABLE(INSPECTOR)
897    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
898    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
899        return willDispatchEventImpl(instrumentingAgents, event, hasEventListeners, document);
900#else
901    UNUSED_PARAM(document);
902    UNUSED_PARAM(event);
903    UNUSED_PARAM(hasEventListeners);
904#endif
905    return InspectorInstrumentationCookie();
906}
907
908inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrumentationCookie& cookie)
909{
910#if ENABLE(INSPECTOR)
911    FAST_RETURN_IF_NO_FRONTENDS(void());
912    if (cookie.isValid())
913        didDispatchEventImpl(cookie);
914#else
915    UNUSED_PARAM(cookie);
916#endif
917}
918
919inline InspectorInstrumentationCookie InspectorInstrumentation::willHandleEvent(ScriptExecutionContext* context, Event* event)
920{
921#if ENABLE(INSPECTOR)
922    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
923    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
924        return willHandleEventImpl(instrumentingAgents, event);
925#else
926    UNUSED_PARAM(context);
927    UNUSED_PARAM(event);
928#endif
929    return InspectorInstrumentationCookie();
930}
931
932inline void InspectorInstrumentation::didHandleEvent(const InspectorInstrumentationCookie& cookie)
933{
934#if ENABLE(INSPECTOR)
935    FAST_RETURN_IF_NO_FRONTENDS(void());
936    if (cookie.isValid())
937        didHandleEventImpl(cookie);
938#else
939    UNUSED_PARAM(cookie);
940#endif
941}
942
943inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window)
944{
945#if ENABLE(INSPECTOR)
946    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
947    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
948        return willDispatchEventOnWindowImpl(instrumentingAgents, event, window);
949#else
950    UNUSED_PARAM(frame);
951    UNUSED_PARAM(event);
952    UNUSED_PARAM(window);
953#endif
954    return InspectorInstrumentationCookie();
955}
956
957inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorInstrumentationCookie& cookie)
958{
959#if ENABLE(INSPECTOR)
960    FAST_RETURN_IF_NO_FRONTENDS(void());
961    if (cookie.isValid())
962        didDispatchEventOnWindowImpl(cookie);
963#else
964    UNUSED_PARAM(cookie);
965#endif
966}
967
968inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame* frame, const String& url, int lineNumber)
969{
970#if ENABLE(INSPECTOR)
971    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
972    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
973        return willEvaluateScriptImpl(instrumentingAgents, url, lineNumber, frame);
974#else
975    UNUSED_PARAM(frame);
976    UNUSED_PARAM(url);
977    UNUSED_PARAM(lineNumber);
978#endif
979    return InspectorInstrumentationCookie();
980}
981
982inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie, Frame* frame)
983{
984#if ENABLE(INSPECTOR)
985    FAST_RETURN_IF_NO_FRONTENDS(void());
986    if (cookie.isValid())
987        didEvaluateScriptImpl(cookie, frame);
988#else
989    UNUSED_PARAM(cookie);
990    UNUSED_PARAM(frame);
991#endif
992}
993
994inline void InspectorInstrumentation::scriptsEnabled(Page* page, bool isEnabled)
995{
996#if ENABLE(INSPECTOR)
997    FAST_RETURN_IF_NO_FRONTENDS(void());
998    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
999        return scriptsEnabledImpl(instrumentingAgents, isEnabled);
1000#else
1001    UNUSED_PARAM(page);
1002    UNUSED_PARAM(isEnabled);
1003#endif
1004}
1005
1006inline void InspectorInstrumentation::didCreateIsolatedContext(Frame* frame, JSC::ExecState* scriptState, SecurityOrigin* origin)
1007{
1008#if ENABLE(INSPECTOR)
1009    FAST_RETURN_IF_NO_FRONTENDS(void());
1010    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1011        return didCreateIsolatedContextImpl(instrumentingAgents, frame, scriptState, origin);
1012#else
1013    UNUSED_PARAM(frame);
1014    UNUSED_PARAM(scriptState);
1015    UNUSED_PARAM(origin);
1016#endif
1017}
1018
1019inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId)
1020{
1021#if ENABLE(INSPECTOR)
1022    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1023    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1024        return willFireTimerImpl(instrumentingAgents, timerId, context);
1025#else
1026    UNUSED_PARAM(context);
1027    UNUSED_PARAM(timerId);
1028#endif
1029    return InspectorInstrumentationCookie();
1030}
1031
1032inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentationCookie& cookie)
1033{
1034#if ENABLE(INSPECTOR)
1035    FAST_RETURN_IF_NO_FRONTENDS(void());
1036    if (cookie.isValid())
1037        didFireTimerImpl(cookie);
1038#else
1039    UNUSED_PARAM(cookie);
1040#endif
1041}
1042
1043inline void InspectorInstrumentation::didInvalidateLayout(Frame* frame)
1044{
1045#if ENABLE(INSPECTOR)
1046    FAST_RETURN_IF_NO_FRONTENDS(void());
1047    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1048        didInvalidateLayoutImpl(instrumentingAgents, frame);
1049#else
1050    UNUSED_PARAM(frame);
1051#endif
1052}
1053
1054inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame)
1055{
1056#if ENABLE(INSPECTOR)
1057    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1058    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1059        return willLayoutImpl(instrumentingAgents, frame);
1060#else
1061    UNUSED_PARAM(frame);
1062#endif
1063    return InspectorInstrumentationCookie();
1064}
1065
1066inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie, RenderObject* root)
1067{
1068#if ENABLE(INSPECTOR)
1069    FAST_RETURN_IF_NO_FRONTENDS(void());
1070    if (cookie.isValid())
1071        didLayoutImpl(cookie, root);
1072#else
1073    UNUSED_PARAM(cookie);
1074    UNUSED_PARAM(root);
1075#endif
1076}
1077
1078inline void InspectorInstrumentation::didScroll(Page* page)
1079{
1080#if ENABLE(INSPECTOR)
1081    FAST_RETURN_IF_NO_FRONTENDS(void());
1082    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1083        didScrollImpl(instrumentingAgents);
1084#else
1085    UNUSED_PARAM(page);
1086#endif
1087}
1088
1089inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
1090{
1091#if ENABLE(INSPECTOR)
1092    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1093    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1094        return willDispatchXHRLoadEventImpl(instrumentingAgents, request, context);
1095#else
1096    UNUSED_PARAM(context);
1097    UNUSED_PARAM(request);
1098#endif
1099    return InspectorInstrumentationCookie();
1100}
1101
1102inline void InspectorInstrumentation::didDispatchXHRLoadEvent(const InspectorInstrumentationCookie& cookie)
1103{
1104#if ENABLE(INSPECTOR)
1105    FAST_RETURN_IF_NO_FRONTENDS(void());
1106    if (cookie.isValid())
1107        didDispatchXHRLoadEventImpl(cookie);
1108#else
1109    UNUSED_PARAM(cookie);
1110#endif
1111}
1112
1113inline void InspectorInstrumentation::willPaint(RenderObject* renderer)
1114{
1115#if ENABLE(INSPECTOR)
1116    FAST_RETURN_IF_NO_FRONTENDS(void());
1117    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer))
1118        return willPaintImpl(instrumentingAgents, renderer);
1119#else
1120    UNUSED_PARAM(renderer);
1121#endif
1122}
1123
1124inline void InspectorInstrumentation::didPaint(RenderObject* renderer, GraphicsContext* context, const LayoutRect& rect)
1125{
1126#if ENABLE(INSPECTOR)
1127    FAST_RETURN_IF_NO_FRONTENDS(void());
1128    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer))
1129        didPaintImpl(instrumentingAgents, renderer, context, rect);
1130#else
1131    UNUSED_PARAM(renderer);
1132    UNUSED_PARAM(context);
1133    UNUSED_PARAM(rect);
1134#endif
1135}
1136
1137inline void InspectorInstrumentation::willScrollLayer(Frame* frame)
1138{
1139#if ENABLE(INSPECTOR)
1140    FAST_RETURN_IF_NO_FRONTENDS(void());
1141    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1142        willScrollLayerImpl(instrumentingAgents, frame);
1143#else
1144    UNUSED_PARAM(frame);
1145#endif
1146}
1147
1148inline void InspectorInstrumentation::didScrollLayer(Frame* frame)
1149{
1150#if ENABLE(INSPECTOR)
1151    FAST_RETURN_IF_NO_FRONTENDS(void());
1152    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1153        didScrollLayerImpl(instrumentingAgents);
1154#else
1155    UNUSED_PARAM(frame);
1156#endif
1157}
1158
1159inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document)
1160{
1161#if ENABLE(INSPECTOR)
1162    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1163    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1164        return willRecalculateStyleImpl(instrumentingAgents, document->frame());
1165#else
1166    UNUSED_PARAM(document);
1167#endif
1168    return InspectorInstrumentationCookie();
1169}
1170
1171inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie)
1172{
1173#if ENABLE(INSPECTOR)
1174    FAST_RETURN_IF_NO_FRONTENDS(void());
1175    if (cookie.isValid())
1176        didRecalculateStyleImpl(cookie);
1177#else
1178    UNUSED_PARAM(cookie);
1179#endif
1180}
1181
1182inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document* document)
1183{
1184#if ENABLE(INSPECTOR)
1185    FAST_RETURN_IF_NO_FRONTENDS(void());
1186    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1187        didScheduleStyleRecalculationImpl(instrumentingAgents, document);
1188#else
1189    UNUSED_PARAM(document);
1190#endif
1191}
1192
1193inline void InspectorInstrumentation::applyEmulatedMedia(Frame* frame, String* media)
1194{
1195#if ENABLE(INSPECTOR)
1196    FAST_RETURN_IF_NO_FRONTENDS(void());
1197    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1198        applyEmulatedMediaImpl(instrumentingAgents, media);
1199#else
1200    UNUSED_PARAM(frame);
1201    UNUSED_PARAM(media);
1202#endif
1203}
1204
1205inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
1206{
1207#if ENABLE(INSPECTOR)
1208    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1209        willSendRequestImpl(instrumentingAgents, identifier, loader, request, redirectResponse);
1210#else
1211    UNUSED_PARAM(frame);
1212    UNUSED_PARAM(identifier);
1213    UNUSED_PARAM(loader);
1214    UNUSED_PARAM(request);
1215    UNUSED_PARAM(redirectResponse);
1216#endif
1217}
1218
1219inline void InspectorInstrumentation::continueAfterPingLoader(Frame& frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
1220{
1221#if ENABLE(INSPECTOR)
1222    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1223        InspectorInstrumentation::continueAfterPingLoaderImpl(instrumentingAgents, identifier, loader, request, response);
1224#else
1225    UNUSED_PARAM(frame);
1226    UNUSED_PARAM(identifier);
1227    UNUSED_PARAM(loader);
1228    UNUSED_PARAM(request);
1229    UNUSED_PARAM(response);
1230#endif
1231}
1232
1233inline void InspectorInstrumentation::markResourceAsCached(Page* page, unsigned long identifier)
1234{
1235#if ENABLE(INSPECTOR)
1236    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1237        markResourceAsCachedImpl(instrumentingAgents, identifier);
1238#else
1239    UNUSED_PARAM(page);
1240    UNUSED_PARAM(identifier);
1241#endif
1242}
1243
1244inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, CachedResource* resource)
1245{
1246#if ENABLE(INSPECTOR)
1247    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1248        didLoadResourceFromMemoryCacheImpl(instrumentingAgents, loader, resource);
1249#else
1250    UNUSED_PARAM(page);
1251    UNUSED_PARAM(loader);
1252    UNUSED_PARAM(resource);
1253#endif
1254}
1255
1256inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier, int length)
1257{
1258#if ENABLE(INSPECTOR)
1259    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1260    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1261        return willReceiveResourceDataImpl(instrumentingAgents, identifier, frame, length);
1262#else
1263    UNUSED_PARAM(frame);
1264    UNUSED_PARAM(identifier);
1265    UNUSED_PARAM(length);
1266#endif
1267    return InspectorInstrumentationCookie();
1268}
1269
1270inline void InspectorInstrumentation::didReceiveResourceData(const InspectorInstrumentationCookie& cookie)
1271{
1272#if ENABLE(INSPECTOR)
1273    FAST_RETURN_IF_NO_FRONTENDS(void());
1274    if (cookie.isValid())
1275        didReceiveResourceDataImpl(cookie);
1276#else
1277    UNUSED_PARAM(cookie);
1278#endif
1279}
1280
1281inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame, unsigned long identifier, const ResourceResponse& response)
1282{
1283#if ENABLE(INSPECTOR)
1284    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1285        return willReceiveResourceResponseImpl(instrumentingAgents, identifier, response, frame);
1286#else
1287    UNUSED_PARAM(frame);
1288    UNUSED_PARAM(identifier);
1289    UNUSED_PARAM(response);
1290#endif
1291    return InspectorInstrumentationCookie();
1292}
1293
1294inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
1295{
1296#if ENABLE(INSPECTOR)
1297    // Call this unconditionally so that we're able to log to console with no front-end attached.
1298    if (cookie.isValid())
1299        didReceiveResourceResponseImpl(cookie, identifier, loader, response, resourceLoader);
1300#else
1301    UNUSED_PARAM(cookie);
1302    UNUSED_PARAM(identifier);
1303    UNUSED_PARAM(loader);
1304    UNUSED_PARAM(response);
1305    UNUSED_PARAM(resourceLoader);
1306#endif
1307}
1308
1309inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1310{
1311#if ENABLE(INSPECTOR)
1312    FAST_RETURN_IF_NO_FRONTENDS(void());
1313    InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(frame, loader, identifier, r);
1314#else
1315    UNUSED_PARAM(frame);
1316    UNUSED_PARAM(loader);
1317    UNUSED_PARAM(identifier);
1318    UNUSED_PARAM(r);
1319#endif
1320}
1321
1322inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1323{
1324#if ENABLE(INSPECTOR)
1325    FAST_RETURN_IF_NO_FRONTENDS(void());
1326    InspectorInstrumentation::continueWithPolicyDownloadImpl(frame, loader, identifier, r);
1327#else
1328    UNUSED_PARAM(frame);
1329    UNUSED_PARAM(loader);
1330    UNUSED_PARAM(identifier);
1331    UNUSED_PARAM(r);
1332#endif
1333}
1334
1335inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1336{
1337#if ENABLE(INSPECTOR)
1338    FAST_RETURN_IF_NO_FRONTENDS(void());
1339    InspectorInstrumentation::continueWithPolicyIgnoreImpl(frame, loader, identifier, r);
1340#else
1341    UNUSED_PARAM(frame);
1342    UNUSED_PARAM(loader);
1343    UNUSED_PARAM(identifier);
1344    UNUSED_PARAM(r);
1345#endif
1346}
1347
1348inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
1349{
1350#if ENABLE(INSPECTOR)
1351    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1352        didReceiveDataImpl(instrumentingAgents, identifier, data, dataLength, encodedDataLength);
1353#else
1354    UNUSED_PARAM(frame);
1355    UNUSED_PARAM(identifier);
1356    UNUSED_PARAM(data);
1357    UNUSED_PARAM(dataLength);
1358    UNUSED_PARAM(encodedDataLength);
1359#endif
1360}
1361
1362inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, double finishTime)
1363{
1364#if ENABLE(INSPECTOR)
1365    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1366        didFinishLoadingImpl(instrumentingAgents, identifier, loader, finishTime);
1367#else
1368    UNUSED_PARAM(frame);
1369    UNUSED_PARAM(loader);
1370    UNUSED_PARAM(identifier);
1371    UNUSED_PARAM(finishTime);
1372#endif
1373}
1374
1375inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
1376{
1377#if ENABLE(INSPECTOR)
1378    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1379        didFailLoadingImpl(instrumentingAgents, identifier, loader, error);
1380#else
1381    UNUSED_PARAM(frame);
1382    UNUSED_PARAM(loader);
1383    UNUSED_PARAM(identifier);
1384    UNUSED_PARAM(error);
1385#endif
1386}
1387
1388inline void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext* context, unsigned long identifier, ThreadableLoaderClient* client)
1389{
1390#if ENABLE(INSPECTOR)
1391    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1392        documentThreadableLoaderStartedLoadingForClientImpl(instrumentingAgents, identifier, client);
1393#else
1394    UNUSED_PARAM(context);
1395    UNUSED_PARAM(identifier);
1396    UNUSED_PARAM(client);
1397#endif
1398}
1399
1400inline void InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* context, ThreadableLoaderClient* client, const String& method, const URL& url, bool async, PassRefPtr<FormData> formData, const HTTPHeaderMap& headers, bool includeCredentials)
1401{
1402#if ENABLE(INSPECTOR)
1403    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1404        willLoadXHRImpl(instrumentingAgents, client, method, url, async, formData, headers, includeCredentials);
1405#else
1406    UNUSED_PARAM(context);
1407    UNUSED_PARAM(client);
1408    UNUSED_PARAM(method);
1409    UNUSED_PARAM(url);
1410    UNUSED_PARAM(async);
1411    UNUSED_PARAM(formData);
1412    UNUSED_PARAM(headers);
1413    UNUSED_PARAM(includeCredentials);
1414#endif
1415}
1416
1417inline void InspectorInstrumentation::didFailXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client)
1418{
1419#if ENABLE(INSPECTOR)
1420    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1421        didFailXHRLoadingImpl(instrumentingAgents, client);
1422#else
1423    UNUSED_PARAM(context);
1424    UNUSED_PARAM(client);
1425#endif
1426}
1427
1428
1429inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
1430{
1431#if ENABLE(INSPECTOR)
1432    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1433        didFinishXHRLoadingImpl(instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber, sendColumnNumber);
1434#else
1435    UNUSED_PARAM(context);
1436    UNUSED_PARAM(client);
1437    UNUSED_PARAM(identifier);
1438    UNUSED_PARAM(sourceString);
1439    UNUSED_PARAM(url);
1440    UNUSED_PARAM(sendURL);
1441    UNUSED_PARAM(sendLineNumber);
1442    UNUSED_PARAM(sendColumnNumber);
1443#endif
1444}
1445
1446inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionContext* context, unsigned long identifier)
1447{
1448#if ENABLE(INSPECTOR)
1449    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1450        didReceiveXHRResponseImpl(instrumentingAgents, identifier);
1451#else
1452    UNUSED_PARAM(context);
1453    UNUSED_PARAM(identifier);
1454#endif
1455}
1456
1457inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context)
1458{
1459#if ENABLE(INSPECTOR)
1460    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1461        willLoadXHRSynchronouslyImpl(instrumentingAgents);
1462#else
1463    UNUSED_PARAM(context);
1464#endif
1465}
1466
1467inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context)
1468{
1469#if ENABLE(INSPECTOR)
1470    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1471        didLoadXHRSynchronouslyImpl(instrumentingAgents);
1472#else
1473    UNUSED_PARAM(context);
1474#endif
1475}
1476
1477inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString)
1478{
1479#if ENABLE(INSPECTOR)
1480    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1481        scriptImportedImpl(instrumentingAgents, identifier, sourceString);
1482#else
1483    UNUSED_PARAM(context);
1484    UNUSED_PARAM(identifier);
1485    UNUSED_PARAM(sourceString);
1486#endif
1487}
1488
1489inline void InspectorInstrumentation::scriptExecutionBlockedByCSP(ScriptExecutionContext* context, const String& directiveText)
1490{
1491#if ENABLE(INSPECTOR)
1492    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1493        scriptExecutionBlockedByCSPImpl(instrumentingAgents, directiveText);
1494#else
1495    UNUSED_PARAM(context);
1496    UNUSED_PARAM(directiveText);
1497#endif
1498}
1499
1500inline void InspectorInstrumentation::didReceiveScriptResponse(ScriptExecutionContext* context, unsigned long identifier)
1501{
1502#if ENABLE(INSPECTOR)
1503    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1504        didReceiveScriptResponseImpl(instrumentingAgents, identifier);
1505#else
1506    UNUSED_PARAM(context);
1507    UNUSED_PARAM(identifier);
1508#endif
1509}
1510
1511inline void InspectorInstrumentation::domContentLoadedEventFired(Frame* frame)
1512{
1513#if ENABLE(INSPECTOR)
1514    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1515        domContentLoadedEventFiredImpl(instrumentingAgents, frame);
1516#else
1517    UNUSED_PARAM(frame);
1518#endif
1519}
1520
1521inline void InspectorInstrumentation::loadEventFired(Frame* frame)
1522{
1523#if ENABLE(INSPECTOR)
1524    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1525        loadEventFiredImpl(instrumentingAgents, frame);
1526#else
1527    UNUSED_PARAM(frame);
1528#endif
1529}
1530
1531inline void InspectorInstrumentation::frameDetachedFromParent(Frame* frame)
1532{
1533#if ENABLE(INSPECTOR)
1534    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1535        frameDetachedFromParentImpl(instrumentingAgents, frame);
1536#else
1537    UNUSED_PARAM(frame);
1538#endif
1539}
1540
1541inline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader)
1542{
1543#if ENABLE(INSPECTOR)
1544    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1545        didCommitLoadImpl(instrumentingAgents, frame->page(), loader);
1546#else
1547    UNUSED_PARAM(frame);
1548    UNUSED_PARAM(loader);
1549#endif
1550}
1551
1552inline void InspectorInstrumentation::frameDocumentUpdated(Frame* frame)
1553{
1554#if ENABLE(INSPECTOR)
1555    FAST_RETURN_IF_NO_FRONTENDS(void());
1556    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1557        frameDocumentUpdatedImpl(instrumentingAgents, frame);
1558#else
1559    UNUSED_PARAM(frame);
1560#endif
1561}
1562
1563inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame* frame, DocumentLoader* loader)
1564{
1565#if ENABLE(INSPECTOR)
1566    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1567        loaderDetachedFromFrameImpl(instrumentingAgents, loader);
1568#else
1569    UNUSED_PARAM(frame);
1570    UNUSED_PARAM(loader);
1571#endif
1572}
1573
1574inline void InspectorInstrumentation::frameStartedLoading(Frame& frame)
1575{
1576#if ENABLE(INSPECTOR)
1577    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1578        frameStartedLoadingImpl(*instrumentingAgents, frame);
1579#else
1580    UNUSED_PARAM(frame);
1581#endif
1582}
1583
1584inline void InspectorInstrumentation::frameStoppedLoading(Frame& frame)
1585{
1586#if ENABLE(INSPECTOR)
1587    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1588        frameStoppedLoadingImpl(*instrumentingAgents, frame);
1589#else
1590    UNUSED_PARAM(frame);
1591#endif
1592}
1593
1594inline void InspectorInstrumentation::frameScheduledNavigation(Frame& frame, double delay)
1595{
1596#if ENABLE(INSPECTOR)
1597    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1598        frameScheduledNavigationImpl(*instrumentingAgents, frame, delay);
1599#else
1600    UNUSED_PARAM(frame);
1601    UNUSED_PARAM(delay);
1602#endif
1603}
1604
1605inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& frame)
1606{
1607#if ENABLE(INSPECTOR)
1608    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1609        frameClearedScheduledNavigationImpl(*instrumentingAgents, frame);
1610#else
1611    UNUSED_PARAM(frame);
1612#endif
1613}
1614
1615inline InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialog(Page* page, const String& message)
1616{
1617#if ENABLE(INSPECTOR)
1618    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1619    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1620        return willRunJavaScriptDialogImpl(instrumentingAgents, message);
1621#else
1622    UNUSED_PARAM(page);
1623    UNUSED_PARAM(message);
1624#endif
1625    return InspectorInstrumentationCookie();
1626}
1627
1628inline void InspectorInstrumentation::didRunJavaScriptDialog(const InspectorInstrumentationCookie& cookie)
1629{
1630#if ENABLE(INSPECTOR)
1631    FAST_RETURN_IF_NO_FRONTENDS(void());
1632    if (cookie.isValid())
1633        didRunJavaScriptDialogImpl(cookie);
1634#else
1635    UNUSED_PARAM(cookie);
1636#endif
1637}
1638
1639inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource* cachedResource)
1640{
1641#if ENABLE(INSPECTOR)
1642    FAST_RETURN_IF_NO_FRONTENDS(void());
1643    willDestroyCachedResourceImpl(cachedResource);
1644#else
1645    UNUSED_PARAM(cachedResource);
1646#endif
1647}
1648
1649inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned startLine)
1650{
1651#if ENABLE(INSPECTOR)
1652    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1653    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1654        return willWriteHTMLImpl(instrumentingAgents, startLine, document->frame());
1655#else
1656    UNUSED_PARAM(document);
1657    UNUSED_PARAM(startLine);
1658#endif
1659    return InspectorInstrumentationCookie();
1660}
1661
1662inline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentationCookie& cookie, unsigned endLine)
1663{
1664#if ENABLE(INSPECTOR)
1665    FAST_RETURN_IF_NO_FRONTENDS(void());
1666    if (cookie.isValid())
1667        didWriteHTMLImpl(cookie, endLine);
1668#else
1669    UNUSED_PARAM(cookie);
1670    UNUSED_PARAM(endLine);
1671#endif
1672}
1673
1674inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
1675{
1676#if ENABLE(INSPECTOR)
1677    FAST_RETURN_IF_NO_FRONTENDS(void());
1678    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1679        didDispatchDOMStorageEventImpl(instrumentingAgents, key, oldValue, newValue, storageType, securityOrigin, page);
1680#else
1681    UNUSED_PARAM(key);
1682    UNUSED_PARAM(oldValue);
1683    UNUSED_PARAM(newValue);
1684    UNUSED_PARAM(storageType);
1685    UNUSED_PARAM(securityOrigin);
1686    UNUSED_PARAM(page);
1687#endif // ENABLE(INSPECTOR)
1688}
1689
1690inline bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext* context)
1691{
1692#if ENABLE(INSPECTOR)
1693    FAST_RETURN_IF_NO_FRONTENDS(false);
1694    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1695        return shouldPauseDedicatedWorkerOnStartImpl(instrumentingAgents);
1696#else
1697    UNUSED_PARAM(context);
1698#endif
1699    return false;
1700}
1701
1702inline void InspectorInstrumentation::didStartWorkerGlobalScope(ScriptExecutionContext* context, WorkerGlobalScopeProxy* proxy, const URL& url)
1703{
1704#if ENABLE(INSPECTOR)
1705    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1706        didStartWorkerGlobalScopeImpl(instrumentingAgents, proxy, url);
1707#else
1708    UNUSED_PARAM(context);
1709    UNUSED_PARAM(proxy);
1710    UNUSED_PARAM(url);
1711#endif
1712}
1713
1714inline void InspectorInstrumentation::workerGlobalScopeTerminated(ScriptExecutionContext* context, WorkerGlobalScopeProxy* proxy)
1715{
1716#if ENABLE(INSPECTOR)
1717    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1718        workerGlobalScopeTerminatedImpl(instrumentingAgents, proxy);
1719#else
1720    UNUSED_PARAM(context);
1721    UNUSED_PARAM(proxy);
1722#endif
1723}
1724
1725#if ENABLE(WEB_SOCKETS)
1726inline void InspectorInstrumentation::didCreateWebSocket(Document* document, unsigned long identifier, const URL& requestURL, const URL& documentURL, const String& protocol)
1727{
1728#if ENABLE(INSPECTOR)
1729    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1730        didCreateWebSocketImpl(instrumentingAgents, identifier, requestURL, documentURL, protocol, document);
1731#else
1732    UNUSED_PARAM(document);
1733    UNUSED_PARAM(identifier);
1734    UNUSED_PARAM(requestURL);
1735    UNUSED_PARAM(documentURL);
1736    UNUSED_PARAM(protocol);
1737#endif
1738}
1739
1740inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(Document* document, unsigned long identifier, const ResourceRequest& request)
1741{
1742#if ENABLE(INSPECTOR)
1743    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1744        willSendWebSocketHandshakeRequestImpl(instrumentingAgents, identifier, request, document);
1745#else
1746    UNUSED_PARAM(document);
1747    UNUSED_PARAM(identifier);
1748    UNUSED_PARAM(request);
1749#endif
1750}
1751
1752inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(Document* document, unsigned long identifier, const ResourceResponse& response)
1753{
1754#if ENABLE(INSPECTOR)
1755    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1756        didReceiveWebSocketHandshakeResponseImpl(instrumentingAgents, identifier, response, document);
1757#else
1758    UNUSED_PARAM(document);
1759    UNUSED_PARAM(identifier);
1760    UNUSED_PARAM(response);
1761#endif
1762}
1763
1764inline void InspectorInstrumentation::didCloseWebSocket(Document* document, unsigned long identifier)
1765{
1766#if ENABLE(INSPECTOR)
1767    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1768        didCloseWebSocketImpl(instrumentingAgents, identifier, document);
1769#else
1770    UNUSED_PARAM(document);
1771    UNUSED_PARAM(identifier);
1772#endif
1773}
1774inline void InspectorInstrumentation::didReceiveWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1775{
1776#if ENABLE(INSPECTOR)
1777    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1778        didReceiveWebSocketFrameImpl(instrumentingAgents, identifier, frame);
1779#else
1780    UNUSED_PARAM(document);
1781    UNUSED_PARAM(identifier);
1782    UNUSED_PARAM(frame);
1783#endif
1784}
1785inline void InspectorInstrumentation::didReceiveWebSocketFrameError(Document* document, unsigned long identifier, const String& errorMessage)
1786{
1787#if ENABLE(INSPECTOR)
1788    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1789        didReceiveWebSocketFrameErrorImpl(instrumentingAgents, identifier, errorMessage);
1790#else
1791    UNUSED_PARAM(document);
1792    UNUSED_PARAM(identifier);
1793    UNUSED_PARAM(errorMessage);
1794#endif
1795}
1796inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1797{
1798#if ENABLE(INSPECTOR)
1799    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1800        didSendWebSocketFrameImpl(instrumentingAgents, identifier, frame);
1801#else
1802    UNUSED_PARAM(document);
1803    UNUSED_PARAM(identifier);
1804    UNUSED_PARAM(frame);
1805#endif
1806}
1807#endif
1808
1809#if ENABLE(WEB_REPLAY)
1810inline void InspectorInstrumentation::sessionCreated(Page* page, PassRefPtr<ReplaySession> session)
1811{
1812#if ENABLE(INSPECTOR)
1813    FAST_RETURN_IF_NO_FRONTENDS(void());
1814    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1815        sessionCreatedImpl(instrumentingAgents, session);
1816#else
1817    UNUSED_PARAM(page);
1818    UNUSED_PARAM(session);
1819#endif
1820}
1821
1822inline void InspectorInstrumentation::sessionLoaded(Page* page, PassRefPtr<ReplaySession> session)
1823{
1824#if ENABLE(INSPECTOR)
1825    FAST_RETURN_IF_NO_FRONTENDS(void());
1826    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1827        sessionLoadedImpl(instrumentingAgents, session);
1828#else
1829    UNUSED_PARAM(page);
1830    UNUSED_PARAM(session);
1831#endif
1832}
1833
1834inline void InspectorInstrumentation::sessionModified(Page* page, PassRefPtr<ReplaySession> session)
1835{
1836#if ENABLE(INSPECTOR)
1837    FAST_RETURN_IF_NO_FRONTENDS(void());
1838    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1839        sessionModifiedImpl(instrumentingAgents, session);
1840#else
1841    UNUSED_PARAM(page);
1842    UNUSED_PARAM(session);
1843#endif
1844}
1845
1846inline void InspectorInstrumentation::segmentCreated(Page* page, PassRefPtr<ReplaySessionSegment> segment)
1847{
1848#if ENABLE(INSPECTOR)
1849    FAST_RETURN_IF_NO_FRONTENDS(void());
1850    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1851        segmentCreatedImpl(instrumentingAgents, segment);
1852#else
1853    UNUSED_PARAM(page);
1854    UNUSED_PARAM(segment);
1855#endif
1856}
1857
1858inline void InspectorInstrumentation::segmentCompleted(Page* page, PassRefPtr<ReplaySessionSegment> segment)
1859{
1860#if ENABLE(INSPECTOR)
1861    FAST_RETURN_IF_NO_FRONTENDS(void());
1862    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1863        segmentCompletedImpl(instrumentingAgents, segment);
1864#else
1865    UNUSED_PARAM(page);
1866    UNUSED_PARAM(segment);
1867#endif
1868}
1869
1870inline void InspectorInstrumentation::segmentLoaded(Page* page, PassRefPtr<ReplaySessionSegment> segment)
1871{
1872#if ENABLE(INSPECTOR)
1873    FAST_RETURN_IF_NO_FRONTENDS(void());
1874    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1875        segmentLoadedImpl(instrumentingAgents, segment);
1876#else
1877    UNUSED_PARAM(page);
1878    UNUSED_PARAM(segment);
1879#endif
1880}
1881
1882inline void InspectorInstrumentation::segmentUnloaded(Page* page)
1883{
1884#if ENABLE(INSPECTOR)
1885    FAST_RETURN_IF_NO_FRONTENDS(void());
1886    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1887        segmentUnloadedImpl(instrumentingAgents);
1888#else
1889    UNUSED_PARAM(page);
1890#endif
1891}
1892
1893inline void InspectorInstrumentation::captureStarted(Page* page)
1894{
1895#if ENABLE(INSPECTOR)
1896    FAST_RETURN_IF_NO_FRONTENDS(void());
1897    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1898        captureStartedImpl(instrumentingAgents);
1899#else
1900    UNUSED_PARAM(page);
1901#endif
1902}
1903
1904inline void InspectorInstrumentation::captureStopped(Page* page)
1905{
1906#if ENABLE(INSPECTOR)
1907    FAST_RETURN_IF_NO_FRONTENDS(void());
1908    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1909        captureStoppedImpl(instrumentingAgents);
1910#else
1911    UNUSED_PARAM(page);
1912#endif
1913}
1914
1915inline void InspectorInstrumentation::playbackStarted(Page* page)
1916{
1917#if ENABLE(INSPECTOR)
1918    FAST_RETURN_IF_NO_FRONTENDS(void());
1919    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1920        playbackStartedImpl(instrumentingAgents);
1921#else
1922    UNUSED_PARAM(page);
1923#endif
1924}
1925
1926inline void InspectorInstrumentation::playbackPaused(Page* page, const ReplayPosition& position)
1927{
1928#if ENABLE(INSPECTOR)
1929    FAST_RETURN_IF_NO_FRONTENDS(void());
1930    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1931        playbackPausedImpl(instrumentingAgents, position);
1932#else
1933    UNUSED_PARAM(page);
1934    UNUSED_PARAM(position);
1935#endif
1936}
1937
1938inline void InspectorInstrumentation::playbackFinished(Page* page)
1939{
1940#if ENABLE(INSPECTOR)
1941    FAST_RETURN_IF_NO_FRONTENDS(void());
1942    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1943        playbackFinishedImpl(instrumentingAgents);
1944#else
1945    UNUSED_PARAM(page);
1946#endif
1947}
1948
1949inline void InspectorInstrumentation::playbackHitPosition(Page* page, const ReplayPosition& position)
1950{
1951#if ENABLE(INSPECTOR)
1952    FAST_RETURN_IF_NO_FRONTENDS(void());
1953    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1954        playbackHitPositionImpl(instrumentingAgents, position);
1955#else
1956    UNUSED_PARAM(page);
1957    UNUSED_PARAM(position);
1958#endif
1959}
1960#endif // ENABLE(WEB_REPLAY)
1961
1962inline void InspectorInstrumentation::networkStateChanged(Page* page)
1963{
1964#if ENABLE(INSPECTOR)
1965    FAST_RETURN_IF_NO_FRONTENDS(void());
1966    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1967        networkStateChangedImpl(instrumentingAgents);
1968#else
1969    UNUSED_PARAM(page);
1970#endif
1971}
1972
1973inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
1974{
1975#if ENABLE(INSPECTOR)
1976    FAST_RETURN_IF_NO_FRONTENDS(void());
1977    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1978        updateApplicationCacheStatusImpl(instrumentingAgents, frame);
1979#else
1980    UNUSED_PARAM(frame);
1981#endif
1982}
1983
1984inline void InspectorInstrumentation::didRequestAnimationFrame(Document* document, int callbackId)
1985{
1986#if ENABLE(INSPECTOR)
1987    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1988        didRequestAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
1989#else
1990    UNUSED_PARAM(document);
1991    UNUSED_PARAM(callbackId);
1992#endif
1993}
1994
1995inline void InspectorInstrumentation::didCancelAnimationFrame(Document* document, int callbackId)
1996{
1997#if ENABLE(INSPECTOR)
1998    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1999        didCancelAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
2000#else
2001    UNUSED_PARAM(document);
2002    UNUSED_PARAM(callbackId);
2003#endif
2004}
2005
2006inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrame(Document* document, int callbackId)
2007{
2008#if ENABLE(INSPECTOR)
2009    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
2010        return willFireAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
2011#else
2012    UNUSED_PARAM(document);
2013    UNUSED_PARAM(callbackId);
2014#endif
2015    return InspectorInstrumentationCookie();
2016}
2017
2018inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstrumentationCookie& cookie)
2019{
2020#if ENABLE(INSPECTOR)
2021    FAST_RETURN_IF_NO_FRONTENDS(void());
2022    if (cookie.isValid())
2023        didFireAnimationFrameImpl(cookie);
2024#else
2025    UNUSED_PARAM(cookie);
2026#endif
2027}
2028
2029inline void InspectorInstrumentation::layerTreeDidChange(Page* page)
2030{
2031#if ENABLE(INSPECTOR)
2032    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2033        layerTreeDidChangeImpl(instrumentingAgents);
2034#else
2035    UNUSED_PARAM(page);
2036#endif
2037}
2038
2039inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const RenderLayer* renderLayer)
2040{
2041#if ENABLE(INSPECTOR)
2042    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2043        renderLayerDestroyedImpl(instrumentingAgents, renderLayer);
2044#else
2045    UNUSED_PARAM(page);
2046    UNUSED_PARAM(renderLayer);
2047#endif
2048}
2049
2050inline void InspectorInstrumentation::pseudoElementDestroyed(Page* page, PseudoElement* pseudoElement)
2051{
2052#if ENABLE(INSPECTOR)
2053    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2054        pseudoElementDestroyedImpl(instrumentingAgents, pseudoElement);
2055#else
2056    UNUSED_PARAM(page);
2057    UNUSED_PARAM(pseudoElement);
2058#endif
2059}
2060
2061#if ENABLE(INSPECTOR)
2062inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context)
2063{
2064    if (!context)
2065        return nullptr;
2066    if (context->isDocument())
2067        return instrumentingAgentsForPage(toDocument(context)->page());
2068    return instrumentingAgentsForNonDocumentContext(context);
2069}
2070
2071inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame)
2072{
2073    if (frame)
2074        return instrumentingAgentsForPage(frame->page());
2075    return nullptr;
2076}
2077
2078inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document* document)
2079{
2080    if (document) {
2081        Page* page = document->page();
2082#if ENABLE(TEMPLATE_ELEMENT)
2083        if (!page && document->templateDocumentHost())
2084            page = document->templateDocumentHost()->page();
2085#endif
2086        return instrumentingAgentsForPage(page);
2087    }
2088    return nullptr;
2089}
2090#endif
2091
2092} // namespace WebCore
2093
2094#endif // !defined(InspectorInstrumentation_h)
2095