Web Inspector: Make main-thread monitoring go through InspectorController
[WebKit-https.git] / Source / WebCore / inspector / InspectorInstrumentation.h
1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 *     * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *     * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 *     * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef InspectorInstrumentation_h
32 #define InspectorInstrumentation_h
33
34 #include "CSSSelector.h"
35 #include "ConsoleTypes.h"
36 #include "Element.h"
37 #include "Frame.h"
38 #include "Page.h"
39 #include "ScriptExecutionContext.h"
40 #include "ScriptState.h"
41 #include "StorageArea.h"
42
43 namespace WebCore {
44
45 class CSSRule;
46 class CharacterData;
47 class DOMWindow;
48 class DOMWrapperWorld;
49 class Database;
50 class Document;
51 class Element;
52 class EventContext;
53 class DocumentLoader;
54 class DeviceOrientationData;
55 class GeolocationPosition;
56 class GraphicsContext;
57 class HitTestResult;
58 class InspectorCSSAgent;
59 class InspectorTimelineAgent;
60 class InstrumentingAgents;
61 class KURL;
62 class Node;
63 class RenderObject;
64 class ResourceRequest;
65 class ResourceResponse;
66 class ScriptArguments;
67 class ScriptCallStack;
68 class ScriptExecutionContext;
69 class ScriptObject;
70 class ScriptProfile;
71 class SecurityOrigin;
72 class ShadowRoot;
73 class StorageArea;
74 class StyleRule;
75 class ThreadableLoaderClient;
76 class WorkerContext;
77 class WorkerContextProxy;
78 class XMLHttpRequest;
79
80 #if ENABLE(WEB_SOCKETS)
81 struct WebSocketFrame;
82 class WebSocketHandshakeRequest;
83 class WebSocketHandshakeResponse;
84 #endif
85
86 #define FAST_RETURN_IF_NO_FRONTENDS(value) if (!hasFrontends()) return value;
87
88 typedef pair<InstrumentingAgents*, int> InspectorInstrumentationCookie;
89
90 class InspectorInstrumentation {
91 public:
92     static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
93     static bool isDebuggerPaused(Frame*);
94
95     static void willInsertDOMNode(Document*, Node* parent);
96     static void didInsertDOMNode(Document*, Node*);
97     static void willRemoveDOMNode(Document*, Node*);
98     static void willModifyDOMAttr(Document*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
99     static void didModifyDOMAttr(Document*, Element*, const AtomicString& name, const AtomicString& value);
100     static void didRemoveDOMAttr(Document*, Element*, const AtomicString& name);
101     static void characterDataModified(Document*, CharacterData*);
102     static void didInvalidateStyleAttr(Document*, Node*);
103     static void frameWindowDiscarded(Frame*, DOMWindow*);
104     static void mediaQueryResultChanged(Document*);
105     static void didPushShadowRoot(Element* host, ShadowRoot*);
106     static void willPopShadowRoot(Element* host, ShadowRoot*);
107     static void didCreateNamedFlow(Document*, WebKitNamedFlow*);
108     static void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
109     static void didUpdateRegionLayout(Document*, WebKitNamedFlow*);
110
111     static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
112     static bool handleMousePress(Page*);
113     static bool handleTouchEvent(Page*, Node*);
114     static bool forcePseudoState(Element*, CSSSelector::PseudoType);
115
116     static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
117     static void didScheduleResourceRequest(Document*, const String& url);
118     static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
119     static void didRemoveTimer(ScriptExecutionContext*, int timerId);
120
121     static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine);
122     static void didCallFunction(const InspectorInstrumentationCookie&);
123     static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext*, XMLHttpRequest*);
124     static void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&);
125     static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
126     static void didDispatchEvent(const InspectorInstrumentationCookie&);
127     static InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, Event*);
128     static void didHandleEvent(const InspectorInstrumentationCookie&);
129     static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
130     static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
131     static InspectorInstrumentationCookie willEvaluateScript(Frame*, const String& url, int lineNumber);
132     static void didEvaluateScript(const InspectorInstrumentationCookie&);
133     static void didCreateIsolatedContext(Frame*, ScriptState*, SecurityOrigin*);
134     static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext*, int timerId);
135     static void didFireTimer(const InspectorInstrumentationCookie&);
136     static void didBeginFrame(Page*);
137     static void didCancelFrame(Page*);
138     static void didInvalidateLayout(Frame*);
139     static InspectorInstrumentationCookie willLayout(Frame*);
140     static void didLayout(const InspectorInstrumentationCookie&, RenderObject*);
141     static void didScroll(Page*);
142     static InspectorInstrumentationCookie willDispatchXHRLoadEvent(ScriptExecutionContext*, XMLHttpRequest*);
143     static void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&);
144     static void willScrollLayer(Frame*);
145     static void didScrollLayer(Frame*);
146     static InspectorInstrumentationCookie willPaint(Frame*);
147     static void didPaint(const InspectorInstrumentationCookie&, GraphicsContext*, const LayoutRect&);
148     static void willComposite(Page*);
149     static void didComposite(Page*);
150     static InspectorInstrumentationCookie willRecalculateStyle(Document*);
151     static void didRecalculateStyle(const InspectorInstrumentationCookie&);
152     static void didScheduleStyleRecalculation(Document*);
153     static InspectorInstrumentationCookie willMatchRule(Document*, const StyleRule*);
154     static void didMatchRule(const InspectorInstrumentationCookie&, bool matched);
155     static InspectorInstrumentationCookie willProcessRule(Document*, const StyleRule*);
156     static void didProcessRule(const InspectorInstrumentationCookie&);
157
158     static void applyUserAgentOverride(Frame*, String*);
159     static void applyScreenWidthOverride(Frame*, long*);
160     static void applyScreenHeightOverride(Frame*, long*);
161     static bool shouldApplyScreenWidthOverride(Frame*);
162     static bool shouldApplyScreenHeightOverride(Frame*);
163     static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
164     static void continueAfterPingLoader(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
165     static void markResourceAsCached(Page*, unsigned long identifier);
166     static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, CachedResource*);
167     static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier, int length);
168     static void didReceiveResourceData(const InspectorInstrumentationCookie&);
169     static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&);
170     static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
171     static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
172     static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
173     static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
174     static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
175     static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime);
176     static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
177     static void documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext*, unsigned long identifier, ThreadableLoaderClient*);
178     static void willLoadXHR(ScriptExecutionContext*, ThreadableLoaderClient*, const String&, const KURL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
179     static void didFailXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*);
180     static void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
181     static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
182     static void willLoadXHRSynchronously(ScriptExecutionContext*);
183     static void didLoadXHRSynchronously(ScriptExecutionContext*);
184     static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString);
185     static void scriptExecutionBlockedByCSP(ScriptExecutionContext*, const String& directiveText);
186     static void didReceiveScriptResponse(ScriptExecutionContext*, unsigned long identifier);
187     static void domContentLoadedEventFired(Frame*);
188     static void loadEventFired(Frame*);
189     static void frameDetachedFromParent(Frame*);
190     static void didCommitLoad(Frame*, DocumentLoader*);
191     static void loaderDetachedFromFrame(Frame*, DocumentLoader*);
192     static void willDestroyCachedResource(CachedResource*);
193
194     static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned int length, unsigned int startLine);
195     static void didWriteHTML(const InspectorInstrumentationCookie&, unsigned int endLine);
196
197     // FIXME: Remove once we no longer generate stacks outside of Inspector.
198     static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier = 0);
199     static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, ScriptState*, PassRefPtr<ScriptArguments>, unsigned long requestIdentifier = 0);
200     static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, const String&, unsigned lineNumber, unsigned long requestIdentifier = 0);
201 #if ENABLE(WORKERS)
202     // FIXME: Convert to ScriptArguments to match non-worker context.
203     static void addMessageToConsole(WorkerContext*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier = 0);
204     static void addMessageToConsole(WorkerContext*, MessageSource, MessageType, MessageLevel, const String& message, const String&, unsigned lineNumber, unsigned long requestIdentifier = 0);
205 #endif
206     static void consoleCount(Page*, ScriptState*, PassRefPtr<ScriptArguments>);
207     static void startConsoleTiming(Frame*, const String& title);
208     static void stopConsoleTiming(Frame*, const String& title, PassRefPtr<ScriptCallStack>);
209     static void consoleTimeStamp(Frame*, PassRefPtr<ScriptArguments>);
210
211     static void didRequestAnimationFrame(Document*, int callbackId);
212     static void didCancelAnimationFrame(Document*, int callbackId);
213     static InspectorInstrumentationCookie willFireAnimationFrame(Document*, int callbackId);
214     static void didFireAnimationFrame(const InspectorInstrumentationCookie&);
215
216 #if ENABLE(JAVASCRIPT_DEBUGGER)
217     static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, const String& sourceURL);
218     static void addProfile(Page*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
219     static String getCurrentUserInitiatedProfileName(Page*, bool incrementProfileNumber);
220     static bool profilerEnabled(Page*);
221 #endif
222
223 #if ENABLE(SQL_DATABASE)
224     static void didOpenDatabase(ScriptExecutionContext*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
225 #endif
226
227     static void didUseDOMStorage(Page*, StorageArea*, bool isLocalStorage, Frame*);
228     static void didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
229
230 #if ENABLE(WORKERS)
231     static bool shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext*);
232     static void didStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*, const KURL&);
233     static void workerContextTerminated(ScriptExecutionContext*, WorkerContextProxy*);
234     static void willEvaluateWorkerScript(WorkerContext*, int workerThreadStartMode);
235 #endif
236
237 #if ENABLE(WEB_SOCKETS)
238     static void didCreateWebSocket(ScriptExecutionContext*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
239     static void willSendWebSocketHandshakeRequest(ScriptExecutionContext*, unsigned long identifier, const WebSocketHandshakeRequest&);
240     static void didReceiveWebSocketHandshakeResponse(ScriptExecutionContext*, unsigned long identifier, const WebSocketHandshakeResponse&);
241     static void didCloseWebSocket(ScriptExecutionContext*, unsigned long identifier);
242     static void didReceiveWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&);
243     static void didSendWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&);
244     static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
245 #endif
246
247     static ScriptObject wrapCanvas2DRenderingContextForInstrumentation(Document*, const ScriptObject&);
248 #if ENABLE(WEBGL)
249     static ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptObject&);
250 #endif
251
252     static void networkStateChanged(Page*);
253     static void updateApplicationCacheStatus(Frame*);
254
255 #if ENABLE(INSPECTOR)
256     static void frontendCreated() { s_frontendCounter += 1; }
257     static void frontendDeleted() { s_frontendCounter -= 1; }
258     static bool hasFrontends() { return s_frontendCounter; }
259     static bool canvasAgentEnabled(ScriptExecutionContext*);
260     static bool consoleAgentEnabled(ScriptExecutionContext*);
261     static bool timelineAgentEnabled(ScriptExecutionContext*);
262     static bool collectingHTMLParseErrors(Page*);
263 #else
264     static bool hasFrontends() { return false; }
265     static bool canvasAgentEnabled(ScriptExecutionContext*) { return false; }
266     static bool consoleAgentEnabled(ScriptExecutionContext*) { return false; }
267     static bool runtimeAgentEnabled(Frame*) { return false; }
268     static bool timelineAgentEnabled(ScriptExecutionContext*) { return false; }
269     static bool collectingHTMLParseErrors(Page*) { return false; }
270 #endif
271
272 #if ENABLE(GEOLOCATION)
273     static GeolocationPosition* overrideGeolocationPosition(Page*, GeolocationPosition*);
274 #endif
275
276     static void registerInstrumentingAgents(InstrumentingAgents*);
277     static void unregisterInstrumentingAgents(InstrumentingAgents*);
278
279     static DeviceOrientationData* overrideDeviceOrientation(Page*, DeviceOrientationData*);
280
281 private:
282 #if ENABLE(INSPECTOR)
283     static void didClearWindowObjectInWorldImpl(InstrumentingAgents*, Frame*, DOMWrapperWorld*);
284     static bool isDebuggerPausedImpl(InstrumentingAgents*);
285
286     static void willInsertDOMNodeImpl(InstrumentingAgents*, Node* parent);
287     static void didInsertDOMNodeImpl(InstrumentingAgents*, Node*);
288     static void willRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
289     static void didRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
290     static void willModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
291     static void didModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name, const AtomicString& value);
292     static void didRemoveDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name);
293     static void characterDataModifiedImpl(InstrumentingAgents*, CharacterData*);
294     static void didInvalidateStyleAttrImpl(InstrumentingAgents*, Node*);
295     static void frameWindowDiscardedImpl(InstrumentingAgents*, DOMWindow*);
296     static void mediaQueryResultChangedImpl(InstrumentingAgents*);
297     static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
298     static void willPopShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
299     static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
300     static void willRemoveNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
301     static void didUpdateRegionLayoutImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
302
303     static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags);
304     static bool handleTouchEventImpl(InstrumentingAgents*, Node*);
305     static bool handleMousePressImpl(InstrumentingAgents*);
306     static bool forcePseudoStateImpl(InstrumentingAgents*, Element*, CSSSelector::PseudoType);
307
308     static void willSendXMLHttpRequestImpl(InstrumentingAgents*, const String& url);
309     static void didScheduleResourceRequestImpl(InstrumentingAgents*, const String& url, Frame*);
310     static void didInstallTimerImpl(InstrumentingAgents*, int timerId, int timeout, bool singleShot, ScriptExecutionContext*);
311     static void didRemoveTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
312
313     static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents*, const String& scriptName, int scriptLine, ScriptExecutionContext*);
314     static void didCallFunctionImpl(const InspectorInstrumentationCookie&);
315     static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
316     static void didDispatchXHRReadyStateChangeEventImpl(const InspectorInstrumentationCookie&);
317     static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents*, const Event&, DOMWindow*, Node*, const Vector<EventContext>& ancestors, Document*);
318     static InspectorInstrumentationCookie willHandleEventImpl(InstrumentingAgents*, Event*);
319     static void didHandleEventImpl(const InspectorInstrumentationCookie&);
320     static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
321     static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents*, const Event&, DOMWindow*);
322     static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
323     static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents*, const String& url, int lineNumber, Frame*);
324     static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&);
325     static void didCreateIsolatedContextImpl(InstrumentingAgents*, Frame*, ScriptState*, SecurityOrigin*);
326     static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
327     static void didFireTimerImpl(const InspectorInstrumentationCookie&);
328     static void didBeginFrameImpl(InstrumentingAgents*);
329     static void didCancelFrameImpl(InstrumentingAgents*);
330     static void didInvalidateLayoutImpl(InstrumentingAgents*, Frame*);
331     static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents*, Frame*);
332     static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject*);
333     static void didScrollImpl(InstrumentingAgents*);
334     static InspectorInstrumentationCookie willDispatchXHRLoadEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
335     static void didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie&);
336     static void willScrollLayerImpl(InstrumentingAgents*, Frame*);
337     static void didScrollLayerImpl(InstrumentingAgents*);
338     static InspectorInstrumentationCookie willPaintImpl(InstrumentingAgents*, Frame*);
339     static void didPaintImpl(const InspectorInstrumentationCookie&, GraphicsContext*, const LayoutRect&);
340     static void willCompositeImpl(InstrumentingAgents*);
341     static void didCompositeImpl(InstrumentingAgents*);
342     static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*);
343     static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
344     static void didScheduleStyleRecalculationImpl(InstrumentingAgents*, Document*);
345     static InspectorInstrumentationCookie willMatchRuleImpl(InstrumentingAgents*, const StyleRule*);
346     static void didMatchRuleImpl(const InspectorInstrumentationCookie&, bool matched);
347     static InspectorInstrumentationCookie willProcessRuleImpl(InstrumentingAgents*, const StyleRule*);
348     static void didProcessRuleImpl(const InspectorInstrumentationCookie&);
349
350     static void applyUserAgentOverrideImpl(InstrumentingAgents*, String*);
351     static void applyScreenWidthOverrideImpl(InstrumentingAgents*, long*);
352     static void applyScreenHeightOverrideImpl(InstrumentingAgents*, long*);
353     static bool shouldApplyScreenWidthOverrideImpl(InstrumentingAgents*);
354     static bool shouldApplyScreenHeightOverrideImpl(InstrumentingAgents*);
355     static void willSendRequestImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
356     static void continueAfterPingLoaderImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
357     static void markResourceAsCachedImpl(InstrumentingAgents*, unsigned long identifier);
358     static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents*, DocumentLoader*, CachedResource*);
359     static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents*, unsigned long identifier, Frame*, int length);
360     static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
361     static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Frame*);
362     static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
363     static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
364     static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
365     static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
366     static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
367     static void didReceiveDataImpl(InstrumentingAgents*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
368     static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, double finishTime);
369     static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, const ResourceError&);
370     static void documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents*, unsigned long identifier, ThreadableLoaderClient*);
371     static void willLoadXHRImpl(InstrumentingAgents*, ThreadableLoaderClient*, const String&, const KURL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
372     static void didFailXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*);
373     static void didFinishXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
374     static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier);
375     static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*);
376     static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*);
377     static void scriptImportedImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString);
378     static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents*, const String& directiveText);
379     static void didReceiveScriptResponseImpl(InstrumentingAgents*, unsigned long identifier);
380     static void domContentLoadedEventFiredImpl(InstrumentingAgents*, Frame*);
381     static void loadEventFiredImpl(InstrumentingAgents*, Frame*);
382     static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*);
383     static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*);
384     static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*);
385     static void willDestroyCachedResourceImpl(CachedResource*);
386
387     static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents*, unsigned int length, unsigned int startLine, Frame*);
388     static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned int endLine);
389
390     static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, ScriptState*, PassRefPtr<ScriptArguments>, unsigned long requestIdentifier);
391     static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptId, unsigned lineNumber, unsigned long requestIdentifier);
392
393     // FIXME: Remove once we no longer generate stacks outside of Inspector.
394     static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier);
395
396     static void consoleCountImpl(InstrumentingAgents*, ScriptState*, PassRefPtr<ScriptArguments>);
397     static void startConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title);
398     static void stopConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title, PassRefPtr<ScriptCallStack>);
399     static void consoleTimeStampImpl(InstrumentingAgents*, Frame*, PassRefPtr<ScriptArguments>);
400
401     static void didRequestAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
402     static void didCancelAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
403     static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
404     static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&);
405
406 #if ENABLE(JAVASCRIPT_DEBUGGER)
407     static void addStartProfilingMessageToConsoleImpl(InstrumentingAgents*, const String& title, unsigned lineNumber, const String& sourceURL);
408     static void addProfileImpl(InstrumentingAgents*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
409     static String getCurrentUserInitiatedProfileNameImpl(InstrumentingAgents*, bool incrementProfileNumber);
410     static bool profilerEnabledImpl(InstrumentingAgents*);
411 #endif
412
413 #if ENABLE(SQL_DATABASE)
414     static void didOpenDatabaseImpl(InstrumentingAgents*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
415 #endif
416
417     static void didUseDOMStorageImpl(InstrumentingAgents*, StorageArea*, bool isLocalStorage, Frame*);
418     static void didDispatchDOMStorageEventImpl(InstrumentingAgents*, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
419
420 #if ENABLE(WORKERS)
421     static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents*);
422     static void didStartWorkerContextImpl(InstrumentingAgents*, WorkerContextProxy*, const KURL&);
423     static void workerContextTerminatedImpl(InstrumentingAgents*, WorkerContextProxy*);
424 #endif
425
426 #if ENABLE(WEB_SOCKETS)
427     static void didCreateWebSocketImpl(InstrumentingAgents*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
428     static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeRequest&);
429     static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeResponse&);
430     static void didCloseWebSocketImpl(InstrumentingAgents*, unsigned long identifier);
431     static void didReceiveWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
432     static void didSendWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
433     static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents*, unsigned long identifier, const String&);
434 #endif
435
436     static void networkStateChangedImpl(InstrumentingAgents*);
437     static void updateApplicationCacheStatusImpl(InstrumentingAgents*, Frame*);
438
439     static InstrumentingAgents* instrumentingAgentsForPage(Page*);
440     static InstrumentingAgents* instrumentingAgentsForFrame(Frame*);
441     static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*);
442     static InstrumentingAgents* instrumentingAgentsForDocument(Document*);
443 #if ENABLE(WORKERS)
444     static InstrumentingAgents* instrumentingAgentsForWorkerContext(WorkerContext*);
445     static InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ScriptExecutionContext*);
446 #endif
447
448     static bool collectingHTMLParseErrors(InstrumentingAgents*);
449     static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, bool isDOMEvent, const String& eventName, bool synchronous);
450     static void cancelPauseOnNativeEvent(InstrumentingAgents*);
451     static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
452
453 #if ENABLE(GEOLOCATION)
454     static GeolocationPosition* overrideGeolocationPositionImpl(InstrumentingAgents*, GeolocationPosition*);
455 #endif
456
457     static DeviceOrientationData* overrideDeviceOrientationImpl(InstrumentingAgents*, DeviceOrientationData*);
458     static int s_frontendCounter;
459 #endif
460 };
461
462 inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
463 {
464 #if ENABLE(INSPECTOR)
465     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
466         didClearWindowObjectInWorldImpl(instrumentingAgents, frame, world);
467 #endif
468 }
469
470 inline bool InspectorInstrumentation::isDebuggerPaused(Frame* frame)
471 {
472 #if ENABLE(INSPECTOR)
473     FAST_RETURN_IF_NO_FRONTENDS(false);
474     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
475         return isDebuggerPausedImpl(instrumentingAgents);
476 #endif
477     return false;
478 }
479
480 inline void InspectorInstrumentation::willInsertDOMNode(Document* document, Node* parent)
481 {
482 #if ENABLE(INSPECTOR)
483     FAST_RETURN_IF_NO_FRONTENDS(void());
484     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
485         willInsertDOMNodeImpl(instrumentingAgents, parent);
486 #endif
487 }
488
489 inline void InspectorInstrumentation::didInsertDOMNode(Document* document, Node* node)
490 {
491 #if ENABLE(INSPECTOR)
492     FAST_RETURN_IF_NO_FRONTENDS(void());
493     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
494         didInsertDOMNodeImpl(instrumentingAgents, node);
495 #endif
496 }
497
498 inline void InspectorInstrumentation::willRemoveDOMNode(Document* document, Node* node)
499 {
500 #if ENABLE(INSPECTOR)
501     FAST_RETURN_IF_NO_FRONTENDS(void());
502     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) {
503         willRemoveDOMNodeImpl(instrumentingAgents, node);
504         didRemoveDOMNodeImpl(instrumentingAgents, node);
505     }
506 #endif
507 }
508
509 inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element, const AtomicString& oldValue, const AtomicString& newValue)
510 {
511 #if ENABLE(INSPECTOR)
512     FAST_RETURN_IF_NO_FRONTENDS(void());
513     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
514         willModifyDOMAttrImpl(instrumentingAgents, element, oldValue, newValue);
515 #endif
516 }
517
518 inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element, const AtomicString& name, const AtomicString& value)
519 {
520 #if ENABLE(INSPECTOR)
521     FAST_RETURN_IF_NO_FRONTENDS(void());
522     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
523         didModifyDOMAttrImpl(instrumentingAgents, element, name, value);
524 #endif
525 }
526
527 inline void InspectorInstrumentation::didRemoveDOMAttr(Document* document, Element* element, const AtomicString& name)
528 {
529 #if ENABLE(INSPECTOR)
530     FAST_RETURN_IF_NO_FRONTENDS(void());
531     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
532         didRemoveDOMAttrImpl(instrumentingAgents, element, name);
533 #endif
534 }
535
536 inline void InspectorInstrumentation::didInvalidateStyleAttr(Document* document, Node* node)
537 {
538 #if ENABLE(INSPECTOR)
539     FAST_RETURN_IF_NO_FRONTENDS(void());
540     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
541         didInvalidateStyleAttrImpl(instrumentingAgents, node);
542 #endif
543 }
544
545 inline void InspectorInstrumentation::frameWindowDiscarded(Frame* frame, DOMWindow* domWindow)
546 {
547 #if ENABLE(INSPECTOR)
548     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
549         frameWindowDiscardedImpl(instrumentingAgents, domWindow);
550 #endif
551 }
552
553 inline void InspectorInstrumentation::mediaQueryResultChanged(Document* document)
554 {
555 #if ENABLE(INSPECTOR)
556     FAST_RETURN_IF_NO_FRONTENDS(void());
557     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
558         mediaQueryResultChangedImpl(instrumentingAgents);
559 #endif
560 }
561
562 inline void InspectorInstrumentation::didPushShadowRoot(Element* host, ShadowRoot* root)
563 {
564 #if ENABLE(INSPECTOR)
565     FAST_RETURN_IF_NO_FRONTENDS(void());
566     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host->ownerDocument()))
567         didPushShadowRootImpl(instrumentingAgents, host, root);
568 #endif
569 }
570
571 inline void InspectorInstrumentation::willPopShadowRoot(Element* host, ShadowRoot* root)
572 {
573 #if ENABLE(INSPECTOR)
574     FAST_RETURN_IF_NO_FRONTENDS(void());
575     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host->ownerDocument()))
576         willPopShadowRootImpl(instrumentingAgents, host, root);
577 #endif
578 }
579
580 inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
581 {
582 #if ENABLE(INSPECTOR)
583     FAST_RETURN_IF_NO_FRONTENDS(void());
584     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
585         didCreateNamedFlowImpl(instrumentingAgents, document, namedFlow);
586 #endif
587 }
588
589 inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
590 {
591 #if ENABLE(INSPECTOR)
592     FAST_RETURN_IF_NO_FRONTENDS(void());
593     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
594         willRemoveNamedFlowImpl(instrumentingAgents, document, namedFlow);
595 #endif
596 }
597
598 inline void InspectorInstrumentation::didUpdateRegionLayout(Document* document, WebKitNamedFlow* namedFlow)
599 {
600 #if ENABLE(INSPECTOR)
601     FAST_RETURN_IF_NO_FRONTENDS(void());
602     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
603         didUpdateRegionLayoutImpl(instrumentingAgents, document, namedFlow);
604 #endif
605 }
606
607 inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const HitTestResult& result, unsigned modifierFlags)
608 {
609 #if ENABLE(INSPECTOR)
610     FAST_RETURN_IF_NO_FRONTENDS(void());
611     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
612         mouseDidMoveOverElementImpl(instrumentingAgents, result, modifierFlags);
613 #endif
614 }
615
616 inline bool InspectorInstrumentation::handleTouchEvent(Page* page, Node* node)
617 {
618 #if ENABLE(INSPECTOR)
619     FAST_RETURN_IF_NO_FRONTENDS(false);
620     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
621         return handleTouchEventImpl(instrumentingAgents, node);
622 #endif
623     return false;
624 }
625
626 inline bool InspectorInstrumentation::handleMousePress(Page* page)
627 {
628 #if ENABLE(INSPECTOR)
629     FAST_RETURN_IF_NO_FRONTENDS(false);
630     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
631         return handleMousePressImpl(instrumentingAgents);
632 #endif
633     return false;
634 }
635
636 inline bool InspectorInstrumentation::forcePseudoState(Element* element, CSSSelector::PseudoType pseudoState)
637 {
638 #if ENABLE(INSPECTOR)
639     FAST_RETURN_IF_NO_FRONTENDS(false);
640     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(element->document()))
641         return forcePseudoStateImpl(instrumentingAgents, element, pseudoState);
642 #endif
643     return false;
644 }
645
646 inline void InspectorInstrumentation::characterDataModified(Document* document, CharacterData* characterData)
647 {
648 #if ENABLE(INSPECTOR)
649     FAST_RETURN_IF_NO_FRONTENDS(void());
650     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
651         characterDataModifiedImpl(instrumentingAgents, characterData);
652 #endif
653 }
654
655 inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url)
656 {
657 #if ENABLE(INSPECTOR)
658     FAST_RETURN_IF_NO_FRONTENDS(void());
659     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
660         willSendXMLHttpRequestImpl(instrumentingAgents, url);
661 #endif
662 }
663
664 inline void InspectorInstrumentation::didScheduleResourceRequest(Document* document, const String& url)
665 {
666 #if ENABLE(INSPECTOR)
667     FAST_RETURN_IF_NO_FRONTENDS(void());
668     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
669         didScheduleResourceRequestImpl(instrumentingAgents, url, document->frame());
670 #endif
671 }
672
673 inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot)
674 {
675 #if ENABLE(INSPECTOR)
676     FAST_RETURN_IF_NO_FRONTENDS(void());
677     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
678         didInstallTimerImpl(instrumentingAgents, timerId, timeout, singleShot, context);
679 #endif
680 }
681
682 inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* context, int timerId)
683 {
684 #if ENABLE(INSPECTOR)
685     FAST_RETURN_IF_NO_FRONTENDS(void());
686     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
687         didRemoveTimerImpl(instrumentingAgents, timerId, context);
688 #endif
689 }
690
691 inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine)
692 {
693 #if ENABLE(INSPECTOR)
694     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
695     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
696         return willCallFunctionImpl(instrumentingAgents, scriptName, scriptLine, context);
697 #endif
698     return InspectorInstrumentationCookie();
699 }
700
701
702 inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie)
703 {
704 #if ENABLE(INSPECTOR)
705     FAST_RETURN_IF_NO_FRONTENDS(void());
706     if (cookie.first)
707         didCallFunctionImpl(cookie);
708 #endif
709 }
710
711 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
712 {
713 #if ENABLE(INSPECTOR)
714     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
715     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
716         return willDispatchXHRReadyStateChangeEventImpl(instrumentingAgents, request, context);
717 #endif
718     return InspectorInstrumentationCookie();
719 }
720
721 inline void InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie& cookie)
722 {
723 #if ENABLE(INSPECTOR)
724     FAST_RETURN_IF_NO_FRONTENDS(void());
725     if (cookie.first)
726         didDispatchXHRReadyStateChangeEventImpl(cookie);
727 #endif
728 }
729
730 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
731 {
732 #if ENABLE(INSPECTOR)
733     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
734     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
735         return willDispatchEventImpl(instrumentingAgents, event, window, node, ancestors, document);
736 #endif
737     return InspectorInstrumentationCookie();
738 }
739
740 inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrumentationCookie& cookie)
741 {
742 #if ENABLE(INSPECTOR)
743     FAST_RETURN_IF_NO_FRONTENDS(void());
744     if (cookie.first)
745         didDispatchEventImpl(cookie);
746 #endif
747 }
748
749 inline InspectorInstrumentationCookie InspectorInstrumentation::willHandleEvent(ScriptExecutionContext* context, Event* event)
750 {
751 #if ENABLE(INSPECTOR)
752     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
753     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
754         return willHandleEventImpl(instrumentingAgents, event);
755 #endif
756     return InspectorInstrumentationCookie();
757 }
758
759 inline void InspectorInstrumentation::didHandleEvent(const InspectorInstrumentationCookie& cookie)
760 {
761 #if ENABLE(INSPECTOR)
762     FAST_RETURN_IF_NO_FRONTENDS(void());
763     if (cookie.first)
764         didHandleEventImpl(cookie);
765 #endif
766 }
767
768 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window)
769 {
770 #if ENABLE(INSPECTOR)
771     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
772     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
773         return willDispatchEventOnWindowImpl(instrumentingAgents, event, window);
774 #endif
775     return InspectorInstrumentationCookie();
776 }
777
778 inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorInstrumentationCookie& cookie)
779 {
780 #if ENABLE(INSPECTOR)
781     FAST_RETURN_IF_NO_FRONTENDS(void());
782     if (cookie.first)
783         didDispatchEventOnWindowImpl(cookie);
784 #endif
785 }
786
787 inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame* frame, const String& url, int lineNumber)
788 {
789 #if ENABLE(INSPECTOR)
790     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
791     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
792         return willEvaluateScriptImpl(instrumentingAgents, url, lineNumber, frame);
793 #endif
794     return InspectorInstrumentationCookie();
795 }
796
797 inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie)
798 {
799 #if ENABLE(INSPECTOR)
800     FAST_RETURN_IF_NO_FRONTENDS(void());
801     if (cookie.first)
802         didEvaluateScriptImpl(cookie);
803 #endif
804 }
805
806 inline void InspectorInstrumentation::didCreateIsolatedContext(Frame* frame, ScriptState* scriptState, SecurityOrigin* origin)
807 {
808 #if ENABLE(INSPECTOR)
809     FAST_RETURN_IF_NO_FRONTENDS(void());
810     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
811         return didCreateIsolatedContextImpl(instrumentingAgents, frame, scriptState, origin);
812 #endif
813 }
814
815 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId)
816 {
817 #if ENABLE(INSPECTOR)
818     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
819     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
820         return willFireTimerImpl(instrumentingAgents, timerId, context);
821 #endif
822     return InspectorInstrumentationCookie();
823 }
824
825 inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentationCookie& cookie)
826 {
827 #if ENABLE(INSPECTOR)
828     FAST_RETURN_IF_NO_FRONTENDS(void());
829     if (cookie.first)
830         didFireTimerImpl(cookie);
831 #endif
832 }
833
834 inline void InspectorInstrumentation::didBeginFrame(Page* page)
835 {
836 #if ENABLE(INSPECTOR)
837     FAST_RETURN_IF_NO_FRONTENDS(void());
838     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
839         didBeginFrameImpl(instrumentingAgents);
840 #endif
841 }
842
843 inline void InspectorInstrumentation::didCancelFrame(Page* page)
844 {
845 #if ENABLE(INSPECTOR)
846     FAST_RETURN_IF_NO_FRONTENDS(void());
847     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
848         didCancelFrameImpl(instrumentingAgents);
849 #endif
850 }
851
852 inline void InspectorInstrumentation::didInvalidateLayout(Frame* frame)
853 {
854 #if ENABLE(INSPECTOR)
855     FAST_RETURN_IF_NO_FRONTENDS(void());
856     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
857         didInvalidateLayoutImpl(instrumentingAgents, frame);
858 #endif
859 }
860
861 inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame)
862 {
863 #if ENABLE(INSPECTOR)
864     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
865     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
866         return willLayoutImpl(instrumentingAgents, frame);
867 #endif
868     return InspectorInstrumentationCookie();
869 }
870
871 inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie, RenderObject* root)
872 {
873 #if ENABLE(INSPECTOR)
874     FAST_RETURN_IF_NO_FRONTENDS(void());
875     if (cookie.first)
876         didLayoutImpl(cookie, root);
877 #endif
878 }
879
880 inline void InspectorInstrumentation::didScroll(Page* page)
881 {
882 #if ENABLE(INSPECTOR)
883     FAST_RETURN_IF_NO_FRONTENDS(void());
884     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
885         didScrollImpl(instrumentingAgents);
886 #endif
887 }
888
889 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
890 {
891 #if ENABLE(INSPECTOR)
892     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
893     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
894         return willDispatchXHRLoadEventImpl(instrumentingAgents, request, context);
895 #endif
896     return InspectorInstrumentationCookie();
897 }
898
899 inline void InspectorInstrumentation::didDispatchXHRLoadEvent(const InspectorInstrumentationCookie& cookie)
900 {
901 #if ENABLE(INSPECTOR)
902     FAST_RETURN_IF_NO_FRONTENDS(void());
903     if (cookie.first)
904         didDispatchXHRLoadEventImpl(cookie);
905 #endif
906 }
907
908 inline InspectorInstrumentationCookie InspectorInstrumentation::willPaint(Frame* frame)
909 {
910 #if ENABLE(INSPECTOR)
911     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
912     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
913         return willPaintImpl(instrumentingAgents, frame);
914 #endif
915     return InspectorInstrumentationCookie();
916 }
917
918 inline void InspectorInstrumentation::didPaint(const InspectorInstrumentationCookie& cookie, GraphicsContext* context, const LayoutRect& rect)
919 {
920 #if ENABLE(INSPECTOR)
921     FAST_RETURN_IF_NO_FRONTENDS(void());
922     if (cookie.first)
923         didPaintImpl(cookie, context, rect);
924 #endif
925 }
926
927 inline void InspectorInstrumentation::willScrollLayer(Frame* frame)
928 {
929 #if ENABLE(INSPECTOR)
930     FAST_RETURN_IF_NO_FRONTENDS(void());
931     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
932         willScrollLayerImpl(instrumentingAgents, frame);
933 #endif
934 }
935
936 inline void InspectorInstrumentation::didScrollLayer(Frame* frame)
937 {
938 #if ENABLE(INSPECTOR)
939     FAST_RETURN_IF_NO_FRONTENDS(void());
940     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
941         didScrollLayerImpl(instrumentingAgents);
942 #endif
943 }
944
945 inline void InspectorInstrumentation::willComposite(Page* page)
946 {
947 #if ENABLE(INSPECTOR)
948     FAST_RETURN_IF_NO_FRONTENDS(void());
949     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
950         willCompositeImpl(instrumentingAgents);
951 #endif
952 }
953
954 inline void InspectorInstrumentation::didComposite(Page* page)
955 {
956 #if ENABLE(INSPECTOR)
957     FAST_RETURN_IF_NO_FRONTENDS(void());
958     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
959         didCompositeImpl(instrumentingAgents);
960 #endif
961 }
962
963 inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document)
964 {
965 #if ENABLE(INSPECTOR)
966     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
967     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
968         return willRecalculateStyleImpl(instrumentingAgents, document->frame());
969 #endif
970     return InspectorInstrumentationCookie();
971 }
972
973 inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie)
974 {
975 #if ENABLE(INSPECTOR)
976     FAST_RETURN_IF_NO_FRONTENDS(void());
977     if (cookie.first)
978         didRecalculateStyleImpl(cookie);
979 #endif
980 }
981
982 inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document* document)
983 {
984 #if ENABLE(INSPECTOR)
985     FAST_RETURN_IF_NO_FRONTENDS(void());
986     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
987         didScheduleStyleRecalculationImpl(instrumentingAgents, document);
988 #endif
989 }
990
991 inline InspectorInstrumentationCookie InspectorInstrumentation::willMatchRule(Document* document, const StyleRule* rule)
992 {
993 #if ENABLE(INSPECTOR)
994     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
995     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
996         return willMatchRuleImpl(instrumentingAgents, rule);
997 #endif
998     return InspectorInstrumentationCookie();
999 }
1000
1001 inline void InspectorInstrumentation::didMatchRule(const InspectorInstrumentationCookie& cookie, bool matched)
1002 {
1003 #if ENABLE(INSPECTOR)
1004     FAST_RETURN_IF_NO_FRONTENDS(void());
1005     if (cookie.first)
1006         didMatchRuleImpl(cookie, matched);
1007 #endif
1008 }
1009
1010 inline InspectorInstrumentationCookie InspectorInstrumentation::willProcessRule(Document* document, const StyleRule* rule)
1011 {
1012 #if ENABLE(INSPECTOR)
1013     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1014     if (!rule)
1015         return InspectorInstrumentationCookie();
1016     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1017         return willProcessRuleImpl(instrumentingAgents, rule);
1018 #endif
1019     return InspectorInstrumentationCookie();
1020 }
1021
1022 inline void InspectorInstrumentation::didProcessRule(const InspectorInstrumentationCookie& cookie)
1023 {
1024 #if ENABLE(INSPECTOR)
1025     FAST_RETURN_IF_NO_FRONTENDS(void());
1026     if (cookie.first)
1027         didProcessRuleImpl(cookie);
1028 #endif
1029 }
1030
1031 inline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, String* userAgent)
1032 {
1033 #if ENABLE(INSPECTOR)
1034     FAST_RETURN_IF_NO_FRONTENDS(void());
1035     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1036         applyUserAgentOverrideImpl(instrumentingAgents, userAgent);
1037 #endif
1038 }
1039
1040 inline void InspectorInstrumentation::applyScreenWidthOverride(Frame* frame, long* width)
1041 {
1042 #if ENABLE(INSPECTOR)
1043     FAST_RETURN_IF_NO_FRONTENDS(void());
1044     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1045         applyScreenWidthOverrideImpl(instrumentingAgents, width);
1046 #endif
1047 }
1048
1049 inline void InspectorInstrumentation::applyScreenHeightOverride(Frame* frame, long* height)
1050 {
1051 #if ENABLE(INSPECTOR)
1052     FAST_RETURN_IF_NO_FRONTENDS(void());
1053     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1054         applyScreenHeightOverrideImpl(instrumentingAgents, height);
1055 #endif
1056 }
1057
1058 inline bool InspectorInstrumentation::shouldApplyScreenWidthOverride(Frame* frame)
1059 {
1060 #if ENABLE(INSPECTOR)
1061     FAST_RETURN_IF_NO_FRONTENDS(false);
1062     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1063         return shouldApplyScreenWidthOverrideImpl(instrumentingAgents);
1064 #endif
1065     return false;
1066 }
1067
1068 inline bool InspectorInstrumentation::shouldApplyScreenHeightOverride(Frame* frame)
1069 {
1070 #if ENABLE(INSPECTOR)
1071     FAST_RETURN_IF_NO_FRONTENDS(false);
1072     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1073         return shouldApplyScreenHeightOverrideImpl(instrumentingAgents);
1074 #endif
1075     return false;
1076 }
1077
1078 inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
1079 {
1080 #if ENABLE(INSPECTOR)
1081     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1082         willSendRequestImpl(instrumentingAgents, identifier, loader, request, redirectResponse);
1083 #endif
1084 }
1085
1086 inline void InspectorInstrumentation::continueAfterPingLoader(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
1087 {
1088 #if ENABLE(INSPECTOR)
1089     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1090         InspectorInstrumentation::continueAfterPingLoaderImpl(instrumentingAgents, identifier, loader, request, response);
1091 #endif
1092 }
1093
1094 inline void InspectorInstrumentation::markResourceAsCached(Page* page, unsigned long identifier)
1095 {
1096 #if ENABLE(INSPECTOR)
1097     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1098         markResourceAsCachedImpl(instrumentingAgents, identifier);
1099 #endif
1100 }
1101
1102 inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, CachedResource* resource)
1103 {
1104 #if ENABLE(INSPECTOR)
1105     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1106         didLoadResourceFromMemoryCacheImpl(instrumentingAgents, loader, resource);
1107 #endif
1108 }
1109
1110 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier, int length)
1111 {
1112 #if ENABLE(INSPECTOR)
1113     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1114     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1115         return willReceiveResourceDataImpl(instrumentingAgents, identifier, frame, length);
1116 #endif
1117     return InspectorInstrumentationCookie();
1118 }
1119
1120 inline void InspectorInstrumentation::didReceiveResourceData(const InspectorInstrumentationCookie& cookie)
1121 {
1122 #if ENABLE(INSPECTOR)
1123     FAST_RETURN_IF_NO_FRONTENDS(void());
1124     if (cookie.first)
1125         didReceiveResourceDataImpl(cookie);
1126 #endif
1127 }
1128
1129 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame, unsigned long identifier, const ResourceResponse& response)
1130 {
1131 #if ENABLE(INSPECTOR)
1132     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1133         return willReceiveResourceResponseImpl(instrumentingAgents, identifier, response, frame);
1134 #endif
1135     return InspectorInstrumentationCookie();
1136 }
1137
1138 inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
1139 {
1140 #if ENABLE(INSPECTOR)
1141     // Call this unconditionally so that we're able to log to console with no front-end attached.
1142     didReceiveResourceResponseImpl(cookie, identifier, loader, response, resourceLoader);
1143 #endif
1144 }
1145
1146 inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1147 {
1148 #if ENABLE(INSPECTOR)
1149     FAST_RETURN_IF_NO_FRONTENDS(void());
1150     InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(frame, loader, identifier, r);
1151 #endif
1152 }
1153
1154 inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1155 {
1156 #if ENABLE(INSPECTOR)
1157     FAST_RETURN_IF_NO_FRONTENDS(void());
1158     InspectorInstrumentation::continueWithPolicyDownloadImpl(frame, loader, identifier, r);
1159 #endif
1160 }
1161
1162 inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1163 {
1164 #if ENABLE(INSPECTOR)
1165     FAST_RETURN_IF_NO_FRONTENDS(void());
1166     InspectorInstrumentation::continueWithPolicyIgnoreImpl(frame, loader, identifier, r);
1167 #endif
1168 }
1169
1170 inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
1171 {
1172 #if ENABLE(INSPECTOR)
1173     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1174         didReceiveDataImpl(instrumentingAgents, identifier, data, dataLength, encodedDataLength);
1175 #endif
1176 }
1177
1178 inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, double finishTime)
1179 {
1180 #if ENABLE(INSPECTOR)
1181     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1182         didFinishLoadingImpl(instrumentingAgents, identifier, loader, finishTime);
1183 #endif
1184 }
1185
1186 inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
1187 {
1188 #if ENABLE(INSPECTOR)
1189     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1190         didFailLoadingImpl(instrumentingAgents, identifier, loader, error);
1191 #endif
1192 }
1193
1194 inline void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext* context, unsigned long identifier, ThreadableLoaderClient* client)
1195 {
1196 #if ENABLE(INSPECTOR)
1197     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1198         documentThreadableLoaderStartedLoadingForClientImpl(instrumentingAgents, identifier, client);
1199 #endif
1200 }
1201
1202 inline void InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* context, ThreadableLoaderClient* client, const String& method, const KURL& url, bool async, PassRefPtr<FormData> formData, const HTTPHeaderMap& headers, bool includeCredentials)
1203 {
1204 #if ENABLE(INSPECTOR)
1205     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1206         willLoadXHRImpl(instrumentingAgents, client, method, url, async, formData, headers, includeCredentials);
1207 #endif
1208 }
1209
1210 inline void InspectorInstrumentation::didFailXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client)
1211 {
1212 #if ENABLE(INSPECTOR)
1213     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1214         didFailXHRLoadingImpl(instrumentingAgents, client);
1215 #endif
1216 }
1217
1218
1219 inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
1220 {
1221 #if ENABLE(INSPECTOR)
1222     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1223         didFinishXHRLoadingImpl(instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber);
1224 #endif
1225 }
1226
1227 inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionContext* context, unsigned long identifier)
1228 {
1229 #if ENABLE(INSPECTOR)
1230     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1231         didReceiveXHRResponseImpl(instrumentingAgents, identifier);
1232 #endif
1233 }
1234
1235 inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context)
1236 {
1237 #if ENABLE(INSPECTOR)
1238     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1239         willLoadXHRSynchronouslyImpl(instrumentingAgents);
1240 #endif
1241 }
1242
1243 inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context)
1244 {
1245 #if ENABLE(INSPECTOR)
1246     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1247         didLoadXHRSynchronouslyImpl(instrumentingAgents);
1248 #endif
1249 }
1250
1251 inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString)
1252 {
1253 #if ENABLE(INSPECTOR)
1254     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1255         scriptImportedImpl(instrumentingAgents, identifier, sourceString);
1256 #endif
1257 }
1258
1259 inline void InspectorInstrumentation::scriptExecutionBlockedByCSP(ScriptExecutionContext* context, const String& directiveText)
1260 {
1261 #if ENABLE(INSPECTOR)
1262     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1263         scriptExecutionBlockedByCSPImpl(instrumentingAgents, directiveText);
1264 #endif
1265 }
1266
1267 inline void InspectorInstrumentation::didReceiveScriptResponse(ScriptExecutionContext* context, unsigned long identifier)
1268 {
1269 #if ENABLE(INSPECTOR)
1270     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1271         didReceiveScriptResponseImpl(instrumentingAgents, identifier);
1272 #endif
1273 }
1274
1275 inline void InspectorInstrumentation::domContentLoadedEventFired(Frame* frame)
1276 {
1277 #if ENABLE(INSPECTOR)
1278     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1279         domContentLoadedEventFiredImpl(instrumentingAgents, frame);
1280 #endif
1281 }
1282
1283 inline void InspectorInstrumentation::loadEventFired(Frame* frame)
1284 {
1285 #if ENABLE(INSPECTOR)
1286     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1287         loadEventFiredImpl(instrumentingAgents, frame);
1288 #endif
1289 }
1290
1291 inline void InspectorInstrumentation::frameDetachedFromParent(Frame* frame)
1292 {
1293 #if ENABLE(INSPECTOR)
1294     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1295         frameDetachedFromParentImpl(instrumentingAgents, frame);
1296 #endif
1297 }
1298
1299 inline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader)
1300 {
1301 #if ENABLE(INSPECTOR)
1302     if (!frame)
1303         return;
1304     Page* page = frame->page();
1305     if (!page)
1306         return;
1307     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1308         didCommitLoadImpl(instrumentingAgents, page, loader);
1309 #endif
1310 }
1311
1312 inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame* frame, DocumentLoader* loader)
1313 {
1314 #if ENABLE(INSPECTOR)
1315     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1316         loaderDetachedFromFrameImpl(instrumentingAgents, loader);
1317 #endif
1318 }
1319
1320 inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource* cachedResource)
1321 {
1322 #if ENABLE(INSPECTOR)
1323     FAST_RETURN_IF_NO_FRONTENDS(void());
1324     willDestroyCachedResourceImpl(cachedResource);
1325 #endif
1326 }
1327
1328 inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned int length, unsigned int startLine)
1329 {
1330 #if ENABLE(INSPECTOR)
1331     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1332     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1333         return willWriteHTMLImpl(instrumentingAgents, length, startLine, document->frame());
1334 #endif
1335     return InspectorInstrumentationCookie();
1336 }
1337
1338 inline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentationCookie& cookie, unsigned int endLine)
1339 {
1340 #if ENABLE(INSPECTOR)
1341     FAST_RETURN_IF_NO_FRONTENDS(void());
1342     if (cookie.first)
1343         didWriteHTMLImpl(cookie, endLine);
1344 #endif
1345 }
1346
1347 inline void InspectorInstrumentation::didUseDOMStorage(Page* page, StorageArea* storageArea, bool isLocalStorage, Frame* frame)
1348 {
1349 #if ENABLE(INSPECTOR)
1350     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1351         didUseDOMStorageImpl(instrumentingAgents, storageArea, isLocalStorage, frame);
1352 #endif
1353 }
1354
1355 inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
1356 {
1357 #if ENABLE(INSPECTOR)
1358     FAST_RETURN_IF_NO_FRONTENDS(void());
1359     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1360         didDispatchDOMStorageEventImpl(instrumentingAgents, key, oldValue, newValue, storageType, securityOrigin, page);
1361 #endif // ENABLE(INSPECTOR)
1362 }
1363
1364 #if ENABLE(WORKERS)
1365 inline bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext* context)
1366 {
1367 #if ENABLE(INSPECTOR)
1368     FAST_RETURN_IF_NO_FRONTENDS(false);
1369     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1370         return shouldPauseDedicatedWorkerOnStartImpl(instrumentingAgents);
1371 #endif
1372     return false;
1373 }
1374
1375 inline void InspectorInstrumentation::didStartWorkerContext(ScriptExecutionContext* context, WorkerContextProxy* proxy, const KURL& url)
1376 {
1377 #if ENABLE(INSPECTOR)
1378     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1379         didStartWorkerContextImpl(instrumentingAgents, proxy, url);
1380 #endif
1381 }
1382
1383 inline void InspectorInstrumentation::workerContextTerminated(ScriptExecutionContext* context, WorkerContextProxy* proxy)
1384 {
1385 #if ENABLE(INSPECTOR)
1386     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1387         workerContextTerminatedImpl(instrumentingAgents, proxy);
1388 #endif
1389 }
1390
1391 #endif
1392
1393
1394 #if ENABLE(WEB_SOCKETS)
1395 inline void InspectorInstrumentation::didCreateWebSocket(ScriptExecutionContext* context, unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
1396 {
1397 #if ENABLE(INSPECTOR)
1398     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1399         didCreateWebSocketImpl(instrumentingAgents, identifier, requestURL, documentURL);
1400 #endif
1401 }
1402
1403 inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeRequest& request)
1404 {
1405 #if ENABLE(INSPECTOR)
1406     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1407         willSendWebSocketHandshakeRequestImpl(instrumentingAgents, identifier, request);
1408 #endif
1409 }
1410
1411 inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeResponse& response)
1412 {
1413 #if ENABLE(INSPECTOR)
1414     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1415         didReceiveWebSocketHandshakeResponseImpl(instrumentingAgents, identifier, response);
1416 #endif
1417 }
1418
1419 inline void InspectorInstrumentation::didCloseWebSocket(ScriptExecutionContext* context, unsigned long identifier)
1420 {
1421 #if ENABLE(INSPECTOR)
1422     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1423         didCloseWebSocketImpl(instrumentingAgents, identifier);
1424 #endif
1425 }
1426 inline void InspectorInstrumentation::didReceiveWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1427 {
1428 #if ENABLE(INSPECTOR)
1429     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1430         didReceiveWebSocketFrameImpl(instrumentingAgents, identifier, frame);
1431 #endif
1432 }
1433 inline void InspectorInstrumentation::didReceiveWebSocketFrameError(Document* document, unsigned long identifier, const String& errorMessage)
1434 {
1435 #if ENABLE(INSPECTOR)
1436     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1437         didReceiveWebSocketFrameErrorImpl(instrumentingAgents, identifier, errorMessage);
1438 #endif
1439 }
1440 inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1441 {
1442 #if ENABLE(INSPECTOR)
1443     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1444         didSendWebSocketFrameImpl(instrumentingAgents, identifier, frame);
1445 #endif
1446 }
1447 #endif
1448
1449 inline void InspectorInstrumentation::networkStateChanged(Page* page)
1450 {
1451 #if ENABLE(INSPECTOR)
1452     FAST_RETURN_IF_NO_FRONTENDS(void());
1453     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1454         networkStateChangedImpl(instrumentingAgents);
1455 #endif
1456 }
1457
1458 inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
1459 {
1460 #if ENABLE(INSPECTOR)
1461     FAST_RETURN_IF_NO_FRONTENDS(void());
1462     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1463         updateApplicationCacheStatusImpl(instrumentingAgents, frame);
1464 #endif
1465 }
1466
1467 inline void InspectorInstrumentation::didRequestAnimationFrame(Document* document, int callbackId)
1468 {
1469 #if ENABLE(INSPECTOR)
1470     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1471         didRequestAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
1472 #endif
1473 }
1474
1475 inline void InspectorInstrumentation::didCancelAnimationFrame(Document* document, int callbackId)
1476 {
1477 #if ENABLE(INSPECTOR)
1478     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1479         didCancelAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
1480 #endif
1481 }
1482
1483 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrame(Document* document, int callbackId)
1484 {
1485 #if ENABLE(INSPECTOR)
1486     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1487         return willFireAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
1488 #endif
1489     return InspectorInstrumentationCookie();
1490 }
1491
1492 inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstrumentationCookie& cookie)
1493 {
1494 #if ENABLE(INSPECTOR)
1495     FAST_RETURN_IF_NO_FRONTENDS(void());
1496     if (cookie.first)
1497         didFireAnimationFrameImpl(cookie);
1498 #endif
1499 }
1500
1501 #if ENABLE(GEOLOCATION)
1502 inline GeolocationPosition* InspectorInstrumentation::overrideGeolocationPosition(Page* page, GeolocationPosition* position)
1503 {
1504 #if ENABLE(INSPECTOR)
1505     FAST_RETURN_IF_NO_FRONTENDS(position);
1506     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1507         return overrideGeolocationPositionImpl(instrumentingAgents, position);
1508 #endif
1509     return position;
1510 }
1511 #endif
1512
1513 inline DeviceOrientationData* InspectorInstrumentation::overrideDeviceOrientation(Page* page, DeviceOrientationData* deviceOrientation)
1514 {
1515 #if ENABLE(INSPECTOR)
1516     FAST_RETURN_IF_NO_FRONTENDS(deviceOrientation);
1517     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1518         return overrideDeviceOrientationImpl(instrumentingAgents, deviceOrientation);
1519 #endif
1520     return deviceOrientation;
1521 }
1522
1523 #if ENABLE(INSPECTOR)
1524 inline bool InspectorInstrumentation::collectingHTMLParseErrors(Page* page)
1525 {
1526     FAST_RETURN_IF_NO_FRONTENDS(false);
1527     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1528         return collectingHTMLParseErrors(instrumentingAgents);
1529     return false;
1530 }
1531
1532 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context)
1533 {
1534     if (!context)
1535         return 0;
1536     if (context->isDocument())
1537         return instrumentingAgentsForPage(static_cast<Document*>(context)->page());
1538 #if ENABLE(WORKERS)
1539     return instrumentingAgentsForNonDocumentContext(context);
1540 #else
1541     return 0;
1542 #endif
1543 }
1544
1545 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame)
1546 {
1547     if (frame)
1548         return instrumentingAgentsForPage(frame->page());
1549     return 0;
1550 }
1551
1552 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document* document)
1553 {
1554     if (document)
1555         return instrumentingAgentsForPage(document->page());
1556     return 0;
1557 }
1558 #endif
1559
1560 } // namespace WebCore
1561
1562 #endif // !defined(InspectorInstrumentation_h)