[Refactoring] Implement RuleCollector
[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 "EventContext.h"
39 #include "FormData.h"
40 #include "Frame.h"
41 #include "HitTestResult.h"
42 #include "Page.h"
43 #include "ScriptExecutionContext.h"
44 #include "ScriptState.h"
45 #include "StorageArea.h"
46 #include "WebSocketFrame.h"
47 #include "WebSocketHandshakeRequest.h"
48 #include "WebSocketHandshakeResponse.h"
49 #include <wtf/RefPtr.h>
50 #include <wtf/UnusedParam.h>
51
52 namespace WebCore {
53
54 class CSSRule;
55 class CachedResource;
56 class CharacterData;
57 class DOMWindow;
58 class DOMWrapperWorld;
59 class Database;
60 class Document;
61 class Element;
62 class EventContext;
63 class DocumentLoader;
64 class DocumentStyleSheetCollection;
65 class DeviceOrientationData;
66 class GeolocationPosition;
67 class GraphicsContext;
68 class InspectorCSSAgent;
69 class InspectorCSSOMWrappers;
70 class InspectorInstrumentation;
71 class InspectorTimelineAgent;
72 class InstrumentingAgents;
73 class KURL;
74 class Node;
75 class PseudoElement;
76 class RenderLayer;
77 class RenderObject;
78 class ResourceRequest;
79 class ResourceResponse;
80 class ScriptArguments;
81 class ScriptCallStack;
82 class ScriptExecutionContext;
83 class ScriptObject;
84 class ScriptProfile;
85 class SecurityOrigin;
86 class ShadowRoot;
87 class StorageArea;
88 class StyleResolver;
89 class StyleRule;
90 class ThreadableLoaderClient;
91 class WorkerContext;
92 class WorkerContextProxy;
93 class XMLHttpRequest;
94
95 #define FAST_RETURN_IF_NO_FRONTENDS(value) if (!hasFrontends()) return value;
96
97 class InspectorInstrumentationCookie {
98 #if ENABLE(INSPECTOR)
99 public:
100     InspectorInstrumentationCookie();
101     InspectorInstrumentationCookie(InstrumentingAgents*, int);
102     InspectorInstrumentationCookie(const InspectorInstrumentationCookie&);
103     InspectorInstrumentationCookie& operator=(const InspectorInstrumentationCookie&);
104     ~InspectorInstrumentationCookie();
105
106 private:
107     friend class InspectorInstrumentation;
108     InstrumentingAgents* instrumentingAgents() const { return m_instrumentingAgents.get(); }
109     bool isValid() const { return !!m_instrumentingAgents; }
110     bool hasMatchingTimelineAgentId(int id) const { return m_timelineAgentId == id; }
111
112     RefPtr<InstrumentingAgents> m_instrumentingAgents;
113     int m_timelineAgentId;
114 #endif
115 };
116
117 class InspectorInstrumentation {
118 public:
119     static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
120     static bool isDebuggerPaused(Frame*);
121
122     static void willInsertDOMNode(Document*, Node* parent);
123     static void didInsertDOMNode(Document*, Node*);
124     static void willRemoveDOMNode(Document*, Node*);
125     static void willModifyDOMAttr(Document*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
126     static void didModifyDOMAttr(Document*, Element*, const AtomicString& name, const AtomicString& value);
127     static void didRemoveDOMAttr(Document*, Element*, const AtomicString& name);
128     static void characterDataModified(Document*, CharacterData*);
129     static void didInvalidateStyleAttr(Document*, Node*);
130     static void frameWindowDiscarded(Frame*, DOMWindow*);
131     static void mediaQueryResultChanged(Document*);
132     static void didPushShadowRoot(Element* host, ShadowRoot*);
133     static void willPopShadowRoot(Element* host, ShadowRoot*);
134     static void didCreateNamedFlow(Document*, WebKitNamedFlow*);
135     static void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
136     static void didUpdateRegionLayout(Document*, WebKitNamedFlow*);
137
138     static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
139     static bool handleMousePress(Page*);
140     static bool handleTouchEvent(Page*, Node*);
141     static bool forcePseudoState(Element*, CSSSelector::PseudoType);
142
143     static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
144     static void didScheduleResourceRequest(Document*, const String& url);
145     static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
146     static void didRemoveTimer(ScriptExecutionContext*, int timerId);
147
148     static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine);
149     static void didCallFunction(const InspectorInstrumentationCookie&);
150     static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext*, XMLHttpRequest*);
151     static void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&);
152     static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event&, DOMWindow*, Node*, const EventPath&);
153     static void didDispatchEvent(const InspectorInstrumentationCookie&);
154     static InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, Event*);
155     static void didHandleEvent(const InspectorInstrumentationCookie&);
156     static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
157     static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
158     static InspectorInstrumentationCookie willEvaluateScript(Frame*, const String& url, int lineNumber);
159     static void didEvaluateScript(const InspectorInstrumentationCookie&);
160     static void scriptsEnabled(Page*, bool isEnabled);
161     static void didCreateIsolatedContext(Frame*, ScriptState*, SecurityOrigin*);
162     static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext*, int timerId);
163     static void didFireTimer(const InspectorInstrumentationCookie&);
164     static void didInvalidateLayout(Frame*);
165     static InspectorInstrumentationCookie willLayout(Frame*);
166     static void didLayout(const InspectorInstrumentationCookie&, RenderObject*);
167     static void didScroll(Page*);
168     static InspectorInstrumentationCookie willDispatchXHRLoadEvent(ScriptExecutionContext*, XMLHttpRequest*);
169     static void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&);
170     static void willScrollLayer(Frame*);
171     static void didScrollLayer(Frame*);
172     static InspectorInstrumentationCookie willPaint(Frame*);
173     static void didPaint(const InspectorInstrumentationCookie&, GraphicsContext*, const LayoutRect&);
174     static void willComposite(Page*);
175     static void didComposite(Page*);
176     static InspectorInstrumentationCookie willRecalculateStyle(Document*);
177     static void didRecalculateStyle(const InspectorInstrumentationCookie&);
178     static void didScheduleStyleRecalculation(Document*);
179     static InspectorInstrumentationCookie willMatchRule(Document*, StyleRule*, InspectorCSSOMWrappers&, DocumentStyleSheetCollection*);
180     static void didMatchRule(const InspectorInstrumentationCookie&, bool matched);
181     static InspectorInstrumentationCookie willProcessRule(Document*, StyleRule*, StyleResolver*);
182     static void didProcessRule(const InspectorInstrumentationCookie&);
183
184     static void applyUserAgentOverride(Frame*, String*);
185     static void applyScreenWidthOverride(Frame*, long*);
186     static void applyScreenHeightOverride(Frame*, long*);
187     static void applyEmulatedMedia(Frame*, String*);
188     static bool shouldApplyScreenWidthOverride(Frame*);
189     static bool shouldApplyScreenHeightOverride(Frame*);
190     static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
191     static void continueAfterPingLoader(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
192     static void markResourceAsCached(Page*, unsigned long identifier);
193     static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, CachedResource*);
194     static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier, int length);
195     static void didReceiveResourceData(const InspectorInstrumentationCookie&);
196     static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&);
197     static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
198     static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
199     static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
200     static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
201     static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
202     static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime);
203     static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
204     static void documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext*, unsigned long identifier, ThreadableLoaderClient*);
205     static void willLoadXHR(ScriptExecutionContext*, ThreadableLoaderClient*, const String&, const KURL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
206     static void didFailXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*);
207     static void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
208     static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
209     static void willLoadXHRSynchronously(ScriptExecutionContext*);
210     static void didLoadXHRSynchronously(ScriptExecutionContext*);
211     static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString);
212     static void scriptExecutionBlockedByCSP(ScriptExecutionContext*, const String& directiveText);
213     static void didReceiveScriptResponse(ScriptExecutionContext*, unsigned long identifier);
214     static void domContentLoadedEventFired(Frame*);
215     static void loadEventFired(Frame*);
216     static void frameDetachedFromParent(Frame*);
217     static void didCommitLoad(Frame*, DocumentLoader*);
218     static void frameDocumentUpdated(Frame*);
219     static void loaderDetachedFromFrame(Frame*, DocumentLoader*);
220     static void frameStartedLoading(Frame*);
221     static void frameStoppedLoading(Frame*);
222     static void frameScheduledNavigation(Frame*, double delay);
223     static void frameClearedScheduledNavigation(Frame*);
224     static InspectorInstrumentationCookie willRunJavaScriptDialog(Page*, const String& message);
225     static void didRunJavaScriptDialog(const InspectorInstrumentationCookie&);
226     static void willDestroyCachedResource(CachedResource*);
227
228     static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned startLine);
229     static void didWriteHTML(const InspectorInstrumentationCookie&, unsigned endLine);
230
231     // FIXME: Remove once we no longer generate stacks outside of Inspector.
232     static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier = 0);
233     static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, ScriptState*, PassRefPtr<ScriptArguments>, unsigned long requestIdentifier = 0);
234     static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, const String&, unsigned lineNumber, ScriptState* = 0, unsigned long requestIdentifier = 0);
235 #if ENABLE(WORKERS)
236     // FIXME: Convert to ScriptArguments to match non-worker context.
237     static void addMessageToConsole(WorkerContext*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier = 0);
238     static void addMessageToConsole(WorkerContext*, MessageSource, MessageType, MessageLevel, const String& message, const String&, unsigned lineNumber, ScriptState* = 0, unsigned long requestIdentifier = 0);
239 #endif
240     static void consoleCount(Page*, ScriptState*, PassRefPtr<ScriptArguments>);
241     static void startConsoleTiming(Frame*, const String& title);
242     static void stopConsoleTiming(Frame*, const String& title, PassRefPtr<ScriptCallStack>);
243     static void consoleTimeStamp(Frame*, PassRefPtr<ScriptArguments>);
244
245     static void didRequestAnimationFrame(Document*, int callbackId);
246     static void didCancelAnimationFrame(Document*, int callbackId);
247     static InspectorInstrumentationCookie willFireAnimationFrame(Document*, int callbackId);
248     static void didFireAnimationFrame(const InspectorInstrumentationCookie&);
249
250 #if ENABLE(JAVASCRIPT_DEBUGGER)
251     static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, const String& sourceURL);
252     static void addProfile(Page*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
253     static String getCurrentUserInitiatedProfileName(Page*, bool incrementProfileNumber);
254     static bool profilerEnabled(Page*);
255 #endif
256
257 #if ENABLE(SQL_DATABASE)
258     static void didOpenDatabase(ScriptExecutionContext*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
259 #endif
260
261     static void didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
262
263 #if ENABLE(WORKERS)
264     static bool shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext*);
265     static void didStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*, const KURL&);
266     static void workerContextTerminated(ScriptExecutionContext*, WorkerContextProxy*);
267     static void willEvaluateWorkerScript(WorkerContext*, int workerThreadStartMode);
268 #endif
269
270 #if ENABLE(WEB_SOCKETS)
271     static void didCreateWebSocket(Document*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL, const String& protocol);
272     static void willSendWebSocketHandshakeRequest(Document*, unsigned long identifier, const WebSocketHandshakeRequest&);
273     static void didReceiveWebSocketHandshakeResponse(Document*, unsigned long identifier, const WebSocketHandshakeResponse&);
274     static void didCloseWebSocket(Document*, unsigned long identifier);
275     static void didReceiveWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&);
276     static void didSendWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&);
277     static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
278 #endif
279
280     static ScriptObject wrapCanvas2DRenderingContextForInstrumentation(Document*, const ScriptObject&);
281 #if ENABLE(WEBGL)
282     static ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptObject&);
283 #endif
284
285     static void networkStateChanged(Page*);
286     static void updateApplicationCacheStatus(Frame*);
287
288 #if ENABLE(INSPECTOR)
289     static void frontendCreated() { s_frontendCounter += 1; }
290     static void frontendDeleted() { s_frontendCounter -= 1; }
291     static bool hasFrontends() { return s_frontendCounter; }
292     static bool canvasAgentEnabled(ScriptExecutionContext*);
293     static bool consoleAgentEnabled(ScriptExecutionContext*);
294     static bool timelineAgentEnabled(ScriptExecutionContext*);
295     static bool collectingHTMLParseErrors(Page*);
296 #else
297     static bool hasFrontends() { return false; }
298     static bool canvasAgentEnabled(ScriptExecutionContext*) { return false; }
299     static bool consoleAgentEnabled(ScriptExecutionContext*) { return false; }
300     static bool runtimeAgentEnabled(Frame*) { return false; }
301     static bool timelineAgentEnabled(ScriptExecutionContext*) { return false; }
302     static bool collectingHTMLParseErrors(Page*) { return false; }
303 #endif
304
305 #if ENABLE(GEOLOCATION)
306     static GeolocationPosition* overrideGeolocationPosition(Page*, GeolocationPosition*);
307 #endif
308
309     static void registerInstrumentingAgents(InstrumentingAgents*);
310     static void unregisterInstrumentingAgents(InstrumentingAgents*);
311
312     static DeviceOrientationData* overrideDeviceOrientation(Page*, DeviceOrientationData*);
313
314 #if USE(ACCELERATED_COMPOSITING)
315     static void layerTreeDidChange(Page*);
316     static void renderLayerDestroyed(Page*, const RenderLayer*);
317     static void pseudoElementDestroyed(Page*, PseudoElement*);
318 #endif
319
320 private:
321 #if ENABLE(INSPECTOR)
322     static void didClearWindowObjectInWorldImpl(InstrumentingAgents*, Frame*, DOMWrapperWorld*);
323     static bool isDebuggerPausedImpl(InstrumentingAgents*);
324
325     static void willInsertDOMNodeImpl(InstrumentingAgents*, Node* parent);
326     static void didInsertDOMNodeImpl(InstrumentingAgents*, Node*);
327     static void willRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
328     static void didRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
329     static void willModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
330     static void didModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name, const AtomicString& value);
331     static void didRemoveDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name);
332     static void characterDataModifiedImpl(InstrumentingAgents*, CharacterData*);
333     static void didInvalidateStyleAttrImpl(InstrumentingAgents*, Node*);
334     static void frameWindowDiscardedImpl(InstrumentingAgents*, DOMWindow*);
335     static void mediaQueryResultChangedImpl(InstrumentingAgents*);
336     static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
337     static void willPopShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
338     static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
339     static void willRemoveNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
340     static void didUpdateRegionLayoutImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
341
342     static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags);
343     static bool handleTouchEventImpl(InstrumentingAgents*, Node*);
344     static bool handleMousePressImpl(InstrumentingAgents*);
345     static bool forcePseudoStateImpl(InstrumentingAgents*, Element*, CSSSelector::PseudoType);
346
347     static void willSendXMLHttpRequestImpl(InstrumentingAgents*, const String& url);
348     static void didScheduleResourceRequestImpl(InstrumentingAgents*, const String& url, Frame*);
349     static void didInstallTimerImpl(InstrumentingAgents*, int timerId, int timeout, bool singleShot, ScriptExecutionContext*);
350     static void didRemoveTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
351
352     static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents*, const String& scriptName, int scriptLine, ScriptExecutionContext*);
353     static void didCallFunctionImpl(const InspectorInstrumentationCookie&);
354     static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
355     static void didDispatchXHRReadyStateChangeEventImpl(const InspectorInstrumentationCookie&);
356     static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents*, const Event&, DOMWindow*, Node*, const EventPath&, Document*);
357     static InspectorInstrumentationCookie willHandleEventImpl(InstrumentingAgents*, Event*);
358     static void didHandleEventImpl(const InspectorInstrumentationCookie&);
359     static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
360     static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents*, const Event&, DOMWindow*);
361     static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
362     static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents*, const String& url, int lineNumber, Frame*);
363     static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&);
364     static void scriptsEnabledImpl(InstrumentingAgents*, bool isEnabled);
365     static void didCreateIsolatedContextImpl(InstrumentingAgents*, Frame*, ScriptState*, SecurityOrigin*);
366     static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
367     static void didFireTimerImpl(const InspectorInstrumentationCookie&);
368     static void didInvalidateLayoutImpl(InstrumentingAgents*, Frame*);
369     static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents*, Frame*);
370     static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject*);
371     static void didScrollImpl(InstrumentingAgents*);
372     static InspectorInstrumentationCookie willDispatchXHRLoadEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
373     static void didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie&);
374     static void willScrollLayerImpl(InstrumentingAgents*, Frame*);
375     static void didScrollLayerImpl(InstrumentingAgents*);
376     static InspectorInstrumentationCookie willPaintImpl(InstrumentingAgents*, Frame*);
377     static void didPaintImpl(const InspectorInstrumentationCookie&, GraphicsContext*, const LayoutRect&);
378     static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*);
379     static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
380     static void didScheduleStyleRecalculationImpl(InstrumentingAgents*, Document*);
381     static InspectorInstrumentationCookie willMatchRuleImpl(InstrumentingAgents*, StyleRule*, InspectorCSSOMWrappers&, DocumentStyleSheetCollection*);
382     static void didMatchRuleImpl(const InspectorInstrumentationCookie&, bool matched);
383     static InspectorInstrumentationCookie willProcessRuleImpl(InstrumentingAgents*, StyleRule*, StyleResolver*);
384     static void didProcessRuleImpl(const InspectorInstrumentationCookie&);
385
386     static void applyUserAgentOverrideImpl(InstrumentingAgents*, String*);
387     static void applyScreenWidthOverrideImpl(InstrumentingAgents*, long*);
388     static void applyScreenHeightOverrideImpl(InstrumentingAgents*, long*);
389     static void applyEmulatedMediaImpl(InstrumentingAgents*, String*);
390     static bool shouldApplyScreenWidthOverrideImpl(InstrumentingAgents*);
391     static bool shouldApplyScreenHeightOverrideImpl(InstrumentingAgents*);
392     static void willSendRequestImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
393     static void continueAfterPingLoaderImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
394     static void markResourceAsCachedImpl(InstrumentingAgents*, unsigned long identifier);
395     static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents*, DocumentLoader*, CachedResource*);
396     static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents*, unsigned long identifier, Frame*, int length);
397     static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
398     static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Frame*);
399     static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
400     static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
401     static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
402     static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
403     static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
404     static void didReceiveDataImpl(InstrumentingAgents*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
405     static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, double finishTime);
406     static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, const ResourceError&);
407     static void documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents*, unsigned long identifier, ThreadableLoaderClient*);
408     static void willLoadXHRImpl(InstrumentingAgents*, ThreadableLoaderClient*, const String&, const KURL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
409     static void didFailXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*);
410     static void didFinishXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
411     static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier);
412     static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*);
413     static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*);
414     static void scriptImportedImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString);
415     static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents*, const String& directiveText);
416     static void didReceiveScriptResponseImpl(InstrumentingAgents*, unsigned long identifier);
417     static void domContentLoadedEventFiredImpl(InstrumentingAgents*, Frame*);
418     static void loadEventFiredImpl(InstrumentingAgents*, Frame*);
419     static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*);
420     static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*);
421     static void frameDocumentUpdatedImpl(InstrumentingAgents*, Frame*);
422     static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*);
423     static void frameStartedLoadingImpl(InstrumentingAgents*, Frame*);
424     static void frameStoppedLoadingImpl(InstrumentingAgents*, Frame*);
425     static void frameScheduledNavigationImpl(InstrumentingAgents*, Frame*, double delay);
426     static void frameClearedScheduledNavigationImpl(InstrumentingAgents*, Frame*);
427     static InspectorInstrumentationCookie willRunJavaScriptDialogImpl(InstrumentingAgents*, const String& message);
428     static void didRunJavaScriptDialogImpl(const InspectorInstrumentationCookie&);
429     static void willDestroyCachedResourceImpl(CachedResource*);
430
431     static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents*, unsigned startLine, Frame*);
432     static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned endLine);
433
434     static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, ScriptState*, PassRefPtr<ScriptArguments>, unsigned long requestIdentifier);
435     static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptId, unsigned lineNumber, ScriptState*, unsigned long requestIdentifier);
436
437     // FIXME: Remove once we no longer generate stacks outside of Inspector.
438     static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier);
439
440     static void consoleCountImpl(InstrumentingAgents*, ScriptState*, PassRefPtr<ScriptArguments>);
441     static void startConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title);
442     static void stopConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title, PassRefPtr<ScriptCallStack>);
443     static void consoleTimeStampImpl(InstrumentingAgents*, Frame*, PassRefPtr<ScriptArguments>);
444
445     static void didRequestAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
446     static void didCancelAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
447     static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
448     static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&);
449
450 #if ENABLE(JAVASCRIPT_DEBUGGER)
451     static void addStartProfilingMessageToConsoleImpl(InstrumentingAgents*, const String& title, unsigned lineNumber, const String& sourceURL);
452     static void addProfileImpl(InstrumentingAgents*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
453     static String getCurrentUserInitiatedProfileNameImpl(InstrumentingAgents*, bool incrementProfileNumber);
454     static bool profilerEnabledImpl(InstrumentingAgents*);
455 #endif
456
457 #if ENABLE(SQL_DATABASE)
458     static void didOpenDatabaseImpl(InstrumentingAgents*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
459 #endif
460
461     static void didDispatchDOMStorageEventImpl(InstrumentingAgents*, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
462
463 #if ENABLE(WORKERS)
464     static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents*);
465     static void didStartWorkerContextImpl(InstrumentingAgents*, WorkerContextProxy*, const KURL&);
466     static void workerContextTerminatedImpl(InstrumentingAgents*, WorkerContextProxy*);
467 #endif
468
469 #if ENABLE(WEB_SOCKETS)
470     static void didCreateWebSocketImpl(InstrumentingAgents*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL, const String& protocol, Document*);
471     static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeRequest&, Document*);
472     static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeResponse&, Document*);
473     static void didCloseWebSocketImpl(InstrumentingAgents*, unsigned long identifier, Document*);
474     static void didReceiveWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
475     static void didSendWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
476     static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents*, unsigned long identifier, const String&);
477 #endif
478
479     static void networkStateChangedImpl(InstrumentingAgents*);
480     static void updateApplicationCacheStatusImpl(InstrumentingAgents*, Frame*);
481
482     static InstrumentingAgents* instrumentingAgentsForPage(Page*);
483     static InstrumentingAgents* instrumentingAgentsForFrame(Frame*);
484     static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*);
485     static InstrumentingAgents* instrumentingAgentsForDocument(Document*);
486 #if ENABLE(WORKERS)
487     static InstrumentingAgents* instrumentingAgentsForWorkerContext(WorkerContext*);
488     static InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ScriptExecutionContext*);
489 #endif
490
491     static bool collectingHTMLParseErrors(InstrumentingAgents*);
492     static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, bool isDOMEvent, const String& eventName, bool synchronous);
493     static void cancelPauseOnNativeEvent(InstrumentingAgents*);
494     static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
495
496 #if ENABLE(GEOLOCATION)
497     static GeolocationPosition* overrideGeolocationPositionImpl(InstrumentingAgents*, GeolocationPosition*);
498 #endif
499
500     static DeviceOrientationData* overrideDeviceOrientationImpl(InstrumentingAgents*, DeviceOrientationData*);
501
502 #if USE(ACCELERATED_COMPOSITING)
503     static void layerTreeDidChangeImpl(InstrumentingAgents*);
504     static void renderLayerDestroyedImpl(InstrumentingAgents*, const RenderLayer*);
505     static void pseudoElementDestroyedImpl(InstrumentingAgents*, PseudoElement*);
506 #endif
507
508     static int s_frontendCounter;
509 #endif
510 };
511
512 namespace InstrumentationEvents {
513 extern const char PaintLayer[];
514 extern const char RasterTask[];
515 extern const char Paint[];
516 extern const char Layer[];
517 extern const char BeginFrame[];
518 };
519
520 namespace InstrumentationEventArguments {
521 extern const char LayerId[];
522 extern const char PageId[];
523 };
524
525 inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
526 {
527 #if ENABLE(INSPECTOR)
528     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
529         didClearWindowObjectInWorldImpl(instrumentingAgents, frame, world);
530 #else
531     UNUSED_PARAM(frame);
532     UNUSED_PARAM(world);
533 #endif
534 }
535
536 inline bool InspectorInstrumentation::isDebuggerPaused(Frame* frame)
537 {
538 #if ENABLE(INSPECTOR)
539     FAST_RETURN_IF_NO_FRONTENDS(false);
540     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
541         return isDebuggerPausedImpl(instrumentingAgents);
542 #else
543     UNUSED_PARAM(frame);
544 #endif
545     return false;
546 }
547
548 inline void InspectorInstrumentation::willInsertDOMNode(Document* document, Node* parent)
549 {
550 #if ENABLE(INSPECTOR)
551     FAST_RETURN_IF_NO_FRONTENDS(void());
552     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
553         willInsertDOMNodeImpl(instrumentingAgents, parent);
554 #else
555     UNUSED_PARAM(document);
556     UNUSED_PARAM(parent);
557 #endif
558 }
559
560 inline void InspectorInstrumentation::didInsertDOMNode(Document* document, Node* node)
561 {
562 #if ENABLE(INSPECTOR)
563     FAST_RETURN_IF_NO_FRONTENDS(void());
564     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
565         didInsertDOMNodeImpl(instrumentingAgents, node);
566 #else
567     UNUSED_PARAM(document);
568     UNUSED_PARAM(node);
569 #endif
570 }
571
572 inline void InspectorInstrumentation::willRemoveDOMNode(Document* document, Node* node)
573 {
574 #if ENABLE(INSPECTOR)
575     FAST_RETURN_IF_NO_FRONTENDS(void());
576     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) {
577         willRemoveDOMNodeImpl(instrumentingAgents, node);
578         didRemoveDOMNodeImpl(instrumentingAgents, node);
579     }
580 #else
581     UNUSED_PARAM(document);
582     UNUSED_PARAM(node);
583 #endif
584 }
585
586 inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element, const AtomicString& oldValue, const AtomicString& newValue)
587 {
588 #if ENABLE(INSPECTOR)
589     FAST_RETURN_IF_NO_FRONTENDS(void());
590     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
591         willModifyDOMAttrImpl(instrumentingAgents, element, oldValue, newValue);
592 #else
593     UNUSED_PARAM(document);
594     UNUSED_PARAM(element);
595     UNUSED_PARAM(oldValue);
596     UNUSED_PARAM(newValue);
597 #endif
598 }
599
600 inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element, const AtomicString& name, const AtomicString& value)
601 {
602 #if ENABLE(INSPECTOR)
603     FAST_RETURN_IF_NO_FRONTENDS(void());
604     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
605         didModifyDOMAttrImpl(instrumentingAgents, element, name, value);
606 #else
607     UNUSED_PARAM(document);
608     UNUSED_PARAM(element);
609     UNUSED_PARAM(name);
610     UNUSED_PARAM(value);
611 #endif
612 }
613
614 inline void InspectorInstrumentation::didRemoveDOMAttr(Document* document, Element* element, const AtomicString& name)
615 {
616 #if ENABLE(INSPECTOR)
617     FAST_RETURN_IF_NO_FRONTENDS(void());
618     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
619         didRemoveDOMAttrImpl(instrumentingAgents, element, name);
620 #else
621     UNUSED_PARAM(document);
622     UNUSED_PARAM(element);
623     UNUSED_PARAM(name);
624 #endif
625 }
626
627 inline void InspectorInstrumentation::didInvalidateStyleAttr(Document* document, Node* node)
628 {
629 #if ENABLE(INSPECTOR)
630     FAST_RETURN_IF_NO_FRONTENDS(void());
631     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
632         didInvalidateStyleAttrImpl(instrumentingAgents, node);
633 #else
634     UNUSED_PARAM(document);
635     UNUSED_PARAM(node);
636 #endif
637 }
638
639 inline void InspectorInstrumentation::frameWindowDiscarded(Frame* frame, DOMWindow* domWindow)
640 {
641 #if ENABLE(INSPECTOR)
642     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
643         frameWindowDiscardedImpl(instrumentingAgents, domWindow);
644 #else
645     UNUSED_PARAM(frame);
646     UNUSED_PARAM(domWindow);
647 #endif
648 }
649
650 inline void InspectorInstrumentation::mediaQueryResultChanged(Document* document)
651 {
652 #if ENABLE(INSPECTOR)
653     FAST_RETURN_IF_NO_FRONTENDS(void());
654     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
655         mediaQueryResultChangedImpl(instrumentingAgents);
656 #else
657     UNUSED_PARAM(document);
658 #endif
659 }
660
661 inline void InspectorInstrumentation::didPushShadowRoot(Element* host, ShadowRoot* root)
662 {
663 #if ENABLE(INSPECTOR)
664     FAST_RETURN_IF_NO_FRONTENDS(void());
665     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host->ownerDocument()))
666         didPushShadowRootImpl(instrumentingAgents, host, root);
667 #else
668     UNUSED_PARAM(host);
669     UNUSED_PARAM(root);
670 #endif
671 }
672
673 inline void InspectorInstrumentation::willPopShadowRoot(Element* host, ShadowRoot* root)
674 {
675 #if ENABLE(INSPECTOR)
676     FAST_RETURN_IF_NO_FRONTENDS(void());
677     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host->ownerDocument()))
678         willPopShadowRootImpl(instrumentingAgents, host, root);
679 #else
680     UNUSED_PARAM(host);
681     UNUSED_PARAM(root);
682 #endif
683 }
684
685 inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
686 {
687 #if ENABLE(INSPECTOR)
688     FAST_RETURN_IF_NO_FRONTENDS(void());
689     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
690         didCreateNamedFlowImpl(instrumentingAgents, document, namedFlow);
691 #else
692     UNUSED_PARAM(document);
693     UNUSED_PARAM(namedFlow);
694 #endif
695 }
696
697 inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
698 {
699 #if ENABLE(INSPECTOR)
700     FAST_RETURN_IF_NO_FRONTENDS(void());
701     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
702         willRemoveNamedFlowImpl(instrumentingAgents, document, namedFlow);
703 #else
704     UNUSED_PARAM(document);
705     UNUSED_PARAM(namedFlow);
706 #endif
707 }
708
709 inline void InspectorInstrumentation::didUpdateRegionLayout(Document* document, WebKitNamedFlow* namedFlow)
710 {
711 #if ENABLE(INSPECTOR)
712     FAST_RETURN_IF_NO_FRONTENDS(void());
713     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
714         didUpdateRegionLayoutImpl(instrumentingAgents, document, namedFlow);
715 #else
716     UNUSED_PARAM(document);
717     UNUSED_PARAM(namedFlow);
718 #endif
719 }
720
721 inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const HitTestResult& result, unsigned modifierFlags)
722 {
723 #if ENABLE(INSPECTOR)
724     FAST_RETURN_IF_NO_FRONTENDS(void());
725     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
726         mouseDidMoveOverElementImpl(instrumentingAgents, result, modifierFlags);
727 #else
728     UNUSED_PARAM(page);
729     UNUSED_PARAM(result);
730     UNUSED_PARAM(modifierFlags);
731 #endif
732 }
733
734 inline bool InspectorInstrumentation::handleTouchEvent(Page* page, Node* node)
735 {
736 #if ENABLE(INSPECTOR)
737     FAST_RETURN_IF_NO_FRONTENDS(false);
738     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
739         return handleTouchEventImpl(instrumentingAgents, node);
740 #else
741     UNUSED_PARAM(page);
742     UNUSED_PARAM(node);
743 #endif
744     return false;
745 }
746
747 inline bool InspectorInstrumentation::handleMousePress(Page* page)
748 {
749 #if ENABLE(INSPECTOR)
750     FAST_RETURN_IF_NO_FRONTENDS(false);
751     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
752         return handleMousePressImpl(instrumentingAgents);
753 #else
754     UNUSED_PARAM(page);
755 #endif
756     return false;
757 }
758
759 inline bool InspectorInstrumentation::forcePseudoState(Element* element, CSSSelector::PseudoType pseudoState)
760 {
761 #if ENABLE(INSPECTOR)
762     FAST_RETURN_IF_NO_FRONTENDS(false);
763     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(element->document()))
764         return forcePseudoStateImpl(instrumentingAgents, element, pseudoState);
765 #else
766     UNUSED_PARAM(element);
767     UNUSED_PARAM(pseudoState);
768 #endif
769     return false;
770 }
771
772 inline void InspectorInstrumentation::characterDataModified(Document* document, CharacterData* characterData)
773 {
774 #if ENABLE(INSPECTOR)
775     FAST_RETURN_IF_NO_FRONTENDS(void());
776     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
777         characterDataModifiedImpl(instrumentingAgents, characterData);
778 #else
779     UNUSED_PARAM(document);
780     UNUSED_PARAM(characterData);
781 #endif
782 }
783
784 inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url)
785 {
786 #if ENABLE(INSPECTOR)
787     FAST_RETURN_IF_NO_FRONTENDS(void());
788     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
789         willSendXMLHttpRequestImpl(instrumentingAgents, url);
790 #else
791     UNUSED_PARAM(context);
792     UNUSED_PARAM(url);
793 #endif
794 }
795
796 inline void InspectorInstrumentation::didScheduleResourceRequest(Document* document, const String& url)
797 {
798 #if ENABLE(INSPECTOR)
799     FAST_RETURN_IF_NO_FRONTENDS(void());
800     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
801         didScheduleResourceRequestImpl(instrumentingAgents, url, document->frame());
802 #else
803     UNUSED_PARAM(document);
804     UNUSED_PARAM(url);
805 #endif
806 }
807
808 inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot)
809 {
810 #if ENABLE(INSPECTOR)
811     FAST_RETURN_IF_NO_FRONTENDS(void());
812     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
813         didInstallTimerImpl(instrumentingAgents, timerId, timeout, singleShot, context);
814 #else
815     UNUSED_PARAM(context);
816     UNUSED_PARAM(timerId);
817     UNUSED_PARAM(timeout);
818     UNUSED_PARAM(singleShot);
819 #endif
820 }
821
822 inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* context, int timerId)
823 {
824 #if ENABLE(INSPECTOR)
825     FAST_RETURN_IF_NO_FRONTENDS(void());
826     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
827         didRemoveTimerImpl(instrumentingAgents, timerId, context);
828 #else
829     UNUSED_PARAM(context);
830     UNUSED_PARAM(timerId);
831 #endif
832 }
833
834 inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine)
835 {
836 #if ENABLE(INSPECTOR)
837     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
838     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
839         return willCallFunctionImpl(instrumentingAgents, scriptName, scriptLine, context);
840 #else
841     UNUSED_PARAM(context);
842     UNUSED_PARAM(scriptName);
843     UNUSED_PARAM(scriptLine);
844 #endif
845     return InspectorInstrumentationCookie();
846 }
847
848
849 inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie)
850 {
851 #if ENABLE(INSPECTOR)
852     FAST_RETURN_IF_NO_FRONTENDS(void());
853     if (cookie.isValid())
854         didCallFunctionImpl(cookie);
855 #else
856     UNUSED_PARAM(cookie);
857 #endif
858 }
859
860 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
861 {
862 #if ENABLE(INSPECTOR)
863     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
864     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
865         return willDispatchXHRReadyStateChangeEventImpl(instrumentingAgents, request, context);
866 #else
867     UNUSED_PARAM(context);
868     UNUSED_PARAM(request);
869 #endif
870     return InspectorInstrumentationCookie();
871 }
872
873 inline void InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie& cookie)
874 {
875 #if ENABLE(INSPECTOR)
876     FAST_RETURN_IF_NO_FRONTENDS(void());
877     if (cookie.isValid())
878         didDispatchXHRReadyStateChangeEventImpl(cookie);
879 #else
880     UNUSED_PARAM(cookie);
881 #endif
882 }
883
884 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const EventPath& eventPath)
885 {
886 #if ENABLE(INSPECTOR)
887     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
888     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
889         return willDispatchEventImpl(instrumentingAgents, event, window, node, eventPath, document);
890 #else
891     UNUSED_PARAM(document);
892     UNUSED_PARAM(event);
893     UNUSED_PARAM(window);
894     UNUSED_PARAM(node);
895     UNUSED_PARAM(eventPath);
896 #endif
897     return InspectorInstrumentationCookie();
898 }
899
900 inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrumentationCookie& cookie)
901 {
902 #if ENABLE(INSPECTOR)
903     FAST_RETURN_IF_NO_FRONTENDS(void());
904     if (cookie.isValid())
905         didDispatchEventImpl(cookie);
906 #else
907     UNUSED_PARAM(cookie);
908 #endif
909 }
910
911 inline InspectorInstrumentationCookie InspectorInstrumentation::willHandleEvent(ScriptExecutionContext* context, Event* event)
912 {
913 #if ENABLE(INSPECTOR)
914     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
915     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
916         return willHandleEventImpl(instrumentingAgents, event);
917 #else
918     UNUSED_PARAM(context);
919     UNUSED_PARAM(event);
920 #endif
921     return InspectorInstrumentationCookie();
922 }
923
924 inline void InspectorInstrumentation::didHandleEvent(const InspectorInstrumentationCookie& cookie)
925 {
926 #if ENABLE(INSPECTOR)
927     FAST_RETURN_IF_NO_FRONTENDS(void());
928     if (cookie.isValid())
929         didHandleEventImpl(cookie);
930 #else
931     UNUSED_PARAM(cookie);
932 #endif
933 }
934
935 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window)
936 {
937 #if ENABLE(INSPECTOR)
938     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
939     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
940         return willDispatchEventOnWindowImpl(instrumentingAgents, event, window);
941 #else
942     UNUSED_PARAM(frame);
943     UNUSED_PARAM(event);
944     UNUSED_PARAM(window);
945 #endif
946     return InspectorInstrumentationCookie();
947 }
948
949 inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorInstrumentationCookie& cookie)
950 {
951 #if ENABLE(INSPECTOR)
952     FAST_RETURN_IF_NO_FRONTENDS(void());
953     if (cookie.isValid())
954         didDispatchEventOnWindowImpl(cookie);
955 #else
956     UNUSED_PARAM(cookie);
957 #endif
958 }
959
960 inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame* frame, const String& url, int lineNumber)
961 {
962 #if ENABLE(INSPECTOR)
963     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
964     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
965         return willEvaluateScriptImpl(instrumentingAgents, url, lineNumber, frame);
966 #else
967     UNUSED_PARAM(frame);
968     UNUSED_PARAM(url);
969     UNUSED_PARAM(lineNumber);
970 #endif
971     return InspectorInstrumentationCookie();
972 }
973
974 inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie)
975 {
976 #if ENABLE(INSPECTOR)
977     FAST_RETURN_IF_NO_FRONTENDS(void());
978     if (cookie.isValid())
979         didEvaluateScriptImpl(cookie);
980 #else
981     UNUSED_PARAM(cookie);
982 #endif
983 }
984
985 inline void InspectorInstrumentation::scriptsEnabled(Page* page, bool isEnabled)
986 {
987 #if ENABLE(INSPECTOR)
988     FAST_RETURN_IF_NO_FRONTENDS(void());
989     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
990         return scriptsEnabledImpl(instrumentingAgents, isEnabled);
991 #else
992     UNUSED_PARAM(page);
993     UNUSED_PARAM(isEnabled);
994 #endif
995 }
996
997 inline void InspectorInstrumentation::didCreateIsolatedContext(Frame* frame, ScriptState* scriptState, SecurityOrigin* origin)
998 {
999 #if ENABLE(INSPECTOR)
1000     FAST_RETURN_IF_NO_FRONTENDS(void());
1001     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1002         return didCreateIsolatedContextImpl(instrumentingAgents, frame, scriptState, origin);
1003 #else
1004     UNUSED_PARAM(frame);
1005     UNUSED_PARAM(scriptState);
1006     UNUSED_PARAM(origin);
1007 #endif
1008 }
1009
1010 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId)
1011 {
1012 #if ENABLE(INSPECTOR)
1013     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1014     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1015         return willFireTimerImpl(instrumentingAgents, timerId, context);
1016 #else
1017     UNUSED_PARAM(context);
1018     UNUSED_PARAM(timerId);
1019 #endif
1020     return InspectorInstrumentationCookie();
1021 }
1022
1023 inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentationCookie& cookie)
1024 {
1025 #if ENABLE(INSPECTOR)
1026     FAST_RETURN_IF_NO_FRONTENDS(void());
1027     if (cookie.isValid())
1028         didFireTimerImpl(cookie);
1029 #else
1030     UNUSED_PARAM(cookie);
1031 #endif
1032 }
1033
1034 inline void InspectorInstrumentation::didInvalidateLayout(Frame* frame)
1035 {
1036 #if ENABLE(INSPECTOR)
1037     FAST_RETURN_IF_NO_FRONTENDS(void());
1038     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1039         didInvalidateLayoutImpl(instrumentingAgents, frame);
1040 #else
1041     UNUSED_PARAM(frame);
1042 #endif
1043 }
1044
1045 inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame)
1046 {
1047 #if ENABLE(INSPECTOR)
1048     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1049     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1050         return willLayoutImpl(instrumentingAgents, frame);
1051 #else
1052     UNUSED_PARAM(frame);
1053 #endif
1054     return InspectorInstrumentationCookie();
1055 }
1056
1057 inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie, RenderObject* root)
1058 {
1059 #if ENABLE(INSPECTOR)
1060     FAST_RETURN_IF_NO_FRONTENDS(void());
1061     if (cookie.isValid())
1062         didLayoutImpl(cookie, root);
1063 #else
1064     UNUSED_PARAM(cookie);
1065     UNUSED_PARAM(root);
1066 #endif
1067 }
1068
1069 inline void InspectorInstrumentation::didScroll(Page* page)
1070 {
1071 #if ENABLE(INSPECTOR)
1072     FAST_RETURN_IF_NO_FRONTENDS(void());
1073     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1074         didScrollImpl(instrumentingAgents);
1075 #else
1076     UNUSED_PARAM(page);
1077 #endif
1078 }
1079
1080 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
1081 {
1082 #if ENABLE(INSPECTOR)
1083     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1084     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1085         return willDispatchXHRLoadEventImpl(instrumentingAgents, request, context);
1086 #else
1087     UNUSED_PARAM(context);
1088     UNUSED_PARAM(request);
1089 #endif
1090     return InspectorInstrumentationCookie();
1091 }
1092
1093 inline void InspectorInstrumentation::didDispatchXHRLoadEvent(const InspectorInstrumentationCookie& cookie)
1094 {
1095 #if ENABLE(INSPECTOR)
1096     FAST_RETURN_IF_NO_FRONTENDS(void());
1097     if (cookie.isValid())
1098         didDispatchXHRLoadEventImpl(cookie);
1099 #else
1100     UNUSED_PARAM(cookie);
1101 #endif
1102 }
1103
1104 inline InspectorInstrumentationCookie InspectorInstrumentation::willPaint(Frame* frame)
1105 {
1106 #if ENABLE(INSPECTOR)
1107     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1108     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1109         return willPaintImpl(instrumentingAgents, frame);
1110 #else
1111     UNUSED_PARAM(frame);
1112 #endif
1113     return InspectorInstrumentationCookie();
1114 }
1115
1116 inline void InspectorInstrumentation::didPaint(const InspectorInstrumentationCookie& cookie, GraphicsContext* context, const LayoutRect& rect)
1117 {
1118 #if ENABLE(INSPECTOR)
1119     FAST_RETURN_IF_NO_FRONTENDS(void());
1120     if (cookie.isValid())
1121         didPaintImpl(cookie, context, rect);
1122 #else
1123     UNUSED_PARAM(cookie);
1124     UNUSED_PARAM(context);
1125     UNUSED_PARAM(rect);
1126 #endif
1127 }
1128
1129 inline void InspectorInstrumentation::willScrollLayer(Frame* frame)
1130 {
1131 #if ENABLE(INSPECTOR)
1132     FAST_RETURN_IF_NO_FRONTENDS(void());
1133     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1134         willScrollLayerImpl(instrumentingAgents, frame);
1135 #else
1136     UNUSED_PARAM(frame);
1137 #endif
1138 }
1139
1140 inline void InspectorInstrumentation::didScrollLayer(Frame* frame)
1141 {
1142 #if ENABLE(INSPECTOR)
1143     FAST_RETURN_IF_NO_FRONTENDS(void());
1144     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1145         didScrollLayerImpl(instrumentingAgents);
1146 #else
1147     UNUSED_PARAM(frame);
1148 #endif
1149 }
1150
1151 inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document)
1152 {
1153 #if ENABLE(INSPECTOR)
1154     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1155     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1156         return willRecalculateStyleImpl(instrumentingAgents, document->frame());
1157 #else
1158     UNUSED_PARAM(document);
1159 #endif
1160     return InspectorInstrumentationCookie();
1161 }
1162
1163 inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie)
1164 {
1165 #if ENABLE(INSPECTOR)
1166     FAST_RETURN_IF_NO_FRONTENDS(void());
1167     if (cookie.isValid())
1168         didRecalculateStyleImpl(cookie);
1169 #else
1170     UNUSED_PARAM(cookie);
1171 #endif
1172 }
1173
1174 inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document* document)
1175 {
1176 #if ENABLE(INSPECTOR)
1177     FAST_RETURN_IF_NO_FRONTENDS(void());
1178     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1179         didScheduleStyleRecalculationImpl(instrumentingAgents, document);
1180 #else
1181     UNUSED_PARAM(document);
1182 #endif
1183 }
1184
1185 inline InspectorInstrumentationCookie InspectorInstrumentation::willMatchRule(Document* document, StyleRule* rule, InspectorCSSOMWrappers& inspectorCSSOMWrappers, DocumentStyleSheetCollection* styleSheetCollection)
1186 {
1187 #if ENABLE(INSPECTOR)
1188     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1189     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1190         return willMatchRuleImpl(instrumentingAgents, rule, inspectorCSSOMWrappers, styleSheetCollection);
1191 #else
1192     UNUSED_PARAM(document);
1193     UNUSED_PARAM(rule);
1194     UNUSED_PARAM(inspectorCSSOMWrappers);
1195     UNUSED_PARAM(styleSheetCollection);
1196 #endif
1197     return InspectorInstrumentationCookie();
1198 }
1199
1200 inline void InspectorInstrumentation::didMatchRule(const InspectorInstrumentationCookie& cookie, bool matched)
1201 {
1202 #if ENABLE(INSPECTOR)
1203     FAST_RETURN_IF_NO_FRONTENDS(void());
1204     if (cookie.isValid())
1205         didMatchRuleImpl(cookie, matched);
1206 #else
1207     UNUSED_PARAM(cookie);
1208     UNUSED_PARAM(matched);
1209 #endif
1210 }
1211
1212 inline InspectorInstrumentationCookie InspectorInstrumentation::willProcessRule(Document* document, StyleRule* rule, StyleResolver* styleResolver)
1213 {
1214 #if ENABLE(INSPECTOR)
1215     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1216     if (!rule)
1217         return InspectorInstrumentationCookie();
1218     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1219         return willProcessRuleImpl(instrumentingAgents, rule, styleResolver);
1220 #else
1221     UNUSED_PARAM(document);
1222     UNUSED_PARAM(rule);
1223     UNUSED_PARAM(styleResolver);
1224 #endif
1225     return InspectorInstrumentationCookie();
1226 }
1227
1228 inline void InspectorInstrumentation::didProcessRule(const InspectorInstrumentationCookie& cookie)
1229 {
1230 #if ENABLE(INSPECTOR)
1231     FAST_RETURN_IF_NO_FRONTENDS(void());
1232     if (cookie.isValid())
1233         didProcessRuleImpl(cookie);
1234 #else
1235     UNUSED_PARAM(cookie);
1236 #endif
1237 }
1238
1239 inline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, String* userAgent)
1240 {
1241 #if ENABLE(INSPECTOR)
1242     FAST_RETURN_IF_NO_FRONTENDS(void());
1243     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1244         applyUserAgentOverrideImpl(instrumentingAgents, userAgent);
1245 #else
1246     UNUSED_PARAM(frame);
1247     UNUSED_PARAM(userAgent);
1248 #endif
1249 }
1250
1251 inline void InspectorInstrumentation::applyScreenWidthOverride(Frame* frame, long* width)
1252 {
1253 #if ENABLE(INSPECTOR)
1254     FAST_RETURN_IF_NO_FRONTENDS(void());
1255     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1256         applyScreenWidthOverrideImpl(instrumentingAgents, width);
1257 #else
1258     UNUSED_PARAM(frame);
1259     UNUSED_PARAM(width);
1260 #endif
1261 }
1262
1263 inline void InspectorInstrumentation::applyScreenHeightOverride(Frame* frame, long* height)
1264 {
1265 #if ENABLE(INSPECTOR)
1266     FAST_RETURN_IF_NO_FRONTENDS(void());
1267     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1268         applyScreenHeightOverrideImpl(instrumentingAgents, height);
1269 #else
1270     UNUSED_PARAM(frame);
1271     UNUSED_PARAM(height);
1272 #endif
1273 }
1274
1275 inline bool InspectorInstrumentation::shouldApplyScreenWidthOverride(Frame* frame)
1276 {
1277 #if ENABLE(INSPECTOR)
1278     FAST_RETURN_IF_NO_FRONTENDS(false);
1279     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1280         return shouldApplyScreenWidthOverrideImpl(instrumentingAgents);
1281 #else
1282     UNUSED_PARAM(frame);
1283 #endif
1284     return false;
1285 }
1286
1287 inline void InspectorInstrumentation::applyEmulatedMedia(Frame* frame, String* media)
1288 {
1289 #if ENABLE(INSPECTOR)
1290     FAST_RETURN_IF_NO_FRONTENDS(void());
1291     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1292         applyEmulatedMediaImpl(instrumentingAgents, media);
1293 #else
1294     UNUSED_PARAM(frame);
1295     UNUSED_PARAM(media);
1296 #endif
1297 }
1298
1299 inline bool InspectorInstrumentation::shouldApplyScreenHeightOverride(Frame* frame)
1300 {
1301 #if ENABLE(INSPECTOR)
1302     FAST_RETURN_IF_NO_FRONTENDS(false);
1303     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1304         return shouldApplyScreenHeightOverrideImpl(instrumentingAgents);
1305 #else
1306     UNUSED_PARAM(frame);
1307 #endif
1308     return false;
1309 }
1310
1311 inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
1312 {
1313 #if ENABLE(INSPECTOR)
1314     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1315         willSendRequestImpl(instrumentingAgents, identifier, loader, request, redirectResponse);
1316 #else
1317     UNUSED_PARAM(frame);
1318     UNUSED_PARAM(identifier);
1319     UNUSED_PARAM(loader);
1320     UNUSED_PARAM(request);
1321     UNUSED_PARAM(redirectResponse);
1322 #endif
1323 }
1324
1325 inline void InspectorInstrumentation::continueAfterPingLoader(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
1326 {
1327 #if ENABLE(INSPECTOR)
1328     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1329         InspectorInstrumentation::continueAfterPingLoaderImpl(instrumentingAgents, identifier, loader, request, response);
1330 #else
1331     UNUSED_PARAM(frame);
1332     UNUSED_PARAM(identifier);
1333     UNUSED_PARAM(loader);
1334     UNUSED_PARAM(request);
1335     UNUSED_PARAM(response);
1336 #endif
1337 }
1338
1339 inline void InspectorInstrumentation::markResourceAsCached(Page* page, unsigned long identifier)
1340 {
1341 #if ENABLE(INSPECTOR)
1342     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1343         markResourceAsCachedImpl(instrumentingAgents, identifier);
1344 #else
1345     UNUSED_PARAM(page);
1346     UNUSED_PARAM(identifier);
1347 #endif
1348 }
1349
1350 inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, CachedResource* resource)
1351 {
1352 #if ENABLE(INSPECTOR)
1353     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1354         didLoadResourceFromMemoryCacheImpl(instrumentingAgents, loader, resource);
1355 #else
1356     UNUSED_PARAM(page);
1357     UNUSED_PARAM(loader);
1358     UNUSED_PARAM(resource);
1359 #endif
1360 }
1361
1362 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier, int length)
1363 {
1364 #if ENABLE(INSPECTOR)
1365     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1366     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1367         return willReceiveResourceDataImpl(instrumentingAgents, identifier, frame, length);
1368 #else
1369     UNUSED_PARAM(frame);
1370     UNUSED_PARAM(identifier);
1371     UNUSED_PARAM(length);
1372 #endif
1373     return InspectorInstrumentationCookie();
1374 }
1375
1376 inline void InspectorInstrumentation::didReceiveResourceData(const InspectorInstrumentationCookie& cookie)
1377 {
1378 #if ENABLE(INSPECTOR)
1379     FAST_RETURN_IF_NO_FRONTENDS(void());
1380     if (cookie.isValid())
1381         didReceiveResourceDataImpl(cookie);
1382 #else
1383     UNUSED_PARAM(cookie);
1384 #endif
1385 }
1386
1387 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame, unsigned long identifier, const ResourceResponse& response)
1388 {
1389 #if ENABLE(INSPECTOR)
1390     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1391         return willReceiveResourceResponseImpl(instrumentingAgents, identifier, response, frame);
1392 #else
1393     UNUSED_PARAM(frame);
1394     UNUSED_PARAM(identifier);
1395     UNUSED_PARAM(response);
1396 #endif
1397     return InspectorInstrumentationCookie();
1398 }
1399
1400 inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
1401 {
1402 #if ENABLE(INSPECTOR)
1403     // Call this unconditionally so that we're able to log to console with no front-end attached.
1404     if (cookie.isValid())
1405         didReceiveResourceResponseImpl(cookie, identifier, loader, response, resourceLoader);
1406 #else
1407     UNUSED_PARAM(cookie);
1408     UNUSED_PARAM(identifier);
1409     UNUSED_PARAM(loader);
1410     UNUSED_PARAM(response);
1411     UNUSED_PARAM(resourceLoader);
1412 #endif
1413 }
1414
1415 inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1416 {
1417 #if ENABLE(INSPECTOR)
1418     FAST_RETURN_IF_NO_FRONTENDS(void());
1419     InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(frame, loader, identifier, r);
1420 #else
1421     UNUSED_PARAM(frame);
1422     UNUSED_PARAM(loader);
1423     UNUSED_PARAM(identifier);
1424     UNUSED_PARAM(r);
1425 #endif
1426 }
1427
1428 inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1429 {
1430 #if ENABLE(INSPECTOR)
1431     FAST_RETURN_IF_NO_FRONTENDS(void());
1432     InspectorInstrumentation::continueWithPolicyDownloadImpl(frame, loader, identifier, r);
1433 #else
1434     UNUSED_PARAM(frame);
1435     UNUSED_PARAM(loader);
1436     UNUSED_PARAM(identifier);
1437     UNUSED_PARAM(r);
1438 #endif
1439 }
1440
1441 inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
1442 {
1443 #if ENABLE(INSPECTOR)
1444     FAST_RETURN_IF_NO_FRONTENDS(void());
1445     InspectorInstrumentation::continueWithPolicyIgnoreImpl(frame, loader, identifier, r);
1446 #else
1447     UNUSED_PARAM(frame);
1448     UNUSED_PARAM(loader);
1449     UNUSED_PARAM(identifier);
1450     UNUSED_PARAM(r);
1451 #endif
1452 }
1453
1454 inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
1455 {
1456 #if ENABLE(INSPECTOR)
1457     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1458         didReceiveDataImpl(instrumentingAgents, identifier, data, dataLength, encodedDataLength);
1459 #else
1460     UNUSED_PARAM(frame);
1461     UNUSED_PARAM(identifier);
1462     UNUSED_PARAM(data);
1463     UNUSED_PARAM(dataLength);
1464     UNUSED_PARAM(encodedDataLength);
1465 #endif
1466 }
1467
1468 inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, double finishTime)
1469 {
1470 #if ENABLE(INSPECTOR)
1471     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1472         didFinishLoadingImpl(instrumentingAgents, identifier, loader, finishTime);
1473 #else
1474     UNUSED_PARAM(frame);
1475     UNUSED_PARAM(loader);
1476     UNUSED_PARAM(identifier);
1477     UNUSED_PARAM(finishTime);
1478 #endif
1479 }
1480
1481 inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
1482 {
1483 #if ENABLE(INSPECTOR)
1484     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1485         didFailLoadingImpl(instrumentingAgents, identifier, loader, error);
1486 #else
1487     UNUSED_PARAM(frame);
1488     UNUSED_PARAM(loader);
1489     UNUSED_PARAM(identifier);
1490     UNUSED_PARAM(error);
1491 #endif
1492 }
1493
1494 inline void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext* context, unsigned long identifier, ThreadableLoaderClient* client)
1495 {
1496 #if ENABLE(INSPECTOR)
1497     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1498         documentThreadableLoaderStartedLoadingForClientImpl(instrumentingAgents, identifier, client);
1499 #else
1500     UNUSED_PARAM(context);
1501     UNUSED_PARAM(identifier);
1502     UNUSED_PARAM(client);
1503 #endif
1504 }
1505
1506 inline void InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* context, ThreadableLoaderClient* client, const String& method, const KURL& url, bool async, PassRefPtr<FormData> formData, const HTTPHeaderMap& headers, bool includeCredentials)
1507 {
1508 #if ENABLE(INSPECTOR)
1509     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1510         willLoadXHRImpl(instrumentingAgents, client, method, url, async, formData, headers, includeCredentials);
1511 #else
1512     UNUSED_PARAM(context);
1513     UNUSED_PARAM(client);
1514     UNUSED_PARAM(method);
1515     UNUSED_PARAM(url);
1516     UNUSED_PARAM(async);
1517     UNUSED_PARAM(formData);
1518     UNUSED_PARAM(headers);
1519     UNUSED_PARAM(includeCredentials);
1520 #endif
1521 }
1522
1523 inline void InspectorInstrumentation::didFailXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client)
1524 {
1525 #if ENABLE(INSPECTOR)
1526     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1527         didFailXHRLoadingImpl(instrumentingAgents, client);
1528 #else
1529     UNUSED_PARAM(context);
1530     UNUSED_PARAM(client);
1531 #endif
1532 }
1533
1534
1535 inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
1536 {
1537 #if ENABLE(INSPECTOR)
1538     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1539         didFinishXHRLoadingImpl(instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber);
1540 #else
1541     UNUSED_PARAM(context);
1542     UNUSED_PARAM(client);
1543     UNUSED_PARAM(identifier);
1544     UNUSED_PARAM(sourceString);
1545     UNUSED_PARAM(url);
1546     UNUSED_PARAM(sendURL);
1547     UNUSED_PARAM(sendLineNumber);
1548 #endif
1549 }
1550
1551 inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionContext* context, unsigned long identifier)
1552 {
1553 #if ENABLE(INSPECTOR)
1554     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1555         didReceiveXHRResponseImpl(instrumentingAgents, identifier);
1556 #else
1557     UNUSED_PARAM(context);
1558     UNUSED_PARAM(identifier);
1559 #endif
1560 }
1561
1562 inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context)
1563 {
1564 #if ENABLE(INSPECTOR)
1565     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1566         willLoadXHRSynchronouslyImpl(instrumentingAgents);
1567 #else
1568     UNUSED_PARAM(context);
1569 #endif
1570 }
1571
1572 inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context)
1573 {
1574 #if ENABLE(INSPECTOR)
1575     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1576         didLoadXHRSynchronouslyImpl(instrumentingAgents);
1577 #else
1578     UNUSED_PARAM(context);
1579 #endif
1580 }
1581
1582 inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString)
1583 {
1584 #if ENABLE(INSPECTOR)
1585     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1586         scriptImportedImpl(instrumentingAgents, identifier, sourceString);
1587 #else
1588     UNUSED_PARAM(context);
1589     UNUSED_PARAM(identifier);
1590     UNUSED_PARAM(sourceString);
1591 #endif
1592 }
1593
1594 inline void InspectorInstrumentation::scriptExecutionBlockedByCSP(ScriptExecutionContext* context, const String& directiveText)
1595 {
1596 #if ENABLE(INSPECTOR)
1597     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1598         scriptExecutionBlockedByCSPImpl(instrumentingAgents, directiveText);
1599 #else
1600     UNUSED_PARAM(context);
1601     UNUSED_PARAM(directiveText);
1602 #endif
1603 }
1604
1605 inline void InspectorInstrumentation::didReceiveScriptResponse(ScriptExecutionContext* context, unsigned long identifier)
1606 {
1607 #if ENABLE(INSPECTOR)
1608     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1609         didReceiveScriptResponseImpl(instrumentingAgents, identifier);
1610 #else
1611     UNUSED_PARAM(context);
1612     UNUSED_PARAM(identifier);
1613 #endif
1614 }
1615
1616 inline void InspectorInstrumentation::domContentLoadedEventFired(Frame* frame)
1617 {
1618 #if ENABLE(INSPECTOR)
1619     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1620         domContentLoadedEventFiredImpl(instrumentingAgents, frame);
1621 #else
1622     UNUSED_PARAM(frame);
1623 #endif
1624 }
1625
1626 inline void InspectorInstrumentation::loadEventFired(Frame* frame)
1627 {
1628 #if ENABLE(INSPECTOR)
1629     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1630         loadEventFiredImpl(instrumentingAgents, frame);
1631 #else
1632     UNUSED_PARAM(frame);
1633 #endif
1634 }
1635
1636 inline void InspectorInstrumentation::frameDetachedFromParent(Frame* frame)
1637 {
1638 #if ENABLE(INSPECTOR)
1639     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1640         frameDetachedFromParentImpl(instrumentingAgents, frame);
1641 #else
1642     UNUSED_PARAM(frame);
1643 #endif
1644 }
1645
1646 inline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader)
1647 {
1648 #if ENABLE(INSPECTOR)
1649     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1650         didCommitLoadImpl(instrumentingAgents, frame->page(), loader);
1651 #else
1652     UNUSED_PARAM(frame);
1653     UNUSED_PARAM(loader);
1654 #endif
1655 }
1656
1657 inline void InspectorInstrumentation::frameDocumentUpdated(Frame* frame)
1658 {
1659 #if ENABLE(INSPECTOR)
1660     FAST_RETURN_IF_NO_FRONTENDS(void());
1661     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1662         frameDocumentUpdatedImpl(instrumentingAgents, frame);
1663 #else
1664     UNUSED_PARAM(frame);
1665 #endif
1666 }
1667
1668 inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame* frame, DocumentLoader* loader)
1669 {
1670 #if ENABLE(INSPECTOR)
1671     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1672         loaderDetachedFromFrameImpl(instrumentingAgents, loader);
1673 #else
1674     UNUSED_PARAM(frame);
1675     UNUSED_PARAM(loader);
1676 #endif
1677 }
1678
1679 inline void InspectorInstrumentation::frameStartedLoading(Frame* frame)
1680 {
1681 #if ENABLE(INSPECTOR)
1682     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1683         frameStartedLoadingImpl(instrumentingAgents, frame);
1684 #else
1685     UNUSED_PARAM(frame);
1686 #endif
1687 }
1688
1689 inline void InspectorInstrumentation::frameStoppedLoading(Frame* frame)
1690 {
1691 #if ENABLE(INSPECTOR)
1692     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1693         frameStoppedLoadingImpl(instrumentingAgents, frame);
1694 #else
1695     UNUSED_PARAM(frame);
1696 #endif
1697 }
1698
1699 inline void InspectorInstrumentation::frameScheduledNavigation(Frame* frame, double delay)
1700 {
1701 #if ENABLE(INSPECTOR)
1702     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1703         frameScheduledNavigationImpl(instrumentingAgents, frame, delay);
1704 #else
1705     UNUSED_PARAM(frame);
1706     UNUSED_PARAM(delay);
1707 #endif
1708 }
1709
1710 inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame* frame)
1711 {
1712 #if ENABLE(INSPECTOR)
1713     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1714         frameClearedScheduledNavigationImpl(instrumentingAgents, frame);
1715 #else
1716     UNUSED_PARAM(frame);
1717 #endif
1718 }
1719
1720 inline InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialog(Page* page, const String& message)
1721 {
1722 #if ENABLE(INSPECTOR)
1723     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1724     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1725         return willRunJavaScriptDialogImpl(instrumentingAgents, message);
1726 #else
1727     UNUSED_PARAM(page);
1728     UNUSED_PARAM(message);
1729 #endif
1730     return InspectorInstrumentationCookie();
1731 }
1732
1733 inline void InspectorInstrumentation::didRunJavaScriptDialog(const InspectorInstrumentationCookie& cookie)
1734 {
1735 #if ENABLE(INSPECTOR)
1736     FAST_RETURN_IF_NO_FRONTENDS(void());
1737     if (cookie.isValid())
1738         didRunJavaScriptDialogImpl(cookie);
1739 #else
1740     UNUSED_PARAM(cookie);
1741 #endif
1742 }
1743
1744 inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource* cachedResource)
1745 {
1746 #if ENABLE(INSPECTOR)
1747     FAST_RETURN_IF_NO_FRONTENDS(void());
1748     willDestroyCachedResourceImpl(cachedResource);
1749 #else
1750     UNUSED_PARAM(cachedResource);
1751 #endif
1752 }
1753
1754 inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned startLine)
1755 {
1756 #if ENABLE(INSPECTOR)
1757     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
1758     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1759         return willWriteHTMLImpl(instrumentingAgents, startLine, document->frame());
1760 #else
1761     UNUSED_PARAM(document);
1762     UNUSED_PARAM(startLine);
1763 #endif
1764     return InspectorInstrumentationCookie();
1765 }
1766
1767 inline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentationCookie& cookie, unsigned endLine)
1768 {
1769 #if ENABLE(INSPECTOR)
1770     FAST_RETURN_IF_NO_FRONTENDS(void());
1771     if (cookie.isValid())
1772         didWriteHTMLImpl(cookie, endLine);
1773 #else
1774     UNUSED_PARAM(cookie);
1775     UNUSED_PARAM(endLine);
1776 #endif
1777 }
1778
1779 inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
1780 {
1781 #if ENABLE(INSPECTOR)
1782     FAST_RETURN_IF_NO_FRONTENDS(void());
1783     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1784         didDispatchDOMStorageEventImpl(instrumentingAgents, key, oldValue, newValue, storageType, securityOrigin, page);
1785 #else
1786     UNUSED_PARAM(key);
1787     UNUSED_PARAM(oldValue);
1788     UNUSED_PARAM(newValue);
1789     UNUSED_PARAM(storageType);
1790     UNUSED_PARAM(securityOrigin);
1791     UNUSED_PARAM(page);
1792 #endif // ENABLE(INSPECTOR)
1793 }
1794
1795 #if ENABLE(WORKERS)
1796 inline bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext* context)
1797 {
1798 #if ENABLE(INSPECTOR)
1799     FAST_RETURN_IF_NO_FRONTENDS(false);
1800     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1801         return shouldPauseDedicatedWorkerOnStartImpl(instrumentingAgents);
1802 #else
1803     UNUSED_PARAM(context);
1804 #endif
1805     return false;
1806 }
1807
1808 inline void InspectorInstrumentation::didStartWorkerContext(ScriptExecutionContext* context, WorkerContextProxy* proxy, const KURL& url)
1809 {
1810 #if ENABLE(INSPECTOR)
1811     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1812         didStartWorkerContextImpl(instrumentingAgents, proxy, url);
1813 #else
1814     UNUSED_PARAM(context);
1815     UNUSED_PARAM(proxy);
1816     UNUSED_PARAM(url);
1817 #endif
1818 }
1819
1820 inline void InspectorInstrumentation::workerContextTerminated(ScriptExecutionContext* context, WorkerContextProxy* proxy)
1821 {
1822 #if ENABLE(INSPECTOR)
1823     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
1824         workerContextTerminatedImpl(instrumentingAgents, proxy);
1825 #else
1826     UNUSED_PARAM(context);
1827     UNUSED_PARAM(proxy);
1828 #endif
1829 }
1830
1831 #endif
1832
1833
1834 #if ENABLE(WEB_SOCKETS)
1835 inline void InspectorInstrumentation::didCreateWebSocket(Document* document, unsigned long identifier, const KURL& requestURL, const KURL& documentURL, const String& protocol)
1836 {
1837 #if ENABLE(INSPECTOR)
1838     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1839         didCreateWebSocketImpl(instrumentingAgents, identifier, requestURL, documentURL, protocol, document);
1840 #else
1841     UNUSED_PARAM(document);
1842     UNUSED_PARAM(identifier);
1843     UNUSED_PARAM(requestURL);
1844     UNUSED_PARAM(documentURL);
1845     UNUSED_PARAM(protocol);
1846 #endif
1847 }
1848
1849 inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(Document* document, unsigned long identifier, const WebSocketHandshakeRequest& request)
1850 {
1851 #if ENABLE(INSPECTOR)
1852     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1853         willSendWebSocketHandshakeRequestImpl(instrumentingAgents, identifier, request, document);
1854 #else
1855     UNUSED_PARAM(document);
1856     UNUSED_PARAM(identifier);
1857     UNUSED_PARAM(request);
1858 #endif
1859 }
1860
1861 inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(Document* document, unsigned long identifier, const WebSocketHandshakeResponse& response)
1862 {
1863 #if ENABLE(INSPECTOR)
1864     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1865         didReceiveWebSocketHandshakeResponseImpl(instrumentingAgents, identifier, response, document);
1866 #else
1867     UNUSED_PARAM(document);
1868     UNUSED_PARAM(identifier);
1869     UNUSED_PARAM(response);
1870 #endif
1871 }
1872
1873 inline void InspectorInstrumentation::didCloseWebSocket(Document* document, unsigned long identifier)
1874 {
1875 #if ENABLE(INSPECTOR)
1876     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1877         didCloseWebSocketImpl(instrumentingAgents, identifier, document);
1878 #else
1879     UNUSED_PARAM(document);
1880     UNUSED_PARAM(identifier);
1881 #endif
1882 }
1883 inline void InspectorInstrumentation::didReceiveWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1884 {
1885 #if ENABLE(INSPECTOR)
1886     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1887         didReceiveWebSocketFrameImpl(instrumentingAgents, identifier, frame);
1888 #else
1889     UNUSED_PARAM(document);
1890     UNUSED_PARAM(identifier);
1891     UNUSED_PARAM(frame);
1892 #endif
1893 }
1894 inline void InspectorInstrumentation::didReceiveWebSocketFrameError(Document* document, unsigned long identifier, const String& errorMessage)
1895 {
1896 #if ENABLE(INSPECTOR)
1897     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1898         didReceiveWebSocketFrameErrorImpl(instrumentingAgents, identifier, errorMessage);
1899 #else
1900     UNUSED_PARAM(document);
1901     UNUSED_PARAM(identifier);
1902     UNUSED_PARAM(errorMessage);
1903 #endif
1904 }
1905 inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame)
1906 {
1907 #if ENABLE(INSPECTOR)
1908     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1909         didSendWebSocketFrameImpl(instrumentingAgents, identifier, frame);
1910 #else
1911     UNUSED_PARAM(document);
1912     UNUSED_PARAM(identifier);
1913     UNUSED_PARAM(frame);
1914 #endif
1915 }
1916 #endif
1917
1918 inline void InspectorInstrumentation::networkStateChanged(Page* page)
1919 {
1920 #if ENABLE(INSPECTOR)
1921     FAST_RETURN_IF_NO_FRONTENDS(void());
1922     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1923         networkStateChangedImpl(instrumentingAgents);
1924 #else
1925     UNUSED_PARAM(page);
1926 #endif
1927 }
1928
1929 inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
1930 {
1931 #if ENABLE(INSPECTOR)
1932     FAST_RETURN_IF_NO_FRONTENDS(void());
1933     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1934         updateApplicationCacheStatusImpl(instrumentingAgents, frame);
1935 #else
1936     UNUSED_PARAM(frame);
1937 #endif
1938 }
1939
1940 inline void InspectorInstrumentation::didRequestAnimationFrame(Document* document, int callbackId)
1941 {
1942 #if ENABLE(INSPECTOR)
1943     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1944         didRequestAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
1945 #else
1946     UNUSED_PARAM(document);
1947     UNUSED_PARAM(callbackId);
1948 #endif
1949 }
1950
1951 inline void InspectorInstrumentation::didCancelAnimationFrame(Document* document, int callbackId)
1952 {
1953 #if ENABLE(INSPECTOR)
1954     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1955         didCancelAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
1956 #else
1957     UNUSED_PARAM(document);
1958     UNUSED_PARAM(callbackId);
1959 #endif
1960 }
1961
1962 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrame(Document* document, int callbackId)
1963 {
1964 #if ENABLE(INSPECTOR)
1965     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
1966         return willFireAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
1967 #else
1968     UNUSED_PARAM(document);
1969     UNUSED_PARAM(callbackId);
1970 #endif
1971     return InspectorInstrumentationCookie();
1972 }
1973
1974 inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstrumentationCookie& cookie)
1975 {
1976 #if ENABLE(INSPECTOR)
1977     FAST_RETURN_IF_NO_FRONTENDS(void());
1978     if (cookie.isValid())
1979         didFireAnimationFrameImpl(cookie);
1980 #else
1981     UNUSED_PARAM(cookie);
1982 #endif
1983 }
1984
1985 #if ENABLE(GEOLOCATION)
1986 inline GeolocationPosition* InspectorInstrumentation::overrideGeolocationPosition(Page* page, GeolocationPosition* position)
1987 {
1988 #if ENABLE(INSPECTOR)
1989     FAST_RETURN_IF_NO_FRONTENDS(position);
1990     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1991         return overrideGeolocationPositionImpl(instrumentingAgents, position);
1992 #else
1993     UNUSED_PARAM(page);
1994 #endif
1995     return position;
1996 }
1997 #endif
1998
1999 inline DeviceOrientationData* InspectorInstrumentation::overrideDeviceOrientation(Page* page, DeviceOrientationData* deviceOrientation)
2000 {
2001 #if ENABLE(INSPECTOR)
2002     FAST_RETURN_IF_NO_FRONTENDS(deviceOrientation);
2003     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2004         return overrideDeviceOrientationImpl(instrumentingAgents, deviceOrientation);
2005 #else
2006     UNUSED_PARAM(page);
2007 #endif
2008     return deviceOrientation;
2009 }
2010
2011 #if USE(ACCELERATED_COMPOSITING)
2012 inline void InspectorInstrumentation::layerTreeDidChange(Page* page)
2013 {
2014 #if ENABLE(INSPECTOR)
2015     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2016         layerTreeDidChangeImpl(instrumentingAgents);
2017 #else
2018     UNUSED_PARAM(page);
2019 #endif
2020 }
2021
2022 inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const RenderLayer* renderLayer)
2023 {
2024 #if ENABLE(INSPECTOR)
2025     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2026         renderLayerDestroyedImpl(instrumentingAgents, renderLayer);
2027 #else
2028     UNUSED_PARAM(page);
2029     UNUSED_PARAM(renderLayer);
2030 #endif
2031 }
2032
2033 inline void InspectorInstrumentation::pseudoElementDestroyed(Page* page, PseudoElement* pseudoElement)
2034 {
2035 #if ENABLE(INSPECTOR)
2036     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2037         pseudoElementDestroyedImpl(instrumentingAgents, pseudoElement);
2038 #else
2039     UNUSED_PARAM(page);
2040     UNUSED_PARAM(pseudoElement);
2041 #endif
2042 }
2043 #endif
2044
2045 #if ENABLE(INSPECTOR)
2046 inline bool InspectorInstrumentation::collectingHTMLParseErrors(Page* page)
2047 {
2048     FAST_RETURN_IF_NO_FRONTENDS(false);
2049     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
2050         return collectingHTMLParseErrors(instrumentingAgents);
2051     return false;
2052 }
2053
2054 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context)
2055 {
2056     if (!context)
2057         return 0;
2058     if (context->isDocument())
2059         return instrumentingAgentsForPage(static_cast<Document*>(context)->page());
2060 #if ENABLE(WORKERS)
2061     return instrumentingAgentsForNonDocumentContext(context);
2062 #else
2063     return 0;
2064 #endif
2065 }
2066
2067 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame)
2068 {
2069     if (frame)
2070         return instrumentingAgentsForPage(frame->page());
2071     return 0;
2072 }
2073
2074 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document* document)
2075 {
2076     if (document) {
2077         Page* page = document->page();
2078 #if ENABLE(TEMPLATE_ELEMENT)
2079         if (!page && document->templateDocumentHost())
2080             page = document->templateDocumentHost()->page();
2081 #endif
2082         return instrumentingAgentsForPage(page);
2083     }
2084     return 0;
2085 }
2086 #endif
2087
2088 } // namespace WebCore
2089
2090 #endif // !defined(InspectorInstrumentation_h)