Web Inspector: get rid of InspectorInstrumentation::inspectorAgents() map
[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 "ConsoleTypes.h"
35 #include "Document.h"
36 #include "Frame.h"
37 #include "Page.h"
38 #include "ScriptExecutionContext.h"
39
40 namespace WebCore {
41
42 class CharacterData;
43 class DOMWindow;
44 class DOMWrapperWorld;
45 class Database;
46 class Element;
47 class EventContext;
48 class DocumentLoader;
49 class HitTestResult;
50 class InspectorTimelineAgent;
51 class InstrumentingAgents;
52 class KURL;
53 class Node;
54 class ResourceRequest;
55 class ResourceResponse;
56 class ScriptArguments;
57 class ScriptCallStack;
58 class ScriptExecutionContext;
59 class ScriptProfile;
60 class StorageArea;
61 class WorkerContextProxy;
62 class XMLHttpRequest;
63
64 #if ENABLE(WEB_SOCKETS)
65 class WebSocketHandshakeRequest;
66 class WebSocketHandshakeResponse;
67 #endif
68
69 #define FAST_RETURN_IF_NO_FRONTENDS(value) if (!hasFrontends()) return value;
70
71 typedef pair<InstrumentingAgents*, int> InspectorInstrumentationCookie;
72
73 class InspectorInstrumentation {
74 public:
75     static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
76     static void inspectedPageDestroyed(Page*);
77
78     static void willInsertDOMNode(Document*, Node*, Node* parent);
79     static void didInsertDOMNode(Document*, Node*);
80     static void willRemoveDOMNode(Document*, Node*);
81     static void willModifyDOMAttr(Document*, Element*);
82     static void didModifyDOMAttr(Document*, Element*);
83     static void characterDataModified(Document*, CharacterData*);
84     static void didInvalidateStyleAttr(Document*, Node*);
85     static void frameWindowDiscarded(Frame*, DOMWindow*);
86
87     static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
88     static bool handleMousePress(Page*);
89
90     static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
91     static void didScheduleResourceRequest(Document*, const String& url);
92     static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
93     static void didRemoveTimer(ScriptExecutionContext*, int timerId);
94
95     static InspectorInstrumentationCookie willCallFunction(Frame*, const String& scriptName, int scriptLine);
96     static void didCallFunction(const InspectorInstrumentationCookie&);
97     static InspectorInstrumentationCookie willChangeXHRReadyState(ScriptExecutionContext*, XMLHttpRequest* request);
98     static void didChangeXHRReadyState(const InspectorInstrumentationCookie&);
99     static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
100     static void didDispatchEvent(const InspectorInstrumentationCookie&);
101     static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
102     static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
103     static InspectorInstrumentationCookie willEvaluateScript(Frame*, const String& url, int lineNumber);
104     static void didEvaluateScript(const InspectorInstrumentationCookie&);
105     static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext*, int timerId);
106     static void didFireTimer(const InspectorInstrumentationCookie&);
107     static InspectorInstrumentationCookie willLayout(Frame*);
108     static void didLayout(const InspectorInstrumentationCookie&);
109     static InspectorInstrumentationCookie willLoadXHR(ScriptExecutionContext*, XMLHttpRequest*);
110     static void didLoadXHR(const InspectorInstrumentationCookie&);
111     static InspectorInstrumentationCookie willPaint(Frame*, const IntRect& rect);
112     static void didPaint(const InspectorInstrumentationCookie&);
113     static InspectorInstrumentationCookie willRecalculateStyle(Document*);
114     static void didRecalculateStyle(const InspectorInstrumentationCookie&);
115     static void didScheduleStyleRecalculation(Document*);
116
117     static void applyUserAgentOverride(Frame*, String*);
118     static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
119     static void continueAfterPingLoader(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
120     static void markResourceAsCached(Page*, unsigned long identifier);
121     static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, CachedResource*);
122     static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier);
123     static void didReceiveResourceData(const InspectorInstrumentationCookie&);
124     static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&);
125     static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
126     static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
127     static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
128     static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
129     static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
130     static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime);
131     static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
132     static void resourceRetrievedByXMLHttpRequest(ScriptExecutionContext*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
133     static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
134     static void willLoadXHRSynchronously(ScriptExecutionContext*);
135     static void didLoadXHRSynchronously(ScriptExecutionContext*);
136     static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString);
137     static void domContentLoadedEventFired(Frame*, const KURL&);
138     static void loadEventFired(Frame*, const KURL&);
139     static void frameDetachedFromParent(Frame*);
140     static void didCommitLoad(Frame*, DocumentLoader*);
141     static void frameDestroyed(Frame*);
142     static void loaderDetachedFromFrame(Frame*, DocumentLoader*);
143
144     static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned int length, unsigned int startLine);
145     static void didWriteHTML(const InspectorInstrumentationCookie&, unsigned int endLine);
146
147     static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
148     static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String&);
149     static void consoleCount(Page*, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
150     static void startConsoleTiming(Page*, const String& title);
151     static void stopConsoleTiming(Page*, const String& title, PassRefPtr<ScriptCallStack>);
152     static void consoleTimeStamp(Page*, PassRefPtr<ScriptArguments>);
153
154 #if ENABLE(JAVASCRIPT_DEBUGGER)
155     static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, const String& sourceURL);
156     static void addProfile(Page*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
157     static String getCurrentUserInitiatedProfileName(Page*, bool incrementProfileNumber);
158     static bool profilerEnabled(Page*);
159 #endif
160
161 #if ENABLE(DATABASE)
162     static void didOpenDatabase(ScriptExecutionContext*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
163 #endif
164
165 #if ENABLE(DOM_STORAGE)
166     static void didUseDOMStorage(Page*, StorageArea*, bool isLocalStorage, Frame*);
167 #endif
168
169 #if ENABLE(WORKERS)
170     static void didStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*, const KURL&);
171     static void didCreateWorker(ScriptExecutionContext*, intptr_t id, const String& url, bool isSharedWorker);
172     static void didDestroyWorker(ScriptExecutionContext*, intptr_t id);
173     static void workerContextTerminated(ScriptExecutionContext*, WorkerContextProxy*);
174 #endif
175
176 #if ENABLE(WEB_SOCKETS)
177     static void didCreateWebSocket(ScriptExecutionContext*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
178     static void willSendWebSocketHandshakeRequest(ScriptExecutionContext*, unsigned long identifier, const WebSocketHandshakeRequest&);
179     static void didReceiveWebSocketHandshakeResponse(ScriptExecutionContext*, unsigned long identifier, const WebSocketHandshakeResponse&);
180     static void didCloseWebSocket(ScriptExecutionContext*, unsigned long identifier);
181 #endif
182
183     static void networkStateChanged(Page*);
184
185 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
186     static void updateApplicationCacheStatus(Frame*);
187 #endif
188
189 #if ENABLE(INSPECTOR)
190     static void frontendCreated() { s_frontendCounter += 1; }
191     static void frontendDeleted() { s_frontendCounter -= 1; }
192     static bool hasFrontends() { return s_frontendCounter; }
193     static bool collectingHTMLParseErrors(Page*);
194 #else
195     static bool hasFrontends() { return false; }
196     static bool collectingHTMLParseErrors(Page*) { return false; }
197 #endif
198
199 private:
200 #if ENABLE(INSPECTOR)
201     static void didClearWindowObjectInWorldImpl(InstrumentingAgents*, Frame*, DOMWrapperWorld*);
202     static void inspectedPageDestroyedImpl(InstrumentingAgents*);
203
204     static void willInsertDOMNodeImpl(InstrumentingAgents*, Node*, Node* parent);
205     static void didInsertDOMNodeImpl(InstrumentingAgents*, Node*);
206     static void willRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
207     static void didRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
208     static void willModifyDOMAttrImpl(InstrumentingAgents*, Element*);
209     static void didModifyDOMAttrImpl(InstrumentingAgents*, Element*);
210     static void characterDataModifiedImpl(InstrumentingAgents*, CharacterData*);
211     static void didInvalidateStyleAttrImpl(InstrumentingAgents*, Node*);
212     static void frameWindowDiscardedImpl(InstrumentingAgents*, DOMWindow*);
213
214     static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags);
215     static bool handleMousePressImpl(InstrumentingAgents*);
216
217     static void willSendXMLHttpRequestImpl(InstrumentingAgents*, const String& url);
218     static void didScheduleResourceRequestImpl(InstrumentingAgents*, const String& url);
219     static void didInstallTimerImpl(InstrumentingAgents*, int timerId, int timeout, bool singleShot);
220     static void didRemoveTimerImpl(InstrumentingAgents*, int timerId);
221
222     static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents*, const String& scriptName, int scriptLine);
223     static void didCallFunctionImpl(const InspectorInstrumentationCookie&);
224     static InspectorInstrumentationCookie willChangeXHRReadyStateImpl(InstrumentingAgents*, XMLHttpRequest*);
225     static void didChangeXHRReadyStateImpl(const InspectorInstrumentationCookie&);
226     static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents*, const Event&, DOMWindow*, Node*, const Vector<EventContext>& ancestors);
227     static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
228     static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents*, const Event&, DOMWindow*);
229     static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
230     static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents*, const String& url, int lineNumber);
231     static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&);
232     static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents*, int timerId);
233     static void didFireTimerImpl(const InspectorInstrumentationCookie&);
234     static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents*);
235     static void didLayoutImpl(const InspectorInstrumentationCookie&);
236     static InspectorInstrumentationCookie willLoadXHRImpl(InstrumentingAgents*, XMLHttpRequest*);
237     static void didLoadXHRImpl(const InspectorInstrumentationCookie&);
238     static InspectorInstrumentationCookie willPaintImpl(InstrumentingAgents*, const IntRect&);
239     static void didPaintImpl(const InspectorInstrumentationCookie&);
240     static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*);
241     static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
242     static void didScheduleStyleRecalculationImpl(InstrumentingAgents*, Document*);
243
244     static void applyUserAgentOverrideImpl(InstrumentingAgents*, String*);
245     static void willSendRequestImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
246     static void continueAfterPingLoaderImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
247     static void markResourceAsCachedImpl(InstrumentingAgents*, unsigned long identifier);
248     static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents*, DocumentLoader*, CachedResource*);
249     static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents*, unsigned long identifier);
250     static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
251     static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&);
252     static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
253     static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
254     static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
255     static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
256     static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
257     static void didReceiveDataImpl(InstrumentingAgents*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
258     static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, double finishTime);
259     static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, const ResourceError&);
260     static void resourceRetrievedByXMLHttpRequestImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
261     static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier);
262     static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*);
263     static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*);
264     static void scriptImportedImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString);
265     static void domContentLoadedEventFiredImpl(InstrumentingAgents*, Frame*, const KURL&);
266     static void loadEventFiredImpl(InstrumentingAgents*, Frame*, const KURL&);
267     static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*);
268     static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*);
269     static void frameDestroyedImpl(InstrumentingAgents*, Frame*);
270     static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*);
271
272     static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents*, unsigned int length, unsigned int startLine);
273     static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned int endLine);
274
275     static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
276     static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& scriptId);
277     static void consoleCountImpl(InstrumentingAgents*, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
278     static void startConsoleTimingImpl(InstrumentingAgents*, const String& title);
279     static void stopConsoleTimingImpl(InstrumentingAgents*, const String& title, PassRefPtr<ScriptCallStack>);
280     static void consoleTimeStampImpl(InstrumentingAgents*, PassRefPtr<ScriptArguments>);
281
282 #if ENABLE(JAVASCRIPT_DEBUGGER)
283     static void addStartProfilingMessageToConsoleImpl(InstrumentingAgents*, const String& title, unsigned lineNumber, const String& sourceURL);
284     static void addProfileImpl(InstrumentingAgents*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
285     static String getCurrentUserInitiatedProfileNameImpl(InstrumentingAgents*, bool incrementProfileNumber);
286     static bool profilerEnabledImpl(InstrumentingAgents*);
287 #endif
288
289 #if ENABLE(DATABASE)
290     static void didOpenDatabaseImpl(InstrumentingAgents*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
291 #endif
292
293 #if ENABLE(DOM_STORAGE)
294     static void didUseDOMStorageImpl(InstrumentingAgents*, StorageArea*, bool isLocalStorage, Frame*);
295 #endif
296
297 #if ENABLE(WORKERS)
298     static void didStartWorkerContextImpl(InstrumentingAgents*, WorkerContextProxy*, const KURL&);
299     static void didCreateWorkerImpl(InstrumentingAgents*, intptr_t id, const String& url, bool isSharedWorker);
300     static void didDestroyWorkerImpl(InstrumentingAgents*, intptr_t id);
301     static void workerContextTerminatedImpl(InstrumentingAgents*, WorkerContextProxy*);
302 #endif
303
304 #if ENABLE(WEB_SOCKETS)
305     static void didCreateWebSocketImpl(InstrumentingAgents*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
306     static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeRequest&);
307     static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketHandshakeResponse&);
308     static void didCloseWebSocketImpl(InstrumentingAgents*, unsigned long identifier);
309 #endif
310
311 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
312     static void networkStateChangedImpl(InstrumentingAgents*);
313     static void updateApplicationCacheStatusImpl(InstrumentingAgents*, Frame*);
314 #endif
315
316     static InstrumentingAgents* instrumentingAgentsForPage(Page*);
317     static InstrumentingAgents* instrumentingAgentsForFrame(Frame*);
318     static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*);
319     static InstrumentingAgents* instrumentingAgentsForDocument(Document*);
320
321     static bool collectingHTMLParseErrors(InstrumentingAgents*);
322     static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, const String& categoryType, const String& eventName, bool synchronous);
323     static void cancelPauseOnNativeEvent(InstrumentingAgents*);
324     static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
325
326     static int s_frontendCounter;
327 #endif
328 };
329
330 inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
331 {
332 #if ENABLE(INSPECTOR)
333     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
334         didClearWindowObjectInWorldImpl(instrumentingAgents, frame, world);
335 #endif
336 }
337
338 inline void InspectorInstrumentation::inspectedPageDestroyed(Page* page)
339 {
340 #if ENABLE(INSPECTOR)
341     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
342         inspectedPageDestroyedImpl(instrumentingAgents);
343 #endif
344 }
345
346 inline void InspectorInstrumentation::willInsertDOMNode(Document* document, Node* node, Node* parent)
347 {
348 #if ENABLE(INSPECTOR)
349     FAST_RETURN_IF_NO_FRONTENDS(void());
350     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
351         willInsertDOMNodeImpl(instrumentingAgents, node, parent);
352 #endif
353 }
354
355 inline void InspectorInstrumentation::didInsertDOMNode(Document* document, Node* node)
356 {
357 #if ENABLE(INSPECTOR)
358     FAST_RETURN_IF_NO_FRONTENDS(void());
359     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
360         didInsertDOMNodeImpl(instrumentingAgents, node);
361 #endif
362 }
363
364 inline void InspectorInstrumentation::willRemoveDOMNode(Document* document, Node* node)
365 {
366 #if ENABLE(INSPECTOR)
367     FAST_RETURN_IF_NO_FRONTENDS(void());
368     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) {
369         willRemoveDOMNodeImpl(instrumentingAgents, node);
370         didRemoveDOMNodeImpl(instrumentingAgents, node);
371     }
372 #endif
373 }
374
375 inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element)
376 {
377 #if ENABLE(INSPECTOR)
378     FAST_RETURN_IF_NO_FRONTENDS(void());
379     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
380         willModifyDOMAttrImpl(instrumentingAgents, element);
381 #endif
382 }
383
384 inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element)
385 {
386 #if ENABLE(INSPECTOR)
387     FAST_RETURN_IF_NO_FRONTENDS(void());
388     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
389         didModifyDOMAttrImpl(instrumentingAgents, element);
390 #endif
391 }
392
393 inline void InspectorInstrumentation::didInvalidateStyleAttr(Document* document, Node* node)
394 {
395 #if ENABLE(INSPECTOR)
396     FAST_RETURN_IF_NO_FRONTENDS(void());
397     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
398         didInvalidateStyleAttrImpl(instrumentingAgents, node);
399 #endif
400 }
401
402 inline void InspectorInstrumentation::frameWindowDiscarded(Frame* frame, DOMWindow* domWindow)
403 {
404 #if ENABLE(INSPECTOR)
405     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
406         frameWindowDiscardedImpl(instrumentingAgents, domWindow);
407 #endif
408 }
409
410 inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const HitTestResult& result, unsigned modifierFlags)
411 {
412 #if ENABLE(INSPECTOR)
413     FAST_RETURN_IF_NO_FRONTENDS(void());
414     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
415         mouseDidMoveOverElementImpl(instrumentingAgents, result, modifierFlags);
416 #endif
417 }
418
419 inline bool InspectorInstrumentation::handleMousePress(Page* page)
420 {
421 #if ENABLE(INSPECTOR)
422     FAST_RETURN_IF_NO_FRONTENDS(false);
423     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
424         return handleMousePressImpl(instrumentingAgents);
425 #endif
426     return false;
427 }
428
429 inline void InspectorInstrumentation::characterDataModified(Document* document, CharacterData* characterData)
430 {
431 #if ENABLE(INSPECTOR)
432     FAST_RETURN_IF_NO_FRONTENDS(void());
433     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
434         characterDataModifiedImpl(instrumentingAgents, characterData);
435 #endif
436 }
437
438 inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url)
439 {
440 #if ENABLE(INSPECTOR)
441     FAST_RETURN_IF_NO_FRONTENDS(void());
442     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
443         willSendXMLHttpRequestImpl(instrumentingAgents, url);
444 #endif
445 }
446
447 inline void InspectorInstrumentation::didScheduleResourceRequest(Document* document, const String& url)
448 {
449 #if ENABLE(INSPECTOR)
450     FAST_RETURN_IF_NO_FRONTENDS(void());
451     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
452         didScheduleResourceRequestImpl(instrumentingAgents, url);
453 #endif
454 }
455
456 inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot)
457 {
458 #if ENABLE(INSPECTOR)
459     FAST_RETURN_IF_NO_FRONTENDS(void());
460     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
461         didInstallTimerImpl(instrumentingAgents, timerId, timeout, singleShot);
462 #endif
463 }
464
465 inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* context, int timerId)
466 {
467 #if ENABLE(INSPECTOR)
468     FAST_RETURN_IF_NO_FRONTENDS(void());
469     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
470         didRemoveTimerImpl(instrumentingAgents, timerId);
471 #endif
472 }
473
474
475 inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(Frame* frame, const String& scriptName, int scriptLine)
476 {
477 #if ENABLE(INSPECTOR)
478     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
479     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
480         return willCallFunctionImpl(instrumentingAgents, scriptName, scriptLine);
481 #endif
482     return InspectorInstrumentationCookie();
483 }
484
485 inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie)
486 {
487 #if ENABLE(INSPECTOR)
488     FAST_RETURN_IF_NO_FRONTENDS(void());
489     if (cookie.first)
490         didCallFunctionImpl(cookie);
491 #endif
492 }
493
494 inline InspectorInstrumentationCookie InspectorInstrumentation::willChangeXHRReadyState(ScriptExecutionContext* context, XMLHttpRequest* request)
495 {
496 #if ENABLE(INSPECTOR)
497     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
498     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
499         return willChangeXHRReadyStateImpl(instrumentingAgents, request);
500 #endif
501     return InspectorInstrumentationCookie();
502 }
503
504 inline void InspectorInstrumentation::didChangeXHRReadyState(const InspectorInstrumentationCookie& cookie)
505 {
506 #if ENABLE(INSPECTOR)
507     FAST_RETURN_IF_NO_FRONTENDS(void());
508     if (cookie.first)
509         didChangeXHRReadyStateImpl(cookie);
510 #endif
511 }
512
513 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
514 {
515 #if ENABLE(INSPECTOR)
516     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
517     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
518         return willDispatchEventImpl(instrumentingAgents, event, window, node, ancestors);
519 #endif
520     return InspectorInstrumentationCookie();
521 }
522
523 inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrumentationCookie& cookie)
524 {
525 #if ENABLE(INSPECTOR)
526     FAST_RETURN_IF_NO_FRONTENDS(void());
527     if (cookie.first)
528         didDispatchEventImpl(cookie);
529 #endif
530 }
531
532 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window)
533 {
534 #if ENABLE(INSPECTOR)
535     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
536     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
537         return willDispatchEventOnWindowImpl(instrumentingAgents, event, window);
538 #endif
539     return InspectorInstrumentationCookie();
540 }
541
542 inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorInstrumentationCookie& cookie)
543 {
544 #if ENABLE(INSPECTOR)
545     FAST_RETURN_IF_NO_FRONTENDS(void());
546     if (cookie.first)
547         didDispatchEventOnWindowImpl(cookie);
548 #endif
549 }
550
551 inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame* frame, const String& url, int lineNumber)
552 {
553 #if ENABLE(INSPECTOR)
554     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
555     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
556         return willEvaluateScriptImpl(instrumentingAgents, url, lineNumber);
557 #endif
558     return InspectorInstrumentationCookie();
559 }
560
561 inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie)
562 {
563 #if ENABLE(INSPECTOR)
564     FAST_RETURN_IF_NO_FRONTENDS(void());
565     if (cookie.first)
566         didEvaluateScriptImpl(cookie);
567 #endif
568 }
569
570 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId)
571 {
572 #if ENABLE(INSPECTOR)
573     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
574     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
575         return willFireTimerImpl(instrumentingAgents, timerId);
576 #endif
577     return InspectorInstrumentationCookie();
578 }
579
580 inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentationCookie& cookie)
581 {
582 #if ENABLE(INSPECTOR)
583     FAST_RETURN_IF_NO_FRONTENDS(void());
584     if (cookie.first)
585         didFireTimerImpl(cookie);
586 #endif
587 }
588
589 inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame)
590 {
591 #if ENABLE(INSPECTOR)
592     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
593     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
594         return willLayoutImpl(instrumentingAgents);
595 #endif
596     return InspectorInstrumentationCookie();
597 }
598
599 inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie)
600 {
601 #if ENABLE(INSPECTOR)
602     FAST_RETURN_IF_NO_FRONTENDS(void());
603     if (cookie.first)
604         didLayoutImpl(cookie);
605 #endif
606 }
607
608 inline InspectorInstrumentationCookie InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* context, XMLHttpRequest* request)
609 {
610 #if ENABLE(INSPECTOR)
611     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
612     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
613         return willLoadXHRImpl(instrumentingAgents, request);
614 #endif
615     return InspectorInstrumentationCookie();
616 }
617
618 inline void InspectorInstrumentation::didLoadXHR(const InspectorInstrumentationCookie& cookie)
619 {
620 #if ENABLE(INSPECTOR)
621     FAST_RETURN_IF_NO_FRONTENDS(void());
622     if (cookie.first)
623         didLoadXHRImpl(cookie);
624 #endif
625 }
626
627 inline InspectorInstrumentationCookie InspectorInstrumentation::willPaint(Frame* frame, const IntRect& rect)
628 {
629 #if ENABLE(INSPECTOR)
630     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
631     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
632         return willPaintImpl(instrumentingAgents, rect);
633 #endif
634     return InspectorInstrumentationCookie();
635 }
636
637 inline void InspectorInstrumentation::didPaint(const InspectorInstrumentationCookie& cookie)
638 {
639 #if ENABLE(INSPECTOR)
640     FAST_RETURN_IF_NO_FRONTENDS(void());
641     if (cookie.first)
642         didPaintImpl(cookie);
643 #endif
644 }
645
646 inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document)
647 {
648 #if ENABLE(INSPECTOR)
649     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
650     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
651         return willRecalculateStyleImpl(instrumentingAgents);
652 #endif
653     return InspectorInstrumentationCookie();
654 }
655
656 inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie)
657 {
658 #if ENABLE(INSPECTOR)
659     FAST_RETURN_IF_NO_FRONTENDS(void());
660     if (cookie.first)
661         didRecalculateStyleImpl(cookie);
662 #endif
663 }
664
665 inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document* document)
666 {
667 #if ENABLE(INSPECTOR)
668     FAST_RETURN_IF_NO_FRONTENDS(void());
669     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
670         didScheduleStyleRecalculationImpl(instrumentingAgents, document);
671 #endif
672 }
673
674 inline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, String* userAgent)
675 {
676 #if ENABLE(INSPECTOR)
677     FAST_RETURN_IF_NO_FRONTENDS(void());
678     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
679         applyUserAgentOverrideImpl(instrumentingAgents, userAgent);
680 #endif
681 }
682
683 inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
684 {
685 #if ENABLE(INSPECTOR)
686     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
687         willSendRequestImpl(instrumentingAgents, identifier, loader, request, redirectResponse);
688 #endif
689 }
690
691 inline void InspectorInstrumentation::continueAfterPingLoader(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
692 {
693 #if ENABLE(INSPECTOR)
694     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
695         InspectorInstrumentation::continueAfterPingLoaderImpl(instrumentingAgents, identifier, loader, request, response);
696 #endif
697 }
698
699 inline void InspectorInstrumentation::markResourceAsCached(Page* page, unsigned long identifier)
700 {
701 #if ENABLE(INSPECTOR)
702     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
703         markResourceAsCachedImpl(instrumentingAgents, identifier); 
704 #endif
705 }
706
707 inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, CachedResource* resource)
708 {
709 #if ENABLE(INSPECTOR)
710     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
711         didLoadResourceFromMemoryCacheImpl(instrumentingAgents, loader, resource);
712 #endif
713 }
714
715 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier)
716 {
717 #if ENABLE(INSPECTOR)
718     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
719     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
720         return willReceiveResourceDataImpl(instrumentingAgents, identifier);
721 #endif
722     return InspectorInstrumentationCookie();
723 }
724
725 inline void InspectorInstrumentation::didReceiveResourceData(const InspectorInstrumentationCookie& cookie)
726 {
727 #if ENABLE(INSPECTOR)
728     FAST_RETURN_IF_NO_FRONTENDS(void());
729     if (cookie.first)
730         didReceiveResourceDataImpl(cookie);
731 #endif
732 }
733
734 inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame, unsigned long identifier, const ResourceResponse& response)
735 {
736 #if ENABLE(INSPECTOR)
737     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
738         return willReceiveResourceResponseImpl(instrumentingAgents, identifier, response);
739 #endif
740     return InspectorInstrumentationCookie();
741 }
742
743 inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
744 {
745 #if ENABLE(INSPECTOR)
746     // Call this unconditionally so that we're able to log to console with no front-end attached.
747     didReceiveResourceResponseImpl(cookie, identifier, loader, response);
748 #endif
749 }
750
751 inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
752 {
753 #if ENABLE(INSPECTOR)
754     FAST_RETURN_IF_NO_FRONTENDS(void());
755     InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(frame, loader, identifier, r);
756 #endif
757 }
758
759 inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
760 {
761 #if ENABLE(INSPECTOR)
762     FAST_RETURN_IF_NO_FRONTENDS(void());
763     InspectorInstrumentation::continueWithPolicyDownloadImpl(frame, loader, identifier, r);
764 #endif
765 }
766
767 inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
768 {
769 #if ENABLE(INSPECTOR)
770     FAST_RETURN_IF_NO_FRONTENDS(void());
771     InspectorInstrumentation::continueWithPolicyIgnoreImpl(frame, loader, identifier, r);
772 #endif
773 }
774
775 inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
776 {
777 #if ENABLE(INSPECTOR)
778     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
779         didReceiveDataImpl(instrumentingAgents, identifier, data, dataLength, encodedDataLength);
780 #endif
781 }
782
783 inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, double finishTime)
784 {
785 #if ENABLE(INSPECTOR)
786     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
787         didFinishLoadingImpl(instrumentingAgents, identifier, loader, finishTime);
788 #endif
789 }
790
791 inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
792 {
793 #if ENABLE(INSPECTOR)
794     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
795         didFailLoadingImpl(instrumentingAgents, identifier, loader, error);
796 #endif
797 }
798
799 inline void InspectorInstrumentation::resourceRetrievedByXMLHttpRequest(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
800 {
801 #if ENABLE(INSPECTOR)
802     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
803         resourceRetrievedByXMLHttpRequestImpl(instrumentingAgents, identifier, sourceString, url, sendURL, sendLineNumber);
804 #endif
805 }
806
807 inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionContext* context, unsigned long identifier)
808 {
809 #if ENABLE(INSPECTOR)
810     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
811         didReceiveXHRResponseImpl(instrumentingAgents, identifier);
812 #endif
813 }
814
815 inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context)
816 {
817 #if ENABLE(INSPECTOR)
818     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
819         willLoadXHRSynchronouslyImpl(instrumentingAgents);
820 #endif
821 }
822
823 inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context)
824 {
825 #if ENABLE(INSPECTOR)
826     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
827         didLoadXHRSynchronouslyImpl(instrumentingAgents);
828 #endif
829 }
830
831 inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString)
832 {
833 #if ENABLE(INSPECTOR)
834     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
835         scriptImportedImpl(instrumentingAgents, identifier, sourceString);
836 #endif
837 }
838
839 inline void InspectorInstrumentation::domContentLoadedEventFired(Frame* frame, const KURL& url)
840 {
841 #if ENABLE(INSPECTOR)
842     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
843         domContentLoadedEventFiredImpl(instrumentingAgents, frame, url);
844 #endif
845 }
846
847 inline void InspectorInstrumentation::loadEventFired(Frame* frame, const KURL& url)
848 {
849 #if ENABLE(INSPECTOR)
850     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
851         loadEventFiredImpl(instrumentingAgents, frame, url);
852 #endif
853 }
854
855 inline void InspectorInstrumentation::frameDetachedFromParent(Frame* frame)
856 {
857 #if ENABLE(INSPECTOR)
858     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
859         frameDetachedFromParentImpl(instrumentingAgents, frame);
860 #endif
861 }
862
863 inline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader)
864 {
865 #if ENABLE(INSPECTOR)
866     if (!frame)
867         return;
868     Page* page = frame->page();
869     if (!page)
870         return;
871     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
872         didCommitLoadImpl(instrumentingAgents, page, loader);
873 #endif
874 }
875
876 inline void InspectorInstrumentation::frameDestroyed(Frame* frame)
877 {
878 #if ENABLE(INSPECTOR)
879     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
880         frameDestroyedImpl(instrumentingAgents, frame);
881 #endif
882 }
883
884 inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame* frame, DocumentLoader* loader)
885 {
886 #if ENABLE(INSPECTOR)
887     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
888         loaderDetachedFromFrameImpl(instrumentingAgents, loader);
889 #endif
890 }
891
892 inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned int length, unsigned int startLine)
893 {
894 #if ENABLE(INSPECTOR)
895     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
896     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
897         return willWriteHTMLImpl(instrumentingAgents, length, startLine);
898 #endif
899     return InspectorInstrumentationCookie();
900 }
901
902 inline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentationCookie& cookie, unsigned int endLine)
903 {
904 #if ENABLE(INSPECTOR)
905     FAST_RETURN_IF_NO_FRONTENDS(void());
906     if (cookie.first)
907         didWriteHTMLImpl(cookie, endLine);
908 #endif
909 }
910
911 #if ENABLE(DOM_STORAGE)
912 inline void InspectorInstrumentation::didUseDOMStorage(Page* page, StorageArea* storageArea, bool isLocalStorage, Frame* frame)
913 {
914 #if ENABLE(INSPECTOR)
915     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
916         didUseDOMStorageImpl(instrumentingAgents, storageArea, isLocalStorage, frame);
917 #endif
918 }
919 #endif
920
921 #if ENABLE(WORKERS)
922 inline void InspectorInstrumentation::didStartWorkerContext(ScriptExecutionContext* context, WorkerContextProxy* proxy, const KURL& url)
923 {
924 #if ENABLE(INSPECTOR)
925     FAST_RETURN_IF_NO_FRONTENDS(void());
926     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
927         didStartWorkerContextImpl(instrumentingAgents, proxy, url);
928 #endif
929 }
930
931 inline void InspectorInstrumentation::didCreateWorker(ScriptExecutionContext* context, intptr_t id, const String& url, bool isSharedWorker)
932 {
933 #if ENABLE(INSPECTOR)
934     FAST_RETURN_IF_NO_FRONTENDS(void());
935     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
936         didCreateWorkerImpl(instrumentingAgents, id, url, isSharedWorker);
937 #endif
938 }
939
940 inline void InspectorInstrumentation::didDestroyWorker(ScriptExecutionContext* context, intptr_t id)
941 {
942 #if ENABLE(INSPECTOR)
943     FAST_RETURN_IF_NO_FRONTENDS(void());
944     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
945         didDestroyWorkerImpl(instrumentingAgents, id);
946 #endif
947 }
948
949 inline void InspectorInstrumentation::workerContextTerminated(ScriptExecutionContext* context, WorkerContextProxy* proxy)
950 {
951 #if ENABLE(INSPECTOR)
952     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
953         workerContextTerminatedImpl(instrumentingAgents, proxy);
954 #endif
955 }
956
957 #endif
958
959
960 #if ENABLE(WEB_SOCKETS)
961 inline void InspectorInstrumentation::didCreateWebSocket(ScriptExecutionContext* context, unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
962 {
963 #if ENABLE(INSPECTOR)
964     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
965         didCreateWebSocketImpl(instrumentingAgents, identifier, requestURL, documentURL);
966 #endif
967 }
968
969 inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeRequest& request)
970 {
971 #if ENABLE(INSPECTOR)
972     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
973         willSendWebSocketHandshakeRequestImpl(instrumentingAgents, identifier, request);
974 #endif
975 }
976
977 inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeResponse& response)
978 {
979 #if ENABLE(INSPECTOR)
980     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
981         didReceiveWebSocketHandshakeResponseImpl(instrumentingAgents, identifier, response);
982 #endif
983 }
984
985 inline void InspectorInstrumentation::didCloseWebSocket(ScriptExecutionContext* context, unsigned long identifier)
986 {
987 #if ENABLE(INSPECTOR)
988     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
989         didCloseWebSocketImpl(instrumentingAgents, identifier);
990 #endif
991 }
992 #endif
993
994 inline void InspectorInstrumentation::networkStateChanged(Page* page)
995 {
996 #if ENABLE(INSPECTOR) && ENABLE(OFFLINE_WEB_APPLICATIONS)
997     FAST_RETURN_IF_NO_FRONTENDS(void());
998     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
999         networkStateChangedImpl(instrumentingAgents);
1000 #endif
1001 }
1002
1003 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
1004 inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
1005 {
1006 #if ENABLE(INSPECTOR)
1007     FAST_RETURN_IF_NO_FRONTENDS(void());
1008     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
1009         updateApplicationCacheStatusImpl(instrumentingAgents, frame);
1010 #endif
1011 }
1012 #endif
1013
1014 #if ENABLE(INSPECTOR)
1015 inline bool InspectorInstrumentation::collectingHTMLParseErrors(Page* page)
1016 {
1017     FAST_RETURN_IF_NO_FRONTENDS(false);
1018     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
1019         return collectingHTMLParseErrors(instrumentingAgents);
1020     return false;
1021 }
1022
1023 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context)
1024 {
1025     if (context && context->isDocument())
1026         return instrumentingAgentsForPage(static_cast<Document*>(context)->page());
1027     return 0;
1028 }
1029
1030 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame)
1031 {
1032     if (frame)
1033         return instrumentingAgentsForPage(frame->page());
1034     return 0;
1035 }
1036
1037 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document* document)
1038 {
1039     if (document)
1040         return instrumentingAgentsForPage(document->page());
1041     return 0;
1042 }
1043 #endif
1044
1045 } // namespace WebCore
1046
1047 #endif // !defined(InspectorInstrumentation_h)