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