Have is<>(T*) function do a null check on the pointer argument
[WebKit-https.git] / Source / WebCore / inspector / InspectorInstrumentation.h
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
55 namespace Deprecated {
56 class ScriptObject;
57 }
58
59 namespace Inspector {
60 class ScriptArguments;
61 class ScriptCallStack;
62 }
63
64 namespace JSC {
65 class Profile;
66 }
67
68 namespace WebCore {
69
70 class CSSRule;
71 class CachedResource;
72 class CharacterData;
73 class DOMWindow;
74 class DOMWrapperWorld;
75 class Database;
76 class Document;
77 class Element;
78 class DocumentLoader;
79 class DocumentStyleSheetCollection;
80 class GraphicsContext;
81 class HTTPHeaderMap;
82 class InspectorCSSAgent;
83 class InspectorCSSOMWrappers;
84 class InspectorInstrumentation;
85 class InspectorTimelineAgent;
86 class InstrumentingAgents;
87 class URL;
88 class Node;
89 class PseudoElement;
90 class RenderLayer;
91 class RenderLayerBacking;
92 class RenderObject;
93 class ResourceRequest;
94 class ResourceResponse;
95 class ScriptExecutionContext;
96 class SecurityOrigin;
97 class ShadowRoot;
98 class StorageArea;
99 class StyleResolver;
100 class StyleRule;
101 class ThreadableLoaderClient;
102 class WorkerGlobalScope;
103 class WorkerGlobalScopeProxy;
104 class XMLHttpRequest;
105
106 struct ReplayPosition;
107
108 #define FAST_RETURN_IF_NO_FRONTENDS(value) if (LIKELY(!hasFrontends())) return value;
109
110 class InspectorInstrumentation {
111 public:
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*, 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
308 private:
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*, 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     WEBCORE_EXPORT 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     WEBCORE_EXPORT static int s_frontendCounter;
494 #endif
495 };
496
497 inline 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
508 inline 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
520 inline 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
532 inline 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
544 inline 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
556 inline 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
568 inline 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
582 inline 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
596 inline 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
609 inline 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
621 inline 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
632 inline 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
643 inline 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
655 inline 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
667 inline 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
679 inline 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
691 inline 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
703 inline 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
717 inline 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
730 inline 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
743 inline 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
756 inline 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
768 inline 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
781 inline 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
793 inline 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
805 inline 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
817 inline 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
831 inline 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
843 inline 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
858 inline 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
870 inline 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
883 inline 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
894 inline 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
908 inline 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
919 inline 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
932 inline 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
943 inline 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
957 inline 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
968 inline 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
982 inline 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
994 inline 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
1006 inline 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
1019 inline 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
1032 inline 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
1043 inline 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
1054 inline 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
1066 inline 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
1078 inline 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
1089 inline 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
1102 inline 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
1113 inline 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
1124 inline void InspectorInstrumentation::didPaint(RenderObject* renderer, 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, rect);
1130 #else
1131     UNUSED_PARAM(renderer);
1132     UNUSED_PARAM(rect);
1133 #endif
1134 }
1135
1136 inline void InspectorInstrumentation::willScrollLayer(Frame* frame)
1137 {
1138 #if ENABLE(INSPECTOR)
1139     FAST_RETURN_IF_NO_FRONTENDS(void());
1140     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1141         willScrollLayerImpl(instrumentingAgents, frame);
1142 #else
1143     UNUSED_PARAM(frame);
1144 #endif
1145 }
1146
1147 inline void InspectorInstrumentation::didScrollLayer(Frame* frame)
1148 {
1149 #if ENABLE(INSPECTOR)
1150     FAST_RETURN_IF_NO_FRONTENDS(void());
1151     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1152         didScrollLayerImpl(instrumentingAgents);
1153 #else
1154     UNUSED_PARAM(frame);
1155 #endif
1156 }
1157
1158 inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document)
1159 {
1160 #if ENABLE(INSPECTOR)
1161     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1162     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1163         return willRecalculateStyleImpl(instrumentingAgents, document->frame());
1164 #else
1165     UNUSED_PARAM(document);
1166 #endif
1167     return InspectorInstrumentationCookie();
1168 }
1169
1170 inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie)
1171 {
1172 #if ENABLE(INSPECTOR)
1173     FAST_RETURN_IF_NO_FRONTENDS(void());
1174     if (cookie.isValid())
1175         didRecalculateStyleImpl(cookie);
1176 #else
1177     UNUSED_PARAM(cookie);
1178 #endif
1179 }
1180
1181 inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document* document)
1182 {
1183 #if ENABLE(INSPECTOR)
1184     FAST_RETURN_IF_NO_FRONTENDS(void());
1185     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1186         didScheduleStyleRecalculationImpl(instrumentingAgents, document);
1187 #else
1188     UNUSED_PARAM(document);
1189 #endif
1190 }
1191
1192 inline void InspectorInstrumentation::applyEmulatedMedia(Frame* frame, String* media)
1193 {
1194 #if ENABLE(INSPECTOR)
1195     FAST_RETURN_IF_NO_FRONTENDS(void());
1196     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1197         applyEmulatedMediaImpl(instrumentingAgents, media);
1198 #else
1199     UNUSED_PARAM(frame);
1200     UNUSED_PARAM(media);
1201 #endif
1202 }
1203
1204 inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
1205 {
1206 #if ENABLE(INSPECTOR)
1207     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1208         willSendRequestImpl(instrumentingAgents, identifier, loader, request, redirectResponse);
1209 #else
1210     UNUSED_PARAM(frame);
1211     UNUSED_PARAM(identifier);
1212     UNUSED_PARAM(loader);
1213     UNUSED_PARAM(request);
1214     UNUSED_PARAM(redirectResponse);
1215 #endif
1216 }
1217
1218 inline void InspectorInstrumentation::continueAfterPingLoader(Frame& frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
1219 {
1220 #if ENABLE(INSPECTOR)
1221     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1222         InspectorInstrumentation::continueAfterPingLoaderImpl(instrumentingAgents, identifier, loader, request, response);
1223 #else
1224     UNUSED_PARAM(frame);
1225     UNUSED_PARAM(identifier);
1226     UNUSED_PARAM(loader);
1227     UNUSED_PARAM(request);
1228     UNUSED_PARAM(response);
1229 #endif
1230 }
1231
1232 inline void InspectorInstrumentation::markResourceAsCached(Page* page, unsigned long identifier)
1233 {
1234 #if ENABLE(INSPECTOR)
1235     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1236         markResourceAsCachedImpl(instrumentingAgents, identifier);
1237 #else
1238     UNUSED_PARAM(page);
1239     UNUSED_PARAM(identifier);
1240 #endif
1241 }
1242
1243 inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, CachedResource* resource)
1244 {
1245 #if ENABLE(INSPECTOR)
1246     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1247         didLoadResourceFromMemoryCacheImpl(instrumentingAgents, loader, resource);
1248 #else
1249     UNUSED_PARAM(page);
1250     UNUSED_PARAM(loader);
1251     UNUSED_PARAM(resource);
1252 #endif
1253 }
1254
1255 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier, int length)
1256 {
1257 #if ENABLE(INSPECTOR)
1258     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1259     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1260         return willReceiveResourceDataImpl(instrumentingAgents, identifier, frame, length);
1261 #else
1262     UNUSED_PARAM(frame);
1263     UNUSED_PARAM(identifier);
1264     UNUSED_PARAM(length);
1265 #endif
1266     return InspectorInstrumentationCookie();
1267 }
1268
1269 inline void InspectorInstrumentation::didReceiveResourceData(const InspectorInstrumentationCookie& cookie)
1270 {
1271 #if ENABLE(INSPECTOR)
1272     FAST_RETURN_IF_NO_FRONTENDS(void());
1273     if (cookie.isValid())
1274         didReceiveResourceDataImpl(cookie);
1275 #else
1276     UNUSED_PARAM(cookie);
1277 #endif
1278 }
1279
1280 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame, unsigned long identifier, const ResourceResponse& response)
1281 {
1282 #if ENABLE(INSPECTOR)
1283     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1284         return willReceiveResourceResponseImpl(instrumentingAgents, identifier, response, frame);
1285 #else
1286     UNUSED_PARAM(frame);
1287     UNUSED_PARAM(identifier);
1288     UNUSED_PARAM(response);
1289 #endif
1290     return InspectorInstrumentationCookie();
1291 }
1292
1293 inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
1294 {
1295 #if ENABLE(INSPECTOR)
1296     // Call this unconditionally so that we're able to log to console with no front-end attached.
1297     if (cookie.isValid())
1298         didReceiveResourceResponseImpl(cookie, identifier, loader, response, resourceLoader);
1299 #else
1300     UNUSED_PARAM(cookie);
1301     UNUSED_PARAM(identifier);
1302     UNUSED_PARAM(loader);
1303     UNUSED_PARAM(response);
1304     UNUSED_PARAM(resourceLoader);
1305 #endif
1306 }
1307
1308 inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1309 {
1310 #if ENABLE(INSPECTOR)
1311     FAST_RETURN_IF_NO_FRONTENDS(void());
1312     InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(frame, loader, identifier, r);
1313 #else
1314     UNUSED_PARAM(frame);
1315     UNUSED_PARAM(loader);
1316     UNUSED_PARAM(identifier);
1317     UNUSED_PARAM(r);
1318 #endif
1319 }
1320
1321 inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1322 {
1323 #if ENABLE(INSPECTOR)
1324     FAST_RETURN_IF_NO_FRONTENDS(void());
1325     InspectorInstrumentation::continueWithPolicyDownloadImpl(frame, loader, identifier, r);
1326 #else
1327     UNUSED_PARAM(frame);
1328     UNUSED_PARAM(loader);
1329     UNUSED_PARAM(identifier);
1330     UNUSED_PARAM(r);
1331 #endif
1332 }
1333
1334 inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1335 {
1336 #if ENABLE(INSPECTOR)
1337     FAST_RETURN_IF_NO_FRONTENDS(void());
1338     InspectorInstrumentation::continueWithPolicyIgnoreImpl(frame, loader, identifier, r);
1339 #else
1340     UNUSED_PARAM(frame);
1341     UNUSED_PARAM(loader);
1342     UNUSED_PARAM(identifier);
1343     UNUSED_PARAM(r);
1344 #endif
1345 }
1346
1347 inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
1348 {
1349 #if ENABLE(INSPECTOR)
1350     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1351         didReceiveDataImpl(instrumentingAgents, identifier, data, dataLength, encodedDataLength);
1352 #else
1353     UNUSED_PARAM(frame);
1354     UNUSED_PARAM(identifier);
1355     UNUSED_PARAM(data);
1356     UNUSED_PARAM(dataLength);
1357     UNUSED_PARAM(encodedDataLength);
1358 #endif
1359 }
1360
1361 inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, double finishTime)
1362 {
1363 #if ENABLE(INSPECTOR)
1364     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1365         didFinishLoadingImpl(instrumentingAgents, identifier, loader, finishTime);
1366 #else
1367     UNUSED_PARAM(frame);
1368     UNUSED_PARAM(loader);
1369     UNUSED_PARAM(identifier);
1370     UNUSED_PARAM(finishTime);
1371 #endif
1372 }
1373
1374 inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
1375 {
1376 #if ENABLE(INSPECTOR)
1377     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1378         didFailLoadingImpl(instrumentingAgents, identifier, loader, error);
1379 #else
1380     UNUSED_PARAM(frame);
1381     UNUSED_PARAM(loader);
1382     UNUSED_PARAM(identifier);
1383     UNUSED_PARAM(error);
1384 #endif
1385 }
1386
1387 inline void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext* context, unsigned long identifier, ThreadableLoaderClient* client)
1388 {
1389 #if ENABLE(INSPECTOR)
1390     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1391         documentThreadableLoaderStartedLoadingForClientImpl(instrumentingAgents, identifier, client);
1392 #else
1393     UNUSED_PARAM(context);
1394     UNUSED_PARAM(identifier);
1395     UNUSED_PARAM(client);
1396 #endif
1397 }
1398
1399 inline void InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* context, ThreadableLoaderClient* client, const String& method, const URL& url, bool async, PassRefPtr<FormData> formData, const HTTPHeaderMap& headers, bool includeCredentials)
1400 {
1401 #if ENABLE(INSPECTOR)
1402     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1403         willLoadXHRImpl(instrumentingAgents, client, method, url, async, formData, headers, includeCredentials);
1404 #else
1405     UNUSED_PARAM(context);
1406     UNUSED_PARAM(client);
1407     UNUSED_PARAM(method);
1408     UNUSED_PARAM(url);
1409     UNUSED_PARAM(async);
1410     UNUSED_PARAM(formData);
1411     UNUSED_PARAM(headers);
1412     UNUSED_PARAM(includeCredentials);
1413 #endif
1414 }
1415
1416 inline void InspectorInstrumentation::didFailXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client)
1417 {
1418 #if ENABLE(INSPECTOR)
1419     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1420         didFailXHRLoadingImpl(instrumentingAgents, client);
1421 #else
1422     UNUSED_PARAM(context);
1423     UNUSED_PARAM(client);
1424 #endif
1425 }
1426
1427
1428 inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
1429 {
1430 #if ENABLE(INSPECTOR)
1431     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1432         didFinishXHRLoadingImpl(instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber, sendColumnNumber);
1433 #else
1434     UNUSED_PARAM(context);
1435     UNUSED_PARAM(client);
1436     UNUSED_PARAM(identifier);
1437     UNUSED_PARAM(sourceString);
1438     UNUSED_PARAM(url);
1439     UNUSED_PARAM(sendURL);
1440     UNUSED_PARAM(sendLineNumber);
1441     UNUSED_PARAM(sendColumnNumber);
1442 #endif
1443 }
1444
1445 inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionContext* context, unsigned long identifier)
1446 {
1447 #if ENABLE(INSPECTOR)
1448     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1449         didReceiveXHRResponseImpl(instrumentingAgents, identifier);
1450 #else
1451     UNUSED_PARAM(context);
1452     UNUSED_PARAM(identifier);
1453 #endif
1454 }
1455
1456 inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context)
1457 {
1458 #if ENABLE(INSPECTOR)
1459     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1460         willLoadXHRSynchronouslyImpl(instrumentingAgents);
1461 #else
1462     UNUSED_PARAM(context);
1463 #endif
1464 }
1465
1466 inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context)
1467 {
1468 #if ENABLE(INSPECTOR)
1469     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1470         didLoadXHRSynchronouslyImpl(instrumentingAgents);
1471 #else
1472     UNUSED_PARAM(context);
1473 #endif
1474 }
1475
1476 inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString)
1477 {
1478 #if ENABLE(INSPECTOR)
1479     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1480         scriptImportedImpl(instrumentingAgents, identifier, sourceString);
1481 #else
1482     UNUSED_PARAM(context);
1483     UNUSED_PARAM(identifier);
1484     UNUSED_PARAM(sourceString);
1485 #endif
1486 }
1487
1488 inline void InspectorInstrumentation::scriptExecutionBlockedByCSP(ScriptExecutionContext* context, const String& directiveText)
1489 {
1490 #if ENABLE(INSPECTOR)
1491     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1492         scriptExecutionBlockedByCSPImpl(instrumentingAgents, directiveText);
1493 #else
1494     UNUSED_PARAM(context);
1495     UNUSED_PARAM(directiveText);
1496 #endif
1497 }
1498
1499 inline void InspectorInstrumentation::didReceiveScriptResponse(ScriptExecutionContext* context, unsigned long identifier)
1500 {
1501 #if ENABLE(INSPECTOR)
1502     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1503         didReceiveScriptResponseImpl(instrumentingAgents, identifier);
1504 #else
1505     UNUSED_PARAM(context);
1506     UNUSED_PARAM(identifier);
1507 #endif
1508 }
1509
1510 inline void InspectorInstrumentation::domContentLoadedEventFired(Frame* frame)
1511 {
1512 #if ENABLE(INSPECTOR)
1513     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1514         domContentLoadedEventFiredImpl(instrumentingAgents, frame);
1515 #else
1516     UNUSED_PARAM(frame);
1517 #endif
1518 }
1519
1520 inline void InspectorInstrumentation::loadEventFired(Frame* frame)
1521 {
1522 #if ENABLE(INSPECTOR)
1523     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1524         loadEventFiredImpl(instrumentingAgents, frame);
1525 #else
1526     UNUSED_PARAM(frame);
1527 #endif
1528 }
1529
1530 inline void InspectorInstrumentation::frameDetachedFromParent(Frame* frame)
1531 {
1532 #if ENABLE(INSPECTOR)
1533     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1534         frameDetachedFromParentImpl(instrumentingAgents, frame);
1535 #else
1536     UNUSED_PARAM(frame);
1537 #endif
1538 }
1539
1540 inline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader)
1541 {
1542 #if ENABLE(INSPECTOR)
1543     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1544         didCommitLoadImpl(instrumentingAgents, frame->page(), loader);
1545 #else
1546     UNUSED_PARAM(frame);
1547     UNUSED_PARAM(loader);
1548 #endif
1549 }
1550
1551 inline void InspectorInstrumentation::frameDocumentUpdated(Frame* frame)
1552 {
1553 #if ENABLE(INSPECTOR)
1554     FAST_RETURN_IF_NO_FRONTENDS(void());
1555     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1556         frameDocumentUpdatedImpl(instrumentingAgents, frame);
1557 #else
1558     UNUSED_PARAM(frame);
1559 #endif
1560 }
1561
1562 inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame* frame, DocumentLoader* loader)
1563 {
1564 #if ENABLE(INSPECTOR)
1565     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1566         loaderDetachedFromFrameImpl(instrumentingAgents, loader);
1567 #else
1568     UNUSED_PARAM(frame);
1569     UNUSED_PARAM(loader);
1570 #endif
1571 }
1572
1573 inline void InspectorInstrumentation::frameStartedLoading(Frame& frame)
1574 {
1575 #if ENABLE(INSPECTOR)
1576     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1577         frameStartedLoadingImpl(*instrumentingAgents, frame);
1578 #else
1579     UNUSED_PARAM(frame);
1580 #endif
1581 }
1582
1583 inline void InspectorInstrumentation::frameStoppedLoading(Frame& frame)
1584 {
1585 #if ENABLE(INSPECTOR)
1586     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1587         frameStoppedLoadingImpl(*instrumentingAgents, frame);
1588 #else
1589     UNUSED_PARAM(frame);
1590 #endif
1591 }
1592
1593 inline void InspectorInstrumentation::frameScheduledNavigation(Frame& frame, double delay)
1594 {
1595 #if ENABLE(INSPECTOR)
1596     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1597         frameScheduledNavigationImpl(*instrumentingAgents, frame, delay);
1598 #else
1599     UNUSED_PARAM(frame);
1600     UNUSED_PARAM(delay);
1601 #endif
1602 }
1603
1604 inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& frame)
1605 {
1606 #if ENABLE(INSPECTOR)
1607     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
1608         frameClearedScheduledNavigationImpl(*instrumentingAgents, frame);
1609 #else
1610     UNUSED_PARAM(frame);
1611 #endif
1612 }
1613
1614 inline InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialog(Page* page, const String& message)
1615 {
1616 #if ENABLE(INSPECTOR)
1617     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1618     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1619         return willRunJavaScriptDialogImpl(instrumentingAgents, message);
1620 #else
1621     UNUSED_PARAM(page);
1622     UNUSED_PARAM(message);
1623 #endif
1624     return InspectorInstrumentationCookie();
1625 }
1626
1627 inline void InspectorInstrumentation::didRunJavaScriptDialog(const InspectorInstrumentationCookie& cookie)
1628 {
1629 #if ENABLE(INSPECTOR)
1630     FAST_RETURN_IF_NO_FRONTENDS(void());
1631     if (cookie.isValid())
1632         didRunJavaScriptDialogImpl(cookie);
1633 #else
1634     UNUSED_PARAM(cookie);
1635 #endif
1636 }
1637
1638 inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource* cachedResource)
1639 {
1640 #if ENABLE(INSPECTOR)
1641     FAST_RETURN_IF_NO_FRONTENDS(void());
1642     willDestroyCachedResourceImpl(cachedResource);
1643 #else
1644     UNUSED_PARAM(cachedResource);
1645 #endif
1646 }
1647
1648 inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned startLine)
1649 {
1650 #if ENABLE(INSPECTOR)
1651     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1652     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1653         return willWriteHTMLImpl(instrumentingAgents, startLine, document->frame());
1654 #else
1655     UNUSED_PARAM(document);
1656     UNUSED_PARAM(startLine);
1657 #endif
1658     return InspectorInstrumentationCookie();
1659 }
1660
1661 inline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentationCookie& cookie, unsigned endLine)
1662 {
1663 #if ENABLE(INSPECTOR)
1664     FAST_RETURN_IF_NO_FRONTENDS(void());
1665     if (cookie.isValid())
1666         didWriteHTMLImpl(cookie, endLine);
1667 #else
1668     UNUSED_PARAM(cookie);
1669     UNUSED_PARAM(endLine);
1670 #endif
1671 }
1672
1673 inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
1674 {
1675 #if ENABLE(INSPECTOR)
1676     FAST_RETURN_IF_NO_FRONTENDS(void());
1677     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1678         didDispatchDOMStorageEventImpl(instrumentingAgents, key, oldValue, newValue, storageType, securityOrigin, page);
1679 #else
1680     UNUSED_PARAM(key);
1681     UNUSED_PARAM(oldValue);
1682     UNUSED_PARAM(newValue);
1683     UNUSED_PARAM(storageType);
1684     UNUSED_PARAM(securityOrigin);
1685     UNUSED_PARAM(page);
1686 #endif // ENABLE(INSPECTOR)
1687 }
1688
1689 inline bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext* context)
1690 {
1691 #if ENABLE(INSPECTOR)
1692     FAST_RETURN_IF_NO_FRONTENDS(false);
1693     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1694         return shouldPauseDedicatedWorkerOnStartImpl(instrumentingAgents);
1695 #else
1696     UNUSED_PARAM(context);
1697 #endif
1698     return false;
1699 }
1700
1701 inline void InspectorInstrumentation::didStartWorkerGlobalScope(ScriptExecutionContext* context, WorkerGlobalScopeProxy* proxy, const URL& url)
1702 {
1703 #if ENABLE(INSPECTOR)
1704     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1705         didStartWorkerGlobalScopeImpl(instrumentingAgents, proxy, url);
1706 #else
1707     UNUSED_PARAM(context);
1708     UNUSED_PARAM(proxy);
1709     UNUSED_PARAM(url);
1710 #endif
1711 }
1712
1713 inline void InspectorInstrumentation::workerGlobalScopeTerminated(ScriptExecutionContext* context, WorkerGlobalScopeProxy* proxy)
1714 {
1715 #if ENABLE(INSPECTOR)
1716     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1717         workerGlobalScopeTerminatedImpl(instrumentingAgents, proxy);
1718 #else
1719     UNUSED_PARAM(context);
1720     UNUSED_PARAM(proxy);
1721 #endif
1722 }
1723
1724 #if ENABLE(WEB_SOCKETS)
1725 inline void InspectorInstrumentation::didCreateWebSocket(Document* document, unsigned long identifier, const URL& requestURL, const URL& documentURL, const String& protocol)
1726 {
1727 #if ENABLE(INSPECTOR)
1728     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1729         didCreateWebSocketImpl(instrumentingAgents, identifier, requestURL, documentURL, protocol, document);
1730 #else
1731     UNUSED_PARAM(document);
1732     UNUSED_PARAM(identifier);
1733     UNUSED_PARAM(requestURL);
1734     UNUSED_PARAM(documentURL);
1735     UNUSED_PARAM(protocol);
1736 #endif
1737 }
1738
1739 inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(Document* document, unsigned long identifier, const ResourceRequest& request)
1740 {
1741 #if ENABLE(INSPECTOR)
1742     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1743         willSendWebSocketHandshakeRequestImpl(instrumentingAgents, identifier, request, document);
1744 #else
1745     UNUSED_PARAM(document);
1746     UNUSED_PARAM(identifier);
1747     UNUSED_PARAM(request);
1748 #endif
1749 }
1750
1751 inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(Document* document, unsigned long identifier, const ResourceResponse& response)
1752 {
1753 #if ENABLE(INSPECTOR)
1754     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1755         didReceiveWebSocketHandshakeResponseImpl(instrumentingAgents, identifier, response, document);
1756 #else
1757     UNUSED_PARAM(document);
1758     UNUSED_PARAM(identifier);
1759     UNUSED_PARAM(response);
1760 #endif
1761 }
1762
1763 inline void InspectorInstrumentation::didCloseWebSocket(Document* document, unsigned long identifier)
1764 {
1765 #if ENABLE(INSPECTOR)
1766     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1767         didCloseWebSocketImpl(instrumentingAgents, identifier, document);
1768 #else
1769     UNUSED_PARAM(document);
1770     UNUSED_PARAM(identifier);
1771 #endif
1772 }
1773 inline void InspectorInstrumentation::didReceiveWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1774 {
1775 #if ENABLE(INSPECTOR)
1776     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1777         didReceiveWebSocketFrameImpl(instrumentingAgents, identifier, frame);
1778 #else
1779     UNUSED_PARAM(document);
1780     UNUSED_PARAM(identifier);
1781     UNUSED_PARAM(frame);
1782 #endif
1783 }
1784 inline void InspectorInstrumentation::didReceiveWebSocketFrameError(Document* document, unsigned long identifier, const String& errorMessage)
1785 {
1786 #if ENABLE(INSPECTOR)
1787     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1788         didReceiveWebSocketFrameErrorImpl(instrumentingAgents, identifier, errorMessage);
1789 #else
1790     UNUSED_PARAM(document);
1791     UNUSED_PARAM(identifier);
1792     UNUSED_PARAM(errorMessage);
1793 #endif
1794 }
1795 inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1796 {
1797 #if ENABLE(INSPECTOR)
1798     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1799         didSendWebSocketFrameImpl(instrumentingAgents, identifier, frame);
1800 #else
1801     UNUSED_PARAM(document);
1802     UNUSED_PARAM(identifier);
1803     UNUSED_PARAM(frame);
1804 #endif
1805 }
1806 #endif
1807
1808 #if ENABLE(WEB_REPLAY)
1809 inline void InspectorInstrumentation::sessionCreated(Page* page, PassRefPtr<ReplaySession> session)
1810 {
1811 #if ENABLE(INSPECTOR)
1812     FAST_RETURN_IF_NO_FRONTENDS(void());
1813     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1814         sessionCreatedImpl(instrumentingAgents, session);
1815 #else
1816     UNUSED_PARAM(page);
1817     UNUSED_PARAM(session);
1818 #endif
1819 }
1820
1821 inline void InspectorInstrumentation::sessionLoaded(Page* page, PassRefPtr<ReplaySession> session)
1822 {
1823 #if ENABLE(INSPECTOR)
1824     FAST_RETURN_IF_NO_FRONTENDS(void());
1825     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1826         sessionLoadedImpl(instrumentingAgents, session);
1827 #else
1828     UNUSED_PARAM(page);
1829     UNUSED_PARAM(session);
1830 #endif
1831 }
1832
1833 inline void InspectorInstrumentation::sessionModified(Page* page, PassRefPtr<ReplaySession> session)
1834 {
1835 #if ENABLE(INSPECTOR)
1836     FAST_RETURN_IF_NO_FRONTENDS(void());
1837     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1838         sessionModifiedImpl(instrumentingAgents, session);
1839 #else
1840     UNUSED_PARAM(page);
1841     UNUSED_PARAM(session);
1842 #endif
1843 }
1844
1845 inline void InspectorInstrumentation::segmentCreated(Page* page, PassRefPtr<ReplaySessionSegment> segment)
1846 {
1847 #if ENABLE(INSPECTOR)
1848     FAST_RETURN_IF_NO_FRONTENDS(void());
1849     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1850         segmentCreatedImpl(instrumentingAgents, segment);
1851 #else
1852     UNUSED_PARAM(page);
1853     UNUSED_PARAM(segment);
1854 #endif
1855 }
1856
1857 inline void InspectorInstrumentation::segmentCompleted(Page* page, PassRefPtr<ReplaySessionSegment> segment)
1858 {
1859 #if ENABLE(INSPECTOR)
1860     FAST_RETURN_IF_NO_FRONTENDS(void());
1861     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1862         segmentCompletedImpl(instrumentingAgents, segment);
1863 #else
1864     UNUSED_PARAM(page);
1865     UNUSED_PARAM(segment);
1866 #endif
1867 }
1868
1869 inline void InspectorInstrumentation::segmentLoaded(Page* page, PassRefPtr<ReplaySessionSegment> segment)
1870 {
1871 #if ENABLE(INSPECTOR)
1872     FAST_RETURN_IF_NO_FRONTENDS(void());
1873     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1874         segmentLoadedImpl(instrumentingAgents, segment);
1875 #else
1876     UNUSED_PARAM(page);
1877     UNUSED_PARAM(segment);
1878 #endif
1879 }
1880
1881 inline void InspectorInstrumentation::segmentUnloaded(Page* page)
1882 {
1883 #if ENABLE(INSPECTOR)
1884     FAST_RETURN_IF_NO_FRONTENDS(void());
1885     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1886         segmentUnloadedImpl(instrumentingAgents);
1887 #else
1888     UNUSED_PARAM(page);
1889 #endif
1890 }
1891
1892 inline void InspectorInstrumentation::captureStarted(Page* page)
1893 {
1894 #if ENABLE(INSPECTOR)
1895     FAST_RETURN_IF_NO_FRONTENDS(void());
1896     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1897         captureStartedImpl(instrumentingAgents);
1898 #else
1899     UNUSED_PARAM(page);
1900 #endif
1901 }
1902
1903 inline void InspectorInstrumentation::captureStopped(Page* page)
1904 {
1905 #if ENABLE(INSPECTOR)
1906     FAST_RETURN_IF_NO_FRONTENDS(void());
1907     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1908         captureStoppedImpl(instrumentingAgents);
1909 #else
1910     UNUSED_PARAM(page);
1911 #endif
1912 }
1913
1914 inline void InspectorInstrumentation::playbackStarted(Page* page)
1915 {
1916 #if ENABLE(INSPECTOR)
1917     FAST_RETURN_IF_NO_FRONTENDS(void());
1918     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1919         playbackStartedImpl(instrumentingAgents);
1920 #else
1921     UNUSED_PARAM(page);
1922 #endif
1923 }
1924
1925 inline void InspectorInstrumentation::playbackPaused(Page* page, const ReplayPosition& position)
1926 {
1927 #if ENABLE(INSPECTOR)
1928     FAST_RETURN_IF_NO_FRONTENDS(void());
1929     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1930         playbackPausedImpl(instrumentingAgents, position);
1931 #else
1932     UNUSED_PARAM(page);
1933     UNUSED_PARAM(position);
1934 #endif
1935 }
1936
1937 inline void InspectorInstrumentation::playbackFinished(Page* page)
1938 {
1939 #if ENABLE(INSPECTOR)
1940     FAST_RETURN_IF_NO_FRONTENDS(void());
1941     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1942         playbackFinishedImpl(instrumentingAgents);
1943 #else
1944     UNUSED_PARAM(page);
1945 #endif
1946 }
1947
1948 inline void InspectorInstrumentation::playbackHitPosition(Page* page, const ReplayPosition& position)
1949 {
1950 #if ENABLE(INSPECTOR)
1951     FAST_RETURN_IF_NO_FRONTENDS(void());
1952     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1953         playbackHitPositionImpl(instrumentingAgents, position);
1954 #else
1955     UNUSED_PARAM(page);
1956     UNUSED_PARAM(position);
1957 #endif
1958 }
1959 #endif // ENABLE(WEB_REPLAY)
1960
1961 inline void InspectorInstrumentation::networkStateChanged(Page* page)
1962 {
1963 #if ENABLE(INSPECTOR)
1964     FAST_RETURN_IF_NO_FRONTENDS(void());
1965     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1966         networkStateChangedImpl(instrumentingAgents);
1967 #else
1968     UNUSED_PARAM(page);
1969 #endif
1970 }
1971
1972 inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
1973 {
1974 #if ENABLE(INSPECTOR)
1975     FAST_RETURN_IF_NO_FRONTENDS(void());
1976     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1977         updateApplicationCacheStatusImpl(instrumentingAgents, frame);
1978 #else
1979     UNUSED_PARAM(frame);
1980 #endif
1981 }
1982
1983 inline void InspectorInstrumentation::didRequestAnimationFrame(Document* document, int callbackId)
1984 {
1985 #if ENABLE(INSPECTOR)
1986     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1987         didRequestAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
1988 #else
1989     UNUSED_PARAM(document);
1990     UNUSED_PARAM(callbackId);
1991 #endif
1992 }
1993
1994 inline void InspectorInstrumentation::didCancelAnimationFrame(Document* document, int callbackId)
1995 {
1996 #if ENABLE(INSPECTOR)
1997     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1998         didCancelAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
1999 #else
2000     UNUSED_PARAM(document);
2001     UNUSED_PARAM(callbackId);
2002 #endif
2003 }
2004
2005 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrame(Document* document, int callbackId)
2006 {
2007 #if ENABLE(INSPECTOR)
2008     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
2009         return willFireAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
2010 #else
2011     UNUSED_PARAM(document);
2012     UNUSED_PARAM(callbackId);
2013 #endif
2014     return InspectorInstrumentationCookie();
2015 }
2016
2017 inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstrumentationCookie& cookie)
2018 {
2019 #if ENABLE(INSPECTOR)
2020     FAST_RETURN_IF_NO_FRONTENDS(void());
2021     if (cookie.isValid())
2022         didFireAnimationFrameImpl(cookie);
2023 #else
2024     UNUSED_PARAM(cookie);
2025 #endif
2026 }
2027
2028 inline void InspectorInstrumentation::layerTreeDidChange(Page* page)
2029 {
2030 #if ENABLE(INSPECTOR)
2031     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2032         layerTreeDidChangeImpl(instrumentingAgents);
2033 #else
2034     UNUSED_PARAM(page);
2035 #endif
2036 }
2037
2038 inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const RenderLayer* renderLayer)
2039 {
2040 #if ENABLE(INSPECTOR)
2041     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2042         renderLayerDestroyedImpl(instrumentingAgents, renderLayer);
2043 #else
2044     UNUSED_PARAM(page);
2045     UNUSED_PARAM(renderLayer);
2046 #endif
2047 }
2048
2049 inline void InspectorInstrumentation::pseudoElementDestroyed(Page* page, PseudoElement* pseudoElement)
2050 {
2051 #if ENABLE(INSPECTOR)
2052     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2053         pseudoElementDestroyedImpl(instrumentingAgents, pseudoElement);
2054 #else
2055     UNUSED_PARAM(page);
2056     UNUSED_PARAM(pseudoElement);
2057 #endif
2058 }
2059
2060 #if ENABLE(INSPECTOR)
2061 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context)
2062 {
2063     if (!context)
2064         return nullptr;
2065     if (is<Document>(*context))
2066         return instrumentingAgentsForPage(downcast<Document>(context)->page());
2067     return instrumentingAgentsForNonDocumentContext(context);
2068 }
2069
2070 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame)
2071 {
2072     if (frame)
2073         return instrumentingAgentsForPage(frame->page());
2074     return nullptr;
2075 }
2076
2077 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document* document)
2078 {
2079     if (document) {
2080         Page* page = document->page();
2081 #if ENABLE(TEMPLATE_ELEMENT)
2082         if (!page && document->templateDocumentHost())
2083             page = document->templateDocumentHost()->page();
2084 #endif
2085         return instrumentingAgentsForPage(page);
2086     }
2087     return nullptr;
2088 }
2089 #endif
2090
2091 } // namespace WebCore
2092
2093 #endif // !defined(InspectorInstrumentation_h)