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