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