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