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