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