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