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