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