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