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