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