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