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