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