1a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/*
2a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* Copyright (C) 2010 Google Inc. All rights reserved.
3a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*
4a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* Redistribution and use in source and binary forms, with or without
5a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* modification, are permitted provided that the following conditions are
6a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* met:
7a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*
8a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*     * Redistributions of source code must retain the above copyright
9a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* notice, this list of conditions and the following disclaimer.
10a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*     * Redistributions in binary form must reproduce the above
11a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* copyright notice, this list of conditions and the following disclaimer
12a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* in the documentation and/or other materials provided with the
13a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* distribution.
14a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*     * Neither the name of Google Inc. nor the names of its
15a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* contributors may be used to endorse or promote products derived from
16a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* this software without specific prior written permission.
17a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*
18a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch*/
30a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
31a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#ifndef InspectorInstrumentation_h
32a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#define InspectorInstrumentation_h
33a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
3465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#include "Console.h"
35a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "Frame.h"
36a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "Page.h"
37a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "ScriptExecutionContext.h"
382fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#include <wtf/HashMap.h>
3965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
40a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochnamespace WebCore {
41a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
42a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochclass CharacterData;
4365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass DOMWrapperWorld;
4465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass Database;
45cad810f21b803229eb11403f9209855525a25d57Steve Blockclass Document;
46a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochclass Element;
476b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brennerclass EventContext;
4865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass DocumentLoader;
4965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass HitTestResult;
502fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockclass InspectorAgent;
512bde8e466a4451c7319e3a072d118917957d6554Steve Blockclass InspectorPageAgent;
5265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass InspectorResourceAgent;
53a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochclass InspectorTimelineAgent;
54e14391e94c850b8bd03680c23b38978db68687a8John Reckclass KURL;
55a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochclass Node;
56a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochclass ResourceRequest;
57a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochclass ResourceResponse;
5865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass ScriptArguments;
5965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass ScriptCallStack;
6065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass ScriptExecutionContext;
6165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass StorageArea;
62a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochclass XMLHttpRequest;
63a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
64e14391e94c850b8bd03680c23b38978db68687a8John Reck#if ENABLE(WEB_SOCKETS)
65e14391e94c850b8bd03680c23b38978db68687a8John Reckclass WebSocketHandshakeRequest;
66e14391e94c850b8bd03680c23b38978db68687a8John Reckclass WebSocketHandshakeResponse;
67e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif
68e14391e94c850b8bd03680c23b38978db68687a8John Reck
692fc2651226baac27029e38c9d6ef883fa32084dbSteve Blocktypedef pair<InspectorAgent*, int> InspectorInstrumentationCookie;
70a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
71a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochclass InspectorInstrumentation {
72a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochpublic:
7365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
7465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void inspectedPageDestroyed(Page*);
7565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
76a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void willInsertDOMNode(Document*, Node*, Node* parent);
77a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didInsertDOMNode(Document*, Node*);
78a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void willRemoveDOMNode(Document*, Node*);
79a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void willModifyDOMAttr(Document*, Element*);
80a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didModifyDOMAttr(Document*, Element*);
81a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void characterDataModified(Document*, CharacterData*);
8281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    static void didInvalidateStyleAttr(Document*, Node*);
83a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
8465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
8565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static bool handleMousePress(Page*);
8665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
87a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
88a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didScheduleResourceRequest(Document*, const String& url);
89a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
90a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didRemoveTimer(ScriptExecutionContext*, int timerId);
91a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
92a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willCallFunction(Frame*, const String& scriptName, int scriptLine);
93a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didCallFunction(const InspectorInstrumentationCookie&);
94a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willChangeXHRReadyState(ScriptExecutionContext*, XMLHttpRequest* request);
95a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didChangeXHRReadyState(const InspectorInstrumentationCookie&);
966b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner    static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
97a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didDispatchEvent(const InspectorInstrumentationCookie&);
98a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
99a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
100a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willEvaluateScript(Frame*, const String& url, int lineNumber);
101a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didEvaluateScript(const InspectorInstrumentationCookie&);
102a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext*, int timerId);
103a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didFireTimer(const InspectorInstrumentationCookie&);
104a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willLayout(Frame*);
105a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didLayout(const InspectorInstrumentationCookie&);
106a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willLoadXHR(ScriptExecutionContext*, XMLHttpRequest*);
107a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didLoadXHR(const InspectorInstrumentationCookie&);
108a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willPaint(Frame*, const IntRect& rect);
109a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didPaint(const InspectorInstrumentationCookie&);
110a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willRecalculateStyle(Document*);
111a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didRecalculateStyle(const InspectorInstrumentationCookie&);
11265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
1132fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void applyUserAgentOverride(Frame*, String*);
1142bde8e466a4451c7319e3a072d118917957d6554Steve Block    static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
11565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void markResourceAsCached(Page*, unsigned long identifier);
11665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, const CachedResource*);
117a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier);
118a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didReceiveResourceData(const InspectorInstrumentationCookie&);
11965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&);
12065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
1212daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
1222daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
1232daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
1242daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    static void didReceiveContentLength(Frame*, unsigned long identifier, int dataLength, int encodedDataLength);
12565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didFinishLoading(Frame*, unsigned long identifier, double finishTime);
12665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didFailLoading(Frame*, unsigned long identifier, const ResourceError&);
12765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void resourceRetrievedByXMLHttpRequest(ScriptExecutionContext*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
12865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString);
1292fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void domContentLoadedEventFired(Frame*, const KURL&);
1302fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void loadEventFired(Frame*, const KURL&);
13165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void frameDetachedFromParent(Frame*);
13265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didCommitLoad(Frame*, DocumentLoader*);
13365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
134a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned int length, unsigned int startLine);
135a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didWriteHTML(const InspectorInstrumentationCookie&, unsigned int endLine);
136a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
1372fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
13865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String&);
1392fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void consoleCount(Page*, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
14065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void startConsoleTiming(Page*, const String& title);
1412fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void stopConsoleTiming(Page*, const String& title, PassRefPtr<ScriptCallStack>);
1422fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void consoleMarkTimeline(Page*, PassRefPtr<ScriptArguments>);
14365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
14465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(JAVASCRIPT_DEBUGGER)
14565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, const String& sourceURL);
1462fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void addProfile(Page*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
147ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch    static String getCurrentUserInitiatedProfileName(Page*, bool incrementProfileNumber);
1482fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static bool profilerEnabled(Page*);
14965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
15065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
15165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(DATABASE)
1522fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didOpenDatabase(ScriptExecutionContext*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
15365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
15465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
15565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(DOM_STORAGE)
15665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didUseDOMStorage(Page*, StorageArea*, bool isLocalStorage, Frame*);
15765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
15865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
15965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(WORKERS)
16065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didCreateWorker(ScriptExecutionContext*, intptr_t id, const String& url, bool isSharedWorker);
16165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didDestroyWorker(ScriptExecutionContext*, intptr_t id);
16265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
16365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
164e14391e94c850b8bd03680c23b38978db68687a8John Reck#if ENABLE(WEB_SOCKETS)
165e14391e94c850b8bd03680c23b38978db68687a8John Reck    static void didCreateWebSocket(ScriptExecutionContext*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
166e14391e94c850b8bd03680c23b38978db68687a8John Reck    static void willSendWebSocketHandshakeRequest(ScriptExecutionContext*, unsigned long identifier, const WebSocketHandshakeRequest&);
167e14391e94c850b8bd03680c23b38978db68687a8John Reck    static void didReceiveWebSocketHandshakeResponse(ScriptExecutionContext*, unsigned long identifier, const WebSocketHandshakeResponse&);
168e14391e94c850b8bd03680c23b38978db68687a8John Reck    static void didCloseWebSocket(ScriptExecutionContext*, unsigned long identifier);
169e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif
170e14391e94c850b8bd03680c23b38978db68687a8John Reck
17165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void networkStateChanged(Page*);
17265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
17365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(OFFLINE_WEB_APPLICATIONS)
17465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void updateApplicationCacheStatus(Frame*);
17565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
17665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
177a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
1782fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void bindInspectorAgent(Page* page, InspectorAgent* inspectorAgent) { inspectorAgents().set(page, inspectorAgent); }
1792fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void unbindInspectorAgent(Page* page) { inspectorAgents().remove(page); }
180a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void frontendCreated() { s_frontendCounter += 1; }
181a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void frontendDeleted() { s_frontendCounter -= 1; }
182a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static bool hasFrontends() { return s_frontendCounter; }
1832fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static bool hasFrontend(Page*);
184a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#else
185a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static bool hasFrontends() { return false; }
1862fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static bool hasFrontend(Page*) { return false; }
187a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
188a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
189a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochprivate:
190a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
1912fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didClearWindowObjectInWorldImpl(InspectorAgent*, Frame*, DOMWrapperWorld*);
1922fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void inspectedPageDestroyedImpl(InspectorAgent*);
19365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
1942fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void willInsertDOMNodeImpl(InspectorAgent*, Node* node, Node* parent);
1952fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didInsertDOMNodeImpl(InspectorAgent*, Node*);
1962fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void willRemoveDOMNodeImpl(InspectorAgent*, Node*);
1972fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didRemoveDOMNodeImpl(InspectorAgent*, Node*);
1982fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void willModifyDOMAttrImpl(InspectorAgent*, Element*);
1992fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didModifyDOMAttrImpl(InspectorAgent*, Element*);
2002fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void characterDataModifiedImpl(InspectorAgent*, CharacterData*);
20181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    static void didInvalidateStyleAttrImpl(InspectorAgent*, Node*);
202a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
2032fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void mouseDidMoveOverElementImpl(InspectorAgent*, const HitTestResult&, unsigned modifierFlags);
2042fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static bool handleMousePressImpl(InspectorAgent*);
20565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
2062fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void willSendXMLHttpRequestImpl(InspectorAgent*, const String& url);
2072fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didScheduleResourceRequestImpl(InspectorAgent*, const String& url);
2082fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didInstallTimerImpl(InspectorAgent*, int timerId, int timeout, bool singleShot);
2092fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didRemoveTimerImpl(InspectorAgent*, int timerId);
210a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
2112fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willCallFunctionImpl(InspectorAgent*, const String& scriptName, int scriptLine);
212a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didCallFunctionImpl(const InspectorInstrumentationCookie&);
2132fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willChangeXHRReadyStateImpl(InspectorAgent*, XMLHttpRequest* request);
214a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didChangeXHRReadyStateImpl(const InspectorInstrumentationCookie&);
2152fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willDispatchEventImpl(InspectorAgent*, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors);
216a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
2172fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InspectorAgent*, const Event& event, DOMWindow* window);
218a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
2192fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willEvaluateScriptImpl(InspectorAgent*, const String& url, int lineNumber);
220a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&);
2212fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willFireTimerImpl(InspectorAgent*, int timerId);
222a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didFireTimerImpl(const InspectorInstrumentationCookie&);
2232fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willLayoutImpl(InspectorAgent*);
224a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didLayoutImpl(const InspectorInstrumentationCookie&);
2252fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willLoadXHRImpl(InspectorAgent*, XMLHttpRequest* request);
226a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didLoadXHRImpl(const InspectorInstrumentationCookie&);
2272fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willPaintImpl(InspectorAgent*, const IntRect& rect);
228a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didPaintImpl(const InspectorInstrumentationCookie&);
2292fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willRecalculateStyleImpl(InspectorAgent*);
230a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
2312fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
2322fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void applyUserAgentOverrideImpl(InspectorAgent*, String*);
2332bde8e466a4451c7319e3a072d118917957d6554Steve Block    static void willSendRequestImpl(InspectorAgent*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
2342fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void markResourceAsCachedImpl(InspectorAgent*, unsigned long identifier);
2352fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didLoadResourceFromMemoryCacheImpl(InspectorAgent*, DocumentLoader*, const CachedResource*);
2362fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willReceiveResourceDataImpl(InspectorAgent*, unsigned long identifier);
237a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
2382fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InspectorAgent*, unsigned long identifier, const ResourceResponse&);
23965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&);
2402daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
2412daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
2422daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
2432daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
2442daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    static void didReceiveContentLengthImpl(InspectorAgent*, unsigned long identifier, int dataLength, int encodedDataLength);
2452fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didFinishLoadingImpl(InspectorAgent*, unsigned long identifier, double finishTime);
2462fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didFailLoadingImpl(InspectorAgent*, unsigned long identifier, const ResourceError&);
2472fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void resourceRetrievedByXMLHttpRequestImpl(InspectorAgent*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
2482fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void scriptImportedImpl(InspectorAgent*, unsigned long identifier, const String& sourceString);
2492fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void domContentLoadedEventFiredImpl(InspectorAgent*, Frame*, const KURL&);
2502fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void loadEventFiredImpl(InspectorAgent*, Frame*, const KURL&);
2512fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void frameDetachedFromParentImpl(InspectorAgent*, Frame*);
25281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    static void didCommitLoadImpl(Page*, InspectorAgent*, DocumentLoader*);
2532fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
2542fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorInstrumentationCookie willWriteHTMLImpl(InspectorAgent*, unsigned int length, unsigned int startLine);
255a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned int endLine);
256a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
2572fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void addMessageToConsoleImpl(InspectorAgent*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
2582fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void addMessageToConsoleImpl(InspectorAgent*, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
2592fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void consoleCountImpl(InspectorAgent*, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>);
2602fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void startConsoleTimingImpl(InspectorAgent*, const String& title);
2612fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void stopConsoleTimingImpl(InspectorAgent*, const String& title, PassRefPtr<ScriptCallStack>);
2622fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void consoleMarkTimelineImpl(InspectorAgent*, PassRefPtr<ScriptArguments>);
26365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
26465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(JAVASCRIPT_DEBUGGER)
2652fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void addStartProfilingMessageToConsoleImpl(InspectorAgent*, const String& title, unsigned lineNumber, const String& sourceURL);
2662fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void addProfileImpl(InspectorAgent*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
2672fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static String getCurrentUserInitiatedProfileNameImpl(InspectorAgent*, bool incrementProfileNumber);
2682fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static bool profilerEnabledImpl(InspectorAgent*);
26965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
27065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
27165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(DATABASE)
2722fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didOpenDatabaseImpl(InspectorAgent*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
27365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
27465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
27565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(DOM_STORAGE)
2762fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didUseDOMStorageImpl(InspectorAgent*, StorageArea*, bool isLocalStorage, Frame*);
27765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
27865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
27965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(WORKERS)
2802fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didCreateWorkerImpl(InspectorAgent*, intptr_t id, const String& url, bool isSharedWorker);
2812fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didDestroyWorkerImpl(InspectorAgent*, intptr_t id);
28265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
28365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
284e14391e94c850b8bd03680c23b38978db68687a8John Reck#if ENABLE(WEB_SOCKETS)
2852fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didCreateWebSocketImpl(InspectorAgent*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
2862fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void willSendWebSocketHandshakeRequestImpl(InspectorAgent*, unsigned long identifier, const WebSocketHandshakeRequest&);
2872fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didReceiveWebSocketHandshakeResponseImpl(InspectorAgent*, unsigned long identifier, const WebSocketHandshakeResponse&);
2882fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void didCloseWebSocketImpl(InspectorAgent*, unsigned long identifier);
289e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif
290e14391e94c850b8bd03680c23b38978db68687a8John Reck
29165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(OFFLINE_WEB_APPLICATIONS)
2922fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void networkStateChangedImpl(InspectorAgent*);
2932fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void updateApplicationCacheStatusImpl(InspectorAgent*, Frame*);
2942fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#endif
2952fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
2962fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorAgent* inspectorAgentForFrame(Frame*);
2972fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorAgent* inspectorAgentForContext(ScriptExecutionContext*);
2982fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorAgent* inspectorAgentForPage(Page*);
2992fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorAgent* inspectorAgentWithFrontendForContext(ScriptExecutionContext*);
3002fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorAgent* inspectorAgentWithFrontendForDocument(Document*);
3012fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorAgent* inspectorAgentWithFrontendForFrame(Frame*);
3022fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorAgent* inspectorAgentWithFrontendForPage(Page*);
3032fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
3042fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static bool hasFrontend(InspectorAgent*);
3052fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void pauseOnNativeEventIfNeeded(InspectorAgent*, const String& categoryType, const String& eventName, bool synchronous);
3062fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static void cancelPauseOnNativeEvent(InspectorAgent*);
3072fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorTimelineAgent* retrieveTimelineAgent(InspectorAgent*);
308a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
3092fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static InspectorResourceAgent* retrieveResourceAgent(InspectorAgent*);
3102bde8e466a4451c7319e3a072d118917957d6554Steve Block    static InspectorPageAgent* retrievePageAgent(InspectorAgent*);
311a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
3122fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    static HashMap<Page*, InspectorAgent*>& inspectorAgents();
313a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    static int s_frontendCounter;
314a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
315a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch};
316a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
31765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
31865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
31965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
3202fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
3212fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didClearWindowObjectInWorldImpl(inspectorAgent, frame, world);
32265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
32365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
32465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
32565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::inspectedPageDestroyed(Page* page)
32665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
32765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
3282fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
3292fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        inspectedPageDestroyedImpl(inspectorAgent);
33065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
33165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
33265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
333a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::willInsertDOMNode(Document* document, Node* node, Node* parent)
334a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
335a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
3362fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
3372fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        willInsertDOMNodeImpl(inspectorAgent, node, parent);
338a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
339a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
340a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
341a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didInsertDOMNode(Document* document, Node* node)
342a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
343a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
3442fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
3452fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didInsertDOMNodeImpl(inspectorAgent, node);
346a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
347a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
348a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
349a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::willRemoveDOMNode(Document* document, Node* node)
350a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
351a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
3522fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document)) {
3532fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        willRemoveDOMNodeImpl(inspectorAgent, node);
3542fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didRemoveDOMNodeImpl(inspectorAgent, node);
355a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    }
356a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
357a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
358a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
359a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element)
360a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
361a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
3622fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
3632fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        willModifyDOMAttrImpl(inspectorAgent, element);
364a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
365a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
366a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
367a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element)
368a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
369a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
3702fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
3712fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didModifyDOMAttrImpl(inspectorAgent, element);
372a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
373a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
374a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
37581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochinline void InspectorInstrumentation::didInvalidateStyleAttr(Document* document, Node* node)
37681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch{
37781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch#if ENABLE(INSPECTOR)
37881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
37981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch        didInvalidateStyleAttrImpl(inspectorAgent, node);
38081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch#endif
38181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch}
38281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch
38365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const HitTestResult& result, unsigned modifierFlags)
38465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
38565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
3862fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForPage(page))
3872fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        mouseDidMoveOverElementImpl(inspectorAgent, result, modifierFlags);
38865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
38965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
39065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
39165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline bool InspectorInstrumentation::handleMousePress(Page* page)
39265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
39365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
3942fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForPage(page))
3952fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return handleMousePressImpl(inspectorAgent);
39665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
39765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    return false;
39865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
39965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
400a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::characterDataModified(Document* document, CharacterData* characterData)
401a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
402a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
4032fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
4042fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        characterDataModifiedImpl(inspectorAgent, characterData);
405a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
406a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
407a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
408a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url)
409a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
410a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
4112fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
4122fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        willSendXMLHttpRequestImpl(inspectorAgent, url);
413a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
414a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
415a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
416a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didScheduleResourceRequest(Document* document, const String& url)
417a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
418a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
4192fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
4202fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didScheduleResourceRequestImpl(inspectorAgent, url);
421a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
422a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
423a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
424a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot)
425a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
426a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
4272fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
4282fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didInstallTimerImpl(inspectorAgent, timerId, timeout, singleShot);
429a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
430a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
431a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
432a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* context, int timerId)
433a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
434a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
4352fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
4362fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didRemoveTimerImpl(inspectorAgent, timerId);
437a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
438a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
439a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
440a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
441a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(Frame* frame, const String& scriptName, int scriptLine)
442a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
443a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
4442fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
4452fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willCallFunctionImpl(inspectorAgent, scriptName, scriptLine);
446a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
447a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
448a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
449a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
450a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie)
451a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
452a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
453a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
454a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didCallFunctionImpl(cookie);
455a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
456a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
457a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
458a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willChangeXHRReadyState(ScriptExecutionContext* context, XMLHttpRequest* request)
459a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
460a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
4612fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
4622fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willChangeXHRReadyStateImpl(inspectorAgent, request);
463a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
464a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
465a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
466a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
467a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didChangeXHRReadyState(const InspectorInstrumentationCookie& cookie)
468a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
469a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
470a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
471a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didChangeXHRReadyStateImpl(cookie);
472a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
473a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
474a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
4756b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brennerinline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const Vector<EventContext>& ancestors)
476a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
477a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
4782fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
4792fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willDispatchEventImpl(inspectorAgent, event, window, node, ancestors);
480a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
481a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
482a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
483a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
484a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrumentationCookie& cookie)
485a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
486a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
487a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
488a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didDispatchEventImpl(cookie);
489a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
490a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
491a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
492a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window)
493a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
494a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
4952fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
4962fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willDispatchEventOnWindowImpl(inspectorAgent, event, window);
497a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
498a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
499a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
500a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
501a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorInstrumentationCookie& cookie)
502a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
503a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
504a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
505a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didDispatchEventOnWindowImpl(cookie);
506a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
507a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
508a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
509a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame* frame, const String& url, int lineNumber)
510a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
511a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
5122fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
5132fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willEvaluateScriptImpl(inspectorAgent, url, lineNumber);
514a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
515a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
516a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
517a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
518a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie)
519a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
520a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
521a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
522a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didEvaluateScriptImpl(cookie);
523a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
524a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
525a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
526a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId)
527a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
528a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
5292fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
5302fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willFireTimerImpl(inspectorAgent, timerId);
531a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
532a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
533a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
534a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
535a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentationCookie& cookie)
536a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
537a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
538a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
539a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didFireTimerImpl(cookie);
540a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
541a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
542a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
543a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame)
544a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
545a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
5462fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
5472fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willLayoutImpl(inspectorAgent);
548a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
549a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
550a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
551a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
552a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie)
553a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
554a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
555a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
556a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didLayoutImpl(cookie);
557a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
558a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
559a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
560a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* context, XMLHttpRequest* request)
561a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
562a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
5632fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
5642fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willLoadXHRImpl(inspectorAgent, request);
565a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
566a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
567a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
568a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
569a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didLoadXHR(const InspectorInstrumentationCookie& cookie)
570a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
571a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
572a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
573a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didLoadXHRImpl(cookie);
574a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
575a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
576a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
577a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willPaint(Frame* frame, const IntRect& rect)
578a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
579a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
5802fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
5812fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willPaintImpl(inspectorAgent, rect);
582a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
583a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
584a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
585a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
586a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didPaint(const InspectorInstrumentationCookie& cookie)
587a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
588a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
589a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
590a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didPaintImpl(cookie);
591a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
592a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
593a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
594a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document)
595a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
596a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
5972fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
5982fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willRecalculateStyleImpl(inspectorAgent);
599a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
600a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
601a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
602a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
603a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie)
604a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
605a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
606a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
607a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didRecalculateStyleImpl(cookie);
608a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
609a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
610a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
6112fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, String* userAgent)
6122fc2651226baac27029e38c9d6ef883fa32084dbSteve Block{
6132fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#if ENABLE(INSPECTOR)
6142fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
6152fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        applyUserAgentOverrideImpl(inspectorAgent, userAgent);
6162fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#endif
6172fc2651226baac27029e38c9d6ef883fa32084dbSteve Block}
6182fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
6192bde8e466a4451c7319e3a072d118917957d6554Steve Blockinline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
62065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
62165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
6222daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* ic = inspectorAgentForFrame(frame))
6232bde8e466a4451c7319e3a072d118917957d6554Steve Block        willSendRequestImpl(ic, identifier, loader, request, redirectResponse);
62465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
62565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
62665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
62765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::markResourceAsCached(Page* page, unsigned long identifier)
62865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
62965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
6302fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    markResourceAsCachedImpl(inspectorAgentForPage(page), identifier);
63165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
63265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
63365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
63465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, const CachedResource* resource)
63565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
63665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
6372fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    didLoadResourceFromMemoryCacheImpl(inspectorAgentForPage(page), loader, resource);
63865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
63965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
64065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
641a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier)
642a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
643a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
6442fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
6452fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willReceiveResourceDataImpl(inspectorAgent, identifier);
646a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
647a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
648a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
649a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
650a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didReceiveResourceData(const InspectorInstrumentationCookie& cookie)
651a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
652a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
653a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
654a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didReceiveResourceDataImpl(cookie);
655a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
656a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
657a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
658a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame, unsigned long identifier, const ResourceResponse& response)
659a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
660a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
6612daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
6622fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willReceiveResourceResponseImpl(inspectorAgent, identifier, response);
663a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
664a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
665a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
666a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
66765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
668a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
669a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
6702bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Call this unconditionally so that we're able to log to console with no front-end attached.
6712bde8e466a4451c7319e3a072d118917957d6554Steve Block    didReceiveResourceResponseImpl(cookie, identifier, loader, response);
67265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
67365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
67465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
6752daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochinline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
67665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
67765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
6782daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (inspectorAgentWithFrontendForFrame(frame))
6792daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch        InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(frame, loader, identifier, r);
6802daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#endif
6812daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch}
6822daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
6832daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochinline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
6842daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{
6852daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#if ENABLE(INSPECTOR)
6862daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (inspectorAgentWithFrontendForFrame(frame))
6872daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch        InspectorInstrumentation::continueWithPolicyDownloadImpl(frame, loader, identifier, r);
6882daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#endif
6892daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch}
6902daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
6912daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochinline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
6922daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{
6932daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#if ENABLE(INSPECTOR)
6942daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (inspectorAgentWithFrontendForFrame(frame))
6952daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch        InspectorInstrumentation::continueWithPolicyIgnoreImpl(frame, loader, identifier, r);
6962daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#endif
6972daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch}
6982daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
6992daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochinline void InspectorInstrumentation::didReceiveContentLength(Frame* frame, unsigned long identifier, int dataLength, int encodedDataLength)
7002daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{
7012daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#if ENABLE(INSPECTOR)
7022daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
7032daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch        didReceiveContentLengthImpl(inspectorAgent, identifier, dataLength, encodedDataLength);
70465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
70565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
70665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
70765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::didFinishLoading(Frame* frame, unsigned long identifier, double finishTime)
70865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
70965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
7102daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
7112fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didFinishLoadingImpl(inspectorAgent, identifier, finishTime);
71265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
71365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
71465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
71565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::didFailLoading(Frame* frame, unsigned long identifier, const ResourceError& error)
71665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
71765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
7182bde8e466a4451c7319e3a072d118917957d6554Steve Block    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
7192fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didFailLoadingImpl(inspectorAgent, identifier, error);
72065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
72165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
72265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
72365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::resourceRetrievedByXMLHttpRequest(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
72465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
72565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
7262fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
7272fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        resourceRetrievedByXMLHttpRequestImpl(inspectorAgent, identifier, sourceString, url, sendURL, sendLineNumber);
72865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
72965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
73065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
73165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString)
73265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
73365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
7342fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
7352fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        scriptImportedImpl(inspectorAgent, identifier, sourceString);
73665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
73765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
73865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
7392fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline void InspectorInstrumentation::domContentLoadedEventFired(Frame* frame, const KURL& url)
74065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
74165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
7422daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
7432fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        domContentLoadedEventFiredImpl(inspectorAgent, frame, url);
74465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
74565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
74665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
7472fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline void InspectorInstrumentation::loadEventFired(Frame* frame, const KURL& url)
74865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
74965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
7502daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
7512fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        loadEventFiredImpl(inspectorAgent, frame, url);
75265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
75365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
75465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
75565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::frameDetachedFromParent(Frame* frame)
75665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
75765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
7582daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForFrame(frame))
7592fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        frameDetachedFromParentImpl(inspectorAgent, frame);
76065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
76165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
76265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
76365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader)
76465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
76565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
76681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    if (!frame)
76781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch        return;
76881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    Page* page = frame->page();
76981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    if (!page)
77081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch        return;
77181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
77281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch        didCommitLoadImpl(page, inspectorAgent, loader);
773a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
774a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
775a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
776a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned int length, unsigned int startLine)
777a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
778a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
7792fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForDocument(document))
7802fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return willWriteHTMLImpl(inspectorAgent, length, startLine);
781a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
782a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return InspectorInstrumentationCookie();
783a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
784a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
785a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochinline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentationCookie& cookie, unsigned int endLine)
786a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
787a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
788a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && cookie.first)
789a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        didWriteHTMLImpl(cookie, endLine);
790a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
791a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
792a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
79365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(DOM_STORAGE)
79465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::didUseDOMStorage(Page* page, StorageArea* storageArea, bool isLocalStorage, Frame* frame)
79565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
79665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
7972fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page))
7982fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didUseDOMStorageImpl(inspectorAgent, storageArea, isLocalStorage, frame);
79965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
80065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
80165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
80265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
80365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(WORKERS)
80465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::didCreateWorker(ScriptExecutionContext* context, intptr_t id, const String& url, bool isSharedWorker)
80565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
80665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
8072fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
8082fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didCreateWorkerImpl(inspectorAgent, id, url, isSharedWorker);
80965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
81065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
81165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
81265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::didDestroyWorker(ScriptExecutionContext* context, intptr_t id)
81365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
81465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
8152fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForContext(context))
8162fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didDestroyWorkerImpl(inspectorAgent, id);
81765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
81865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
81965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
82065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
82165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
822e14391e94c850b8bd03680c23b38978db68687a8John Reck#if ENABLE(WEB_SOCKETS)
823e14391e94c850b8bd03680c23b38978db68687a8John Reckinline void InspectorInstrumentation::didCreateWebSocket(ScriptExecutionContext* context, unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
824e14391e94c850b8bd03680c23b38978db68687a8John Reck{
825e14391e94c850b8bd03680c23b38978db68687a8John Reck#if ENABLE(INSPECTOR)
8262daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
8272fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didCreateWebSocketImpl(inspectorAgent, identifier, requestURL, documentURL);
828e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif
829e14391e94c850b8bd03680c23b38978db68687a8John Reck}
830e14391e94c850b8bd03680c23b38978db68687a8John Reck
831e14391e94c850b8bd03680c23b38978db68687a8John Reckinline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeRequest& request)
832e14391e94c850b8bd03680c23b38978db68687a8John Reck{
833e14391e94c850b8bd03680c23b38978db68687a8John Reck#if ENABLE(INSPECTOR)
8342daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
8352fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        willSendWebSocketHandshakeRequestImpl(inspectorAgent, identifier, request);
836e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif
837e14391e94c850b8bd03680c23b38978db68687a8John Reck}
838e14391e94c850b8bd03680c23b38978db68687a8John Reck
839e14391e94c850b8bd03680c23b38978db68687a8John Reckinline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeResponse& response)
840e14391e94c850b8bd03680c23b38978db68687a8John Reck{
841e14391e94c850b8bd03680c23b38978db68687a8John Reck#if ENABLE(INSPECTOR)
8422daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
8432fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didReceiveWebSocketHandshakeResponseImpl(inspectorAgent, identifier, response);
844e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif
845e14391e94c850b8bd03680c23b38978db68687a8John Reck}
846e14391e94c850b8bd03680c23b38978db68687a8John Reck
847e14391e94c850b8bd03680c23b38978db68687a8John Reckinline void InspectorInstrumentation::didCloseWebSocket(ScriptExecutionContext* context, unsigned long identifier)
848e14391e94c850b8bd03680c23b38978db68687a8John Reck{
849e14391e94c850b8bd03680c23b38978db68687a8John Reck#if ENABLE(INSPECTOR)
8502daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    if (InspectorAgent* inspectorAgent = inspectorAgentForContext(context))
8512fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        didCloseWebSocketImpl(inspectorAgent, identifier);
852e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif
853e14391e94c850b8bd03680c23b38978db68687a8John Reck}
854e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif
855a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
85665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::networkStateChanged(Page* page)
85765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
85865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR) && ENABLE(OFFLINE_WEB_APPLICATIONS)
8592fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForPage(page))
8602fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        networkStateChangedImpl(inspectorAgent);
86165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
86265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
86365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
86465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(OFFLINE_WEB_APPLICATIONS)
86565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochinline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
86665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
86765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
8682fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
8692fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        updateApplicationCacheStatusImpl(inspectorAgent, frame);
87065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
87165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
87265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
87365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
87465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#if ENABLE(INSPECTOR)
8752fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline bool InspectorInstrumentation::hasFrontend(Page* page)
87665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
8772fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    return inspectorAgentWithFrontendForPage(page);
87865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
87965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#endif
88065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
88165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
882a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#if ENABLE(INSPECTOR)
8832fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline InspectorAgent* InspectorInstrumentation::inspectorAgentForContext(ScriptExecutionContext* context)
884a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
88565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    if (context && context->isDocument())
8862fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return inspectorAgentForPage(static_cast<Document*>(context)->page());
887a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return 0;
888a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
889a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
8902fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline InspectorAgent* InspectorInstrumentation::inspectorAgentForFrame(Frame* frame)
89165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
89265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    if (frame)
8932fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return inspectorAgentForPage(frame->page());
89465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    return 0;
89565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
89665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
8972fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline InspectorAgent* InspectorInstrumentation::inspectorAgentForPage(Page* page)
89865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
89965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    if (!page)
90065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch        return 0;
9012fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    return inspectorAgents().get(page);
90265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
90365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
9042fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline InspectorAgent* InspectorInstrumentation::inspectorAgentWithFrontendForContext(ScriptExecutionContext* context)
90565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{
90665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    if (hasFrontends() && context && context->isDocument())
9072fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return inspectorAgentWithFrontendForPage(static_cast<Document*>(context)->page());
90865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    return 0;
90965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch}
91065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch
9112fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline InspectorAgent* InspectorInstrumentation::inspectorAgentWithFrontendForDocument(Document* document)
912a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
913a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && document)
9142fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return inspectorAgentWithFrontendForPage(document->page());
915a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return 0;
916a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
917a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
9182fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline InspectorAgent* InspectorInstrumentation::inspectorAgentWithFrontendForFrame(Frame* frame)
919a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
920a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (hasFrontends() && frame)
9212fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return inspectorAgentWithFrontendForPage(frame->page());
922a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return 0;
923a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
924a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
9252fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockinline InspectorAgent* InspectorInstrumentation::inspectorAgentWithFrontendForPage(Page* page)
926a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
927a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    if (page) {
9282fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        if (InspectorAgent* inspectorAgent = inspectorAgentForPage(page)) {
9292fc2651226baac27029e38c9d6ef883fa32084dbSteve Block            if (hasFrontend(inspectorAgent))
9302fc2651226baac27029e38c9d6ef883fa32084dbSteve Block                return inspectorAgent;
931a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        }
932a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    }
933a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    return 0;
934a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
935ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch
936a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif
937a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
938a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} // namespace WebCore
939a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
940a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif // !defined(InspectorInstrumentation_h)
941