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