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