| 1 | /* |
| 2 | * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 | * Copyright (C) 2014-2016 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are |
| 7 | * met: |
| 8 | * |
| 9 | * * Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * * Redistributions in binary form must reproduce the above |
| 12 | * copyright notice, this list of conditions and the following disclaimer |
| 13 | * in the documentation and/or other materials provided with the |
| 14 | * distribution. |
| 15 | * * Neither the name of Google Inc. nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #pragma once |
| 33 | |
| 34 | #include "CSSSelector.h" |
| 35 | #include "CallTracerTypes.h" |
| 36 | #include "CanvasBase.h" |
| 37 | #include "CanvasRenderingContext.h" |
| 38 | #include "Database.h" |
| 39 | #include "DocumentThreadableLoader.h" |
| 40 | #include "Element.h" |
| 41 | #include "EventTarget.h" |
| 42 | #include "FormData.h" |
| 43 | #include "Frame.h" |
| 44 | #include "HitTestResult.h" |
| 45 | #include "InspectorController.h" |
| 46 | #include "InspectorInstrumentationCookie.h" |
| 47 | #include "OffscreenCanvas.h" |
| 48 | #include "Page.h" |
| 49 | #include "StorageArea.h" |
| 50 | #include "WorkerGlobalScope.h" |
| 51 | #include "WorkerInspectorController.h" |
| 52 | #include <JavaScriptCore/JSCInlines.h> |
| 53 | #include <wtf/MemoryPressureHandler.h> |
| 54 | #include <wtf/RefPtr.h> |
| 55 | |
| 56 | #if ENABLE(WEBGL) |
| 57 | #include "WebGLRenderingContextBase.h" |
| 58 | #endif |
| 59 | |
| 60 | namespace Inspector { |
| 61 | class ConsoleMessage; |
| 62 | class ScriptArguments; |
| 63 | class ScriptCallStack; |
| 64 | } |
| 65 | |
| 66 | namespace WebCore { |
| 67 | |
| 68 | class CachedResource; |
| 69 | class CharacterData; |
| 70 | class DOMWindow; |
| 71 | class DOMWrapperWorld; |
| 72 | class Document; |
| 73 | class DocumentLoader; |
| 74 | class EventListener; |
| 75 | class ; |
| 76 | class InspectorTimelineAgent; |
| 77 | class InstrumentingAgents; |
| 78 | class NetworkLoadMetrics; |
| 79 | class Node; |
| 80 | class PseudoElement; |
| 81 | class RegisteredEventListener; |
| 82 | class RenderLayer; |
| 83 | class RenderObject; |
| 84 | class ResourceLoader; |
| 85 | class ResourceRequest; |
| 86 | class ResourceResponse; |
| 87 | class ScriptExecutionContext; |
| 88 | class SecurityOrigin; |
| 89 | class ShadowRoot; |
| 90 | class TimerBase; |
| 91 | #if ENABLE(WEBGL) |
| 92 | class WebGLProgram; |
| 93 | #endif |
| 94 | class WebKitNamedFlow; |
| 95 | class WorkerInspectorProxy; |
| 96 | |
| 97 | enum class StorageType; |
| 98 | |
| 99 | struct WebSocketFrame; |
| 100 | |
| 101 | #define FAST_RETURN_IF_NO_FRONTENDS(value) if (LIKELY(!InspectorInstrumentation::hasFrontends())) return value; |
| 102 | |
| 103 | class InspectorInstrumentation { |
| 104 | public: |
| 105 | static void didClearWindowObjectInWorld(Frame&, DOMWrapperWorld&); |
| 106 | static bool isDebuggerPaused(Frame*); |
| 107 | |
| 108 | static int identifierForNode(Node&); |
| 109 | static void addEventListenersToNode(Node&); |
| 110 | static void willInsertDOMNode(Document&, Node& parent); |
| 111 | static void didInsertDOMNode(Document&, Node&); |
| 112 | static void willRemoveDOMNode(Document&, Node&); |
| 113 | static void didRemoveDOMNode(Document&, Node&); |
| 114 | static void willModifyDOMAttr(Document&, Element&, const AtomicString& oldValue, const AtomicString& newValue); |
| 115 | static void didModifyDOMAttr(Document&, Element&, const AtomicString& name, const AtomicString& value); |
| 116 | static void didRemoveDOMAttr(Document&, Element&, const AtomicString& name); |
| 117 | static void characterDataModified(Document&, CharacterData&); |
| 118 | static void willInvalidateStyleAttr(Element&); |
| 119 | static void didInvalidateStyleAttr(Element&); |
| 120 | static void documentDetached(Document&); |
| 121 | static void frameWindowDiscarded(Frame&, DOMWindow*); |
| 122 | static void mediaQueryResultChanged(Document&); |
| 123 | static void activeStyleSheetsUpdated(Document&); |
| 124 | static void didPushShadowRoot(Element& host, ShadowRoot&); |
| 125 | static void willPopShadowRoot(Element& host, ShadowRoot&); |
| 126 | static void didChangeCustomElementState(Element&); |
| 127 | static void pseudoElementCreated(Page*, PseudoElement&); |
| 128 | static void pseudoElementDestroyed(Page*, PseudoElement&); |
| 129 | static void didCreateNamedFlow(Document*, WebKitNamedFlow&); |
| 130 | static void willRemoveNamedFlow(Document*, WebKitNamedFlow&); |
| 131 | static void didChangeRegionOverset(Document&, WebKitNamedFlow&); |
| 132 | static void didRegisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr); |
| 133 | static void didUnregisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement); |
| 134 | |
| 135 | static void mouseDidMoveOverElement(Page&, const HitTestResult&, unsigned modifierFlags); |
| 136 | static bool handleMousePress(Frame&); |
| 137 | static bool handleTouchEvent(Frame&, Node&); |
| 138 | static bool forcePseudoState(const Element&, CSSSelector::PseudoClassType); |
| 139 | |
| 140 | static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url); |
| 141 | static void willFetch(ScriptExecutionContext&, const String& url); |
| 142 | static void didInstallTimer(ScriptExecutionContext&, int timerId, Seconds timeout, bool singleShot); |
| 143 | static void didRemoveTimer(ScriptExecutionContext&, int timerId); |
| 144 | |
| 145 | static void didPostMessage(Frame&, TimerBase&, JSC::ExecState&); |
| 146 | static void didFailPostMessage(Frame&, TimerBase&); |
| 147 | static void willDispatchPostMessage(Frame&, TimerBase&); |
| 148 | static void didDispatchPostMessage(Frame&, TimerBase&); |
| 149 | |
| 150 | static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine, int scriptColumn); |
| 151 | static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*); |
| 152 | static void didAddEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture); |
| 153 | static void willRemoveEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture); |
| 154 | static bool isEventListenerDisabled(EventTarget&, const AtomicString& eventType, EventListener&, bool capture); |
| 155 | static InspectorInstrumentationCookie willDispatchEvent(Document&, const Event&, bool hasEventListeners); |
| 156 | static void didDispatchEvent(const InspectorInstrumentationCookie&, bool defaultPrevented); |
| 157 | static void willHandleEvent(ScriptExecutionContext&, Event&, const RegisteredEventListener&); |
| 158 | static void didHandleEvent(ScriptExecutionContext&); |
| 159 | static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event&, DOMWindow&); |
| 160 | static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&, bool defaultPrevented); |
| 161 | static void eventDidResetAfterDispatch(const Event&); |
| 162 | static InspectorInstrumentationCookie willEvaluateScript(Frame&, const String& url, int lineNumber, int columnNumber); |
| 163 | static void didEvaluateScript(const InspectorInstrumentationCookie&, Frame&); |
| 164 | static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext&, int timerId, bool oneShot); |
| 165 | static void didFireTimer(const InspectorInstrumentationCookie&); |
| 166 | static void didInvalidateLayout(Frame&); |
| 167 | static InspectorInstrumentationCookie willLayout(Frame&); |
| 168 | static void didLayout(const InspectorInstrumentationCookie&, RenderObject&); |
| 169 | static void didScroll(Page&); |
| 170 | static void willComposite(Frame&); |
| 171 | static void didComposite(Frame&); |
| 172 | static void willPaint(RenderObject&); |
| 173 | static void didPaint(RenderObject&, const LayoutRect&); |
| 174 | static InspectorInstrumentationCookie willRecalculateStyle(Document&); |
| 175 | static void didRecalculateStyle(const InspectorInstrumentationCookie&); |
| 176 | static void didScheduleStyleRecalculation(Document&); |
| 177 | static void applyUserAgentOverride(Frame&, String&); |
| 178 | static void applyEmulatedMedia(Frame&, String&); |
| 179 | |
| 180 | static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse); |
| 181 | static void didLoadResourceFromMemoryCache(Page&, DocumentLoader*, CachedResource*); |
| 182 | static void didReceiveResourceResponse(Frame&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); |
| 183 | static void didReceiveThreadableLoaderResponse(DocumentThreadableLoader&, unsigned long identifier); |
| 184 | static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength); |
| 185 | static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, const NetworkLoadMetrics&, ResourceLoader*); |
| 186 | static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&); |
| 187 | |
| 188 | static void willSendRequest(WorkerGlobalScope&, unsigned long identifier, ResourceRequest&); |
| 189 | static void didReceiveResourceResponse(WorkerGlobalScope&, unsigned long identifier, const ResourceResponse&); |
| 190 | static void didReceiveData(WorkerGlobalScope&, unsigned long identifier, const char* data, int dataLength); |
| 191 | static void didFinishLoading(WorkerGlobalScope&, unsigned long identifier, const NetworkLoadMetrics&); |
| 192 | static void didFailLoading(WorkerGlobalScope&, unsigned long identifier, const ResourceError&); |
| 193 | |
| 194 | // Some network requests do not go through the normal network loading path. |
| 195 | // These network requests have to issue their own willSendRequest / didReceiveResponse / didFinishLoading / didFailLoading |
| 196 | // instrumentation calls. Some of these loads are for resources that lack a CachedResource::Type. |
| 197 | enum class LoadType { Ping, Beacon }; |
| 198 | static void willSendRequestOfType(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, LoadType); |
| 199 | |
| 200 | static void continueAfterXFrameOptionsDenied(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&); |
| 201 | static void continueWithPolicyDownload(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&); |
| 202 | static void continueWithPolicyIgnore(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&); |
| 203 | static void willLoadXHRSynchronously(ScriptExecutionContext*); |
| 204 | static void didLoadXHRSynchronously(ScriptExecutionContext*); |
| 205 | static void scriptImported(ScriptExecutionContext&, unsigned long identifier, const String& sourceString); |
| 206 | static void scriptExecutionBlockedByCSP(ScriptExecutionContext*, const String& directiveText); |
| 207 | static void didReceiveScriptResponse(ScriptExecutionContext*, unsigned long identifier); |
| 208 | static void domContentLoadedEventFired(Frame&); |
| 209 | static void loadEventFired(Frame*); |
| 210 | static void frameDetachedFromParent(Frame&); |
| 211 | static void didCommitLoad(Frame&, DocumentLoader*); |
| 212 | static void frameDocumentUpdated(Frame&); |
| 213 | static void loaderDetachedFromFrame(Frame&, DocumentLoader&); |
| 214 | static void frameStartedLoading(Frame&); |
| 215 | static void frameStoppedLoading(Frame&); |
| 216 | static void frameScheduledNavigation(Frame&, Seconds delay); |
| 217 | static void frameClearedScheduledNavigation(Frame&); |
| 218 | static void defaultAppearanceDidChange(Page&, bool useDarkAppearance); |
| 219 | static void willDestroyCachedResource(CachedResource&); |
| 220 | |
| 221 | static void addMessageToConsole(Page&, std::unique_ptr<Inspector::ConsoleMessage>); |
| 222 | static void addMessageToConsole(WorkerGlobalScope&, std::unique_ptr<Inspector::ConsoleMessage>); |
| 223 | |
| 224 | static void consoleCount(Page&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); |
| 225 | static void consoleCount(WorkerGlobalScope&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); |
| 226 | static void takeHeapSnapshot(Frame&, const String& title); |
| 227 | static void startConsoleTiming(Frame&, const String& title); |
| 228 | static void startConsoleTiming(WorkerGlobalScope&, const String& title); |
| 229 | static void stopConsoleTiming(Frame&, const String& title, Ref<Inspector::ScriptCallStack>&&); |
| 230 | static void stopConsoleTiming(WorkerGlobalScope&, const String& title, Ref<Inspector::ScriptCallStack>&&); |
| 231 | static void consoleTimeStamp(Frame&, Ref<Inspector::ScriptArguments>&&); |
| 232 | static void startProfiling(Page&, JSC::ExecState*, const String& title); |
| 233 | static void stopProfiling(Page&, JSC::ExecState*, const String& title); |
| 234 | static void consoleStartRecordingCanvas(CanvasRenderingContext&, JSC::ExecState&, JSC::JSObject* options); |
| 235 | |
| 236 | static void didRequestAnimationFrame(Document&, int callbackId); |
| 237 | static void didCancelAnimationFrame(Document&, int callbackId); |
| 238 | static InspectorInstrumentationCookie willFireAnimationFrame(Document&, int callbackId); |
| 239 | static void didFireAnimationFrame(const InspectorInstrumentationCookie&); |
| 240 | |
| 241 | static InspectorInstrumentationCookie willFireObserverCallback(ScriptExecutionContext&, const String& callbackType); |
| 242 | static void didFireObserverCallback(const InspectorInstrumentationCookie&); |
| 243 | |
| 244 | static void didOpenDatabase(Database&); |
| 245 | |
| 246 | static void didDispatchDOMStorageEvent(Page&, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*); |
| 247 | |
| 248 | static bool shouldWaitForDebuggerOnStart(ScriptExecutionContext&); |
| 249 | static void workerStarted(ScriptExecutionContext&, WorkerInspectorProxy*, const URL&); |
| 250 | static void workerTerminated(ScriptExecutionContext&, WorkerInspectorProxy*); |
| 251 | |
| 252 | static void didCreateWebSocket(Document*, unsigned long identifier, const URL& requestURL); |
| 253 | static void willSendWebSocketHandshakeRequest(Document*, unsigned long identifier, const ResourceRequest&); |
| 254 | static void didReceiveWebSocketHandshakeResponse(Document*, unsigned long identifier, const ResourceResponse&); |
| 255 | static void didCloseWebSocket(Document*, unsigned long identifier); |
| 256 | static void didReceiveWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&); |
| 257 | static void didSendWebSocketFrame(Document*, unsigned long identifier, const WebSocketFrame&); |
| 258 | static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage); |
| 259 | |
| 260 | #if ENABLE(RESOURCE_USAGE) |
| 261 | static void didHandleMemoryPressure(Page&, Critical); |
| 262 | #endif |
| 263 | |
| 264 | static void didChangeCSSCanvasClientNodes(CanvasBase&); |
| 265 | static void didCreateCanvasRenderingContext(CanvasRenderingContext&); |
| 266 | static void didChangeCanvasMemory(CanvasRenderingContext&); |
| 267 | static void recordCanvasAction(CanvasRenderingContext&, const String&, Vector<RecordCanvasActionVariant>&& = { }); |
| 268 | static void didFinishRecordingCanvasFrame(CanvasRenderingContext&, bool forceDispatch = false); |
| 269 | #if ENABLE(WEBGL) |
| 270 | static void didEnableExtension(WebGLRenderingContextBase&, const String&); |
| 271 | static void didCreateProgram(WebGLRenderingContextBase&, WebGLProgram&); |
| 272 | static void willDeleteProgram(WebGLRenderingContextBase&, WebGLProgram&); |
| 273 | static bool isShaderProgramDisabled(WebGLRenderingContextBase&, WebGLProgram&); |
| 274 | static bool isShaderProgramHighlighted(WebGLRenderingContextBase&, WebGLProgram&); |
| 275 | #endif |
| 276 | |
| 277 | static void networkStateChanged(Page&); |
| 278 | static void updateApplicationCacheStatus(Frame*); |
| 279 | |
| 280 | static void layerTreeDidChange(Page*); |
| 281 | static void renderLayerDestroyed(Page*, const RenderLayer&); |
| 282 | |
| 283 | static void frontendCreated(); |
| 284 | static void frontendDeleted(); |
| 285 | static bool hasFrontends() { return s_frontendCounter; } |
| 286 | |
| 287 | static void firstFrontendCreated(); |
| 288 | static void lastFrontendDeleted(); |
| 289 | |
| 290 | static bool consoleAgentEnabled(ScriptExecutionContext*); |
| 291 | static bool timelineAgentEnabled(ScriptExecutionContext*); |
| 292 | |
| 293 | static InstrumentingAgents* instrumentingAgentsForPage(Page*); |
| 294 | |
| 295 | static void registerInstrumentingAgents(InstrumentingAgents&); |
| 296 | static void unregisterInstrumentingAgents(InstrumentingAgents&); |
| 297 | |
| 298 | private: |
| 299 | static void didClearWindowObjectInWorldImpl(InstrumentingAgents&, Frame&, DOMWrapperWorld&); |
| 300 | static bool isDebuggerPausedImpl(InstrumentingAgents&); |
| 301 | |
| 302 | static int identifierForNodeImpl(InstrumentingAgents&, Node&); |
| 303 | static void addEventListenersToNodeImpl(InstrumentingAgents&, Node&); |
| 304 | static void willInsertDOMNodeImpl(InstrumentingAgents&, Node& parent); |
| 305 | static void didInsertDOMNodeImpl(InstrumentingAgents&, Node&); |
| 306 | static void willRemoveDOMNodeImpl(InstrumentingAgents&, Node&); |
| 307 | static void didRemoveDOMNodeImpl(InstrumentingAgents&, Node&); |
| 308 | static void willModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& oldValue, const AtomicString& newValue); |
| 309 | static void didModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& name, const AtomicString& value); |
| 310 | static void didRemoveDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& name); |
| 311 | static void characterDataModifiedImpl(InstrumentingAgents&, CharacterData&); |
| 312 | static void willInvalidateStyleAttrImpl(InstrumentingAgents&, Element&); |
| 313 | static void didInvalidateStyleAttrImpl(InstrumentingAgents&, Element&); |
| 314 | static void documentDetachedImpl(InstrumentingAgents&, Document&); |
| 315 | static void frameWindowDiscardedImpl(InstrumentingAgents&, DOMWindow*); |
| 316 | static void mediaQueryResultChangedImpl(InstrumentingAgents&); |
| 317 | static void activeStyleSheetsUpdatedImpl(InstrumentingAgents&, Document&); |
| 318 | static void didPushShadowRootImpl(InstrumentingAgents&, Element& host, ShadowRoot&); |
| 319 | static void willPopShadowRootImpl(InstrumentingAgents&, Element& host, ShadowRoot&); |
| 320 | static void didChangeCustomElementStateImpl(InstrumentingAgents&, Element&); |
| 321 | static void pseudoElementCreatedImpl(InstrumentingAgents&, PseudoElement&); |
| 322 | static void pseudoElementDestroyedImpl(InstrumentingAgents&, PseudoElement&); |
| 323 | static void didCreateNamedFlowImpl(InstrumentingAgents&, Document*, WebKitNamedFlow&); |
| 324 | static void willRemoveNamedFlowImpl(InstrumentingAgents&, Document*, WebKitNamedFlow&); |
| 325 | static void didChangeRegionOversetImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&); |
| 326 | static void didRegisterNamedFlowContentElementImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr); |
| 327 | static void didUnregisterNamedFlowContentElementImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&, Node& contentElement); |
| 328 | |
| 329 | static void mouseDidMoveOverElementImpl(InstrumentingAgents&, const HitTestResult&, unsigned modifierFlags); |
| 330 | static bool handleMousePressImpl(InstrumentingAgents&); |
| 331 | static bool handleTouchEventImpl(InstrumentingAgents&, Node&); |
| 332 | static bool forcePseudoStateImpl(InstrumentingAgents&, const Element&, CSSSelector::PseudoClassType); |
| 333 | |
| 334 | static void willSendXMLHttpRequestImpl(InstrumentingAgents&, const String& url); |
| 335 | static void willFetchImpl(InstrumentingAgents&, const String& url); |
| 336 | static void didInstallTimerImpl(InstrumentingAgents&, int timerId, Seconds timeout, bool singleShot, ScriptExecutionContext&); |
| 337 | static void didRemoveTimerImpl(InstrumentingAgents&, int timerId, ScriptExecutionContext&); |
| 338 | |
| 339 | static void didPostMessageImpl(InstrumentingAgents&, const TimerBase&, JSC::ExecState&); |
| 340 | static void didFailPostMessageImpl(InstrumentingAgents&, const TimerBase&); |
| 341 | static void willDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&); |
| 342 | static void didDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&); |
| 343 | |
| 344 | static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext*); |
| 345 | static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*); |
| 346 | static void didAddEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture); |
| 347 | static void willRemoveEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture); |
| 348 | static bool isEventListenerDisabledImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture); |
| 349 | static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents&, Document&, const Event&, bool hasEventListeners); |
| 350 | static void willHandleEventImpl(InstrumentingAgents&, Event&, const RegisteredEventListener&); |
| 351 | static void didHandleEventImpl(InstrumentingAgents&); |
| 352 | static void didDispatchEventImpl(const InspectorInstrumentationCookie&, bool defaultPrevented); |
| 353 | static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents&, const Event&, DOMWindow&); |
| 354 | static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&, bool defaultPrevented); |
| 355 | static void eventDidResetAfterDispatchImpl(InstrumentingAgents&, const Event&); |
| 356 | static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber, int columnNumber); |
| 357 | static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&, Frame&); |
| 358 | static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents&, int timerId, bool oneShot, ScriptExecutionContext&); |
| 359 | static void didFireTimerImpl(const InspectorInstrumentationCookie&); |
| 360 | static void didInvalidateLayoutImpl(InstrumentingAgents&, Frame&); |
| 361 | static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents&, Frame&); |
| 362 | static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject&); |
| 363 | static void didScrollImpl(InstrumentingAgents&); |
| 364 | static void willCompositeImpl(InstrumentingAgents&, Frame&); |
| 365 | static void didCompositeImpl(InstrumentingAgents&); |
| 366 | static void willPaintImpl(InstrumentingAgents&, RenderObject&); |
| 367 | static void didPaintImpl(InstrumentingAgents&, RenderObject&, const LayoutRect&); |
| 368 | static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents&, Document&); |
| 369 | static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&); |
| 370 | static void didScheduleStyleRecalculationImpl(InstrumentingAgents&, Document&); |
| 371 | static void applyUserAgentOverrideImpl(InstrumentingAgents&, String&); |
| 372 | static void applyEmulatedMediaImpl(InstrumentingAgents&, String&); |
| 373 | |
| 374 | static void willSendRequestImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse); |
| 375 | static void willSendRequestOfTypeImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, ResourceRequest&, LoadType); |
| 376 | static void markResourceAsCachedImpl(InstrumentingAgents&, unsigned long identifier); |
| 377 | static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents&, DocumentLoader*, CachedResource*); |
| 378 | static void didReceiveResourceResponseImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); |
| 379 | static void didReceiveThreadableLoaderResponseImpl(InstrumentingAgents&, DocumentThreadableLoader&, unsigned long identifier); |
| 380 | static void didReceiveDataImpl(InstrumentingAgents&, unsigned long identifier, const char* data, int dataLength, int encodedDataLength); |
| 381 | static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const NetworkLoadMetrics&, ResourceLoader*); |
| 382 | static void didFailLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceError&); |
| 383 | static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&); |
| 384 | static void didLoadXHRSynchronouslyImpl(InstrumentingAgents&); |
| 385 | static void scriptImportedImpl(InstrumentingAgents&, unsigned long identifier, const String& sourceString); |
| 386 | static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents&, const String& directiveText); |
| 387 | static void didReceiveScriptResponseImpl(InstrumentingAgents&, unsigned long identifier); |
| 388 | static void domContentLoadedEventFiredImpl(InstrumentingAgents&, Frame&); |
| 389 | static void loadEventFiredImpl(InstrumentingAgents&, Frame*); |
| 390 | static void frameDetachedFromParentImpl(InstrumentingAgents&, Frame&); |
| 391 | static void didCommitLoadImpl(InstrumentingAgents&, Frame&, DocumentLoader*); |
| 392 | static void frameDocumentUpdatedImpl(InstrumentingAgents&, Frame&); |
| 393 | static void loaderDetachedFromFrameImpl(InstrumentingAgents&, DocumentLoader&); |
| 394 | static void frameStartedLoadingImpl(InstrumentingAgents&, Frame&); |
| 395 | static void frameStoppedLoadingImpl(InstrumentingAgents&, Frame&); |
| 396 | static void frameScheduledNavigationImpl(InstrumentingAgents&, Frame&, Seconds delay); |
| 397 | static void frameClearedScheduledNavigationImpl(InstrumentingAgents&, Frame&); |
| 398 | static void defaultAppearanceDidChangeImpl(InstrumentingAgents&, bool useDarkAppearance); |
| 399 | static void willDestroyCachedResourceImpl(CachedResource&); |
| 400 | |
| 401 | static void addMessageToConsoleImpl(InstrumentingAgents&, std::unique_ptr<Inspector::ConsoleMessage>); |
| 402 | |
| 403 | static void consoleCountImpl(InstrumentingAgents&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); |
| 404 | static void takeHeapSnapshotImpl(InstrumentingAgents&, const String& title); |
| 405 | static void startConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title); |
| 406 | static void startConsoleTimingImpl(InstrumentingAgents&, const String& title); |
| 407 | static void stopConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title, Ref<Inspector::ScriptCallStack>&&); |
| 408 | static void stopConsoleTimingImpl(InstrumentingAgents&, const String& title, Ref<Inspector::ScriptCallStack>&&); |
| 409 | static void consoleTimeStampImpl(InstrumentingAgents&, Frame&, Ref<Inspector::ScriptArguments>&&); |
| 410 | static void startProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title); |
| 411 | static void stopProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title); |
| 412 | static void consoleStartRecordingCanvasImpl(InstrumentingAgents&, CanvasRenderingContext&, JSC::ExecState&, JSC::JSObject* options); |
| 413 | |
| 414 | static void didRequestAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&); |
| 415 | static void didCancelAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&); |
| 416 | static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents&, int callbackId, Document&); |
| 417 | static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&); |
| 418 | |
| 419 | static InspectorInstrumentationCookie willFireObserverCallbackImpl(InstrumentingAgents&, const String&, ScriptExecutionContext&); |
| 420 | static void didFireObserverCallbackImpl(const InspectorInstrumentationCookie&); |
| 421 | |
| 422 | static void didOpenDatabaseImpl(InstrumentingAgents&, Database&); |
| 423 | |
| 424 | static void didDispatchDOMStorageEventImpl(InstrumentingAgents&, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*); |
| 425 | |
| 426 | static bool shouldWaitForDebuggerOnStartImpl(InstrumentingAgents&); |
| 427 | static void workerStartedImpl(InstrumentingAgents&, WorkerInspectorProxy*, const URL&); |
| 428 | static void workerTerminatedImpl(InstrumentingAgents&, WorkerInspectorProxy*); |
| 429 | |
| 430 | static void didCreateWebSocketImpl(InstrumentingAgents&, unsigned long identifier, const URL& requestURL); |
| 431 | static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents&, unsigned long identifier, const ResourceRequest&); |
| 432 | static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents&, unsigned long identifier, const ResourceResponse&); |
| 433 | static void didCloseWebSocketImpl(InstrumentingAgents&, unsigned long identifier); |
| 434 | static void didReceiveWebSocketFrameImpl(InstrumentingAgents&, unsigned long identifier, const WebSocketFrame&); |
| 435 | static void didSendWebSocketFrameImpl(InstrumentingAgents&, unsigned long identifier, const WebSocketFrame&); |
| 436 | static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents&, unsigned long identifier, const String&); |
| 437 | |
| 438 | #if ENABLE(RESOURCE_USAGE) |
| 439 | static void didHandleMemoryPressureImpl(InstrumentingAgents&, Critical); |
| 440 | #endif |
| 441 | |
| 442 | static void networkStateChangedImpl(InstrumentingAgents&); |
| 443 | static void updateApplicationCacheStatusImpl(InstrumentingAgents&, Frame&); |
| 444 | |
| 445 | static void didChangeCSSCanvasClientNodesImpl(InstrumentingAgents&, CanvasBase&); |
| 446 | static void didCreateCanvasRenderingContextImpl(InstrumentingAgents&, CanvasRenderingContext&); |
| 447 | static void didChangeCanvasMemoryImpl(InstrumentingAgents&, CanvasRenderingContext&); |
| 448 | static void recordCanvasActionImpl(InstrumentingAgents&, CanvasRenderingContext&, const String&, Vector<RecordCanvasActionVariant>&& = { }); |
| 449 | static void didFinishRecordingCanvasFrameImpl(InstrumentingAgents&, CanvasRenderingContext&, bool forceDispatch = false); |
| 450 | #if ENABLE(WEBGL) |
| 451 | static void didEnableExtensionImpl(InstrumentingAgents&, WebGLRenderingContextBase&, const String&); |
| 452 | static void didCreateProgramImpl(InstrumentingAgents&, WebGLRenderingContextBase&, WebGLProgram&); |
| 453 | static void willDeleteProgramImpl(InstrumentingAgents&, WebGLProgram&); |
| 454 | static bool isShaderProgramDisabledImpl(InstrumentingAgents&, WebGLProgram&); |
| 455 | static bool isShaderProgramHighlightedImpl(InstrumentingAgents&, WebGLProgram&); |
| 456 | #endif |
| 457 | |
| 458 | static void layerTreeDidChangeImpl(InstrumentingAgents&); |
| 459 | static void renderLayerDestroyedImpl(InstrumentingAgents&, const RenderLayer&); |
| 460 | |
| 461 | static InstrumentingAgents& instrumentingAgentsForPage(Page&); |
| 462 | static InstrumentingAgents& instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope&); |
| 463 | |
| 464 | static InstrumentingAgents* instrumentingAgentsForFrame(Frame&); |
| 465 | static InstrumentingAgents* instrumentingAgentsForFrame(Frame*); |
| 466 | static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*); |
| 467 | static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext&); |
| 468 | static InstrumentingAgents* instrumentingAgentsForDocument(Document&); |
| 469 | static InstrumentingAgents* instrumentingAgentsForDocument(Document*); |
| 470 | static InstrumentingAgents* instrumentingAgentsForRenderer(RenderObject&); |
| 471 | static InstrumentingAgents* instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope*); |
| 472 | |
| 473 | static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&); |
| 474 | |
| 475 | WEBCORE_EXPORT static int s_frontendCounter; |
| 476 | }; |
| 477 | |
| 478 | inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame& frame, DOMWrapperWorld& world) |
| 479 | { |
| 480 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 481 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 482 | didClearWindowObjectInWorldImpl(*instrumentingAgents, frame, world); |
| 483 | } |
| 484 | |
| 485 | inline bool InspectorInstrumentation::isDebuggerPaused(Frame* frame) |
| 486 | { |
| 487 | FAST_RETURN_IF_NO_FRONTENDS(false); |
| 488 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 489 | return isDebuggerPausedImpl(*instrumentingAgents); |
| 490 | return false; |
| 491 | } |
| 492 | |
| 493 | inline int InspectorInstrumentation::identifierForNode(Node& node) |
| 494 | { |
| 495 | FAST_RETURN_IF_NO_FRONTENDS(0); |
| 496 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(node.document())) |
| 497 | return identifierForNodeImpl(*instrumentingAgents, node); |
| 498 | return 0; |
| 499 | } |
| 500 | |
| 501 | inline void InspectorInstrumentation::addEventListenersToNode(Node& node) |
| 502 | { |
| 503 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 504 | if (auto* instrumentingAgents = instrumentingAgentsForDocument(node.document())) |
| 505 | addEventListenersToNodeImpl(*instrumentingAgents, node); |
| 506 | } |
| 507 | |
| 508 | inline void InspectorInstrumentation::willInsertDOMNode(Document& document, Node& parent) |
| 509 | { |
| 510 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 511 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 512 | willInsertDOMNodeImpl(*instrumentingAgents, parent); |
| 513 | } |
| 514 | |
| 515 | inline void InspectorInstrumentation::didInsertDOMNode(Document& document, Node& node) |
| 516 | { |
| 517 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 518 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 519 | didInsertDOMNodeImpl(*instrumentingAgents, node); |
| 520 | } |
| 521 | |
| 522 | inline void InspectorInstrumentation::willRemoveDOMNode(Document& document, Node& node) |
| 523 | { |
| 524 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 525 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 526 | willRemoveDOMNodeImpl(*instrumentingAgents, node); |
| 527 | } |
| 528 | |
| 529 | inline void InspectorInstrumentation::didRemoveDOMNode(Document& document, Node& node) |
| 530 | { |
| 531 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 532 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 533 | didRemoveDOMNodeImpl(*instrumentingAgents, node); |
| 534 | } |
| 535 | |
| 536 | inline void InspectorInstrumentation::willModifyDOMAttr(Document& document, Element& element, const AtomicString& oldValue, const AtomicString& newValue) |
| 537 | { |
| 538 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 539 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 540 | willModifyDOMAttrImpl(*instrumentingAgents, element, oldValue, newValue); |
| 541 | } |
| 542 | |
| 543 | inline void InspectorInstrumentation::didModifyDOMAttr(Document& document, Element& element, const AtomicString& name, const AtomicString& value) |
| 544 | { |
| 545 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 546 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 547 | didModifyDOMAttrImpl(*instrumentingAgents, element, name, value); |
| 548 | } |
| 549 | |
| 550 | inline void InspectorInstrumentation::didRemoveDOMAttr(Document& document, Element& element, const AtomicString& name) |
| 551 | { |
| 552 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 553 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 554 | didRemoveDOMAttrImpl(*instrumentingAgents, element, name); |
| 555 | } |
| 556 | |
| 557 | inline void InspectorInstrumentation::willInvalidateStyleAttr(Element& element) |
| 558 | { |
| 559 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 560 | if (auto* instrumentingAgents = instrumentingAgentsForDocument(element.document())) |
| 561 | willInvalidateStyleAttrImpl(*instrumentingAgents, element); |
| 562 | } |
| 563 | |
| 564 | inline void InspectorInstrumentation::didInvalidateStyleAttr(Element& element) |
| 565 | { |
| 566 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 567 | if (auto* instrumentingAgents = instrumentingAgentsForDocument(element.document())) |
| 568 | didInvalidateStyleAttrImpl(*instrumentingAgents, element); |
| 569 | } |
| 570 | |
| 571 | inline void InspectorInstrumentation::documentDetached(Document& document) |
| 572 | { |
| 573 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 574 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 575 | documentDetachedImpl(*instrumentingAgents, document); |
| 576 | } |
| 577 | |
| 578 | inline void InspectorInstrumentation::frameWindowDiscarded(Frame& frame, DOMWindow* domWindow) |
| 579 | { |
| 580 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 581 | frameWindowDiscardedImpl(*instrumentingAgents, domWindow); |
| 582 | } |
| 583 | |
| 584 | inline void InspectorInstrumentation::mediaQueryResultChanged(Document& document) |
| 585 | { |
| 586 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 587 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 588 | mediaQueryResultChangedImpl(*instrumentingAgents); |
| 589 | } |
| 590 | |
| 591 | inline void InspectorInstrumentation::activeStyleSheetsUpdated(Document& document) |
| 592 | { |
| 593 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 594 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 595 | activeStyleSheetsUpdatedImpl(*instrumentingAgents, document); |
| 596 | } |
| 597 | |
| 598 | inline void InspectorInstrumentation::didPushShadowRoot(Element& host, ShadowRoot& root) |
| 599 | { |
| 600 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 601 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host.document())) |
| 602 | didPushShadowRootImpl(*instrumentingAgents, host, root); |
| 603 | } |
| 604 | |
| 605 | inline void InspectorInstrumentation::willPopShadowRoot(Element& host, ShadowRoot& root) |
| 606 | { |
| 607 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 608 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host.document())) |
| 609 | willPopShadowRootImpl(*instrumentingAgents, host, root); |
| 610 | } |
| 611 | |
| 612 | inline void InspectorInstrumentation::didChangeCustomElementState(Element& element) |
| 613 | { |
| 614 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 615 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(element.document())) |
| 616 | didChangeCustomElementStateImpl(*instrumentingAgents, element); |
| 617 | } |
| 618 | |
| 619 | inline void InspectorInstrumentation::pseudoElementCreated(Page* page, PseudoElement& pseudoElement) |
| 620 | { |
| 621 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 622 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) |
| 623 | pseudoElementCreatedImpl(*instrumentingAgents, pseudoElement); |
| 624 | } |
| 625 | |
| 626 | inline void InspectorInstrumentation::pseudoElementDestroyed(Page* page, PseudoElement& pseudoElement) |
| 627 | { |
| 628 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 629 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) |
| 630 | pseudoElementDestroyedImpl(*instrumentingAgents, pseudoElement); |
| 631 | } |
| 632 | |
| 633 | inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow& namedFlow) |
| 634 | { |
| 635 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 636 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 637 | didCreateNamedFlowImpl(*instrumentingAgents, document, namedFlow); |
| 638 | } |
| 639 | |
| 640 | inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow& namedFlow) |
| 641 | { |
| 642 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 643 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 644 | willRemoveNamedFlowImpl(*instrumentingAgents, document, namedFlow); |
| 645 | } |
| 646 | |
| 647 | inline void InspectorInstrumentation::didChangeRegionOverset(Document& document, WebKitNamedFlow& namedFlow) |
| 648 | { |
| 649 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 650 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 651 | didChangeRegionOversetImpl(*instrumentingAgents, document, namedFlow); |
| 652 | } |
| 653 | |
| 654 | inline void InspectorInstrumentation::didRegisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement, Node* nextContentElement) |
| 655 | { |
| 656 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 657 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 658 | didRegisterNamedFlowContentElementImpl(*instrumentingAgents, document, namedFlow, contentElement, nextContentElement); |
| 659 | } |
| 660 | |
| 661 | inline void InspectorInstrumentation::didUnregisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement) |
| 662 | { |
| 663 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 664 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 665 | didUnregisterNamedFlowContentElementImpl(*instrumentingAgents, document, namedFlow, contentElement); |
| 666 | } |
| 667 | |
| 668 | inline void InspectorInstrumentation::mouseDidMoveOverElement(Page& page, const HitTestResult& result, unsigned modifierFlags) |
| 669 | { |
| 670 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 671 | mouseDidMoveOverElementImpl(instrumentingAgentsForPage(page), result, modifierFlags); |
| 672 | } |
| 673 | |
| 674 | inline bool InspectorInstrumentation::handleTouchEvent(Frame& frame, Node& node) |
| 675 | { |
| 676 | FAST_RETURN_IF_NO_FRONTENDS(false); |
| 677 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 678 | return handleTouchEventImpl(*instrumentingAgents, node); |
| 679 | return false; |
| 680 | } |
| 681 | |
| 682 | inline bool InspectorInstrumentation::handleMousePress(Frame& frame) |
| 683 | { |
| 684 | FAST_RETURN_IF_NO_FRONTENDS(false); |
| 685 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 686 | return handleMousePressImpl(*instrumentingAgents); |
| 687 | return false; |
| 688 | } |
| 689 | |
| 690 | inline bool InspectorInstrumentation::forcePseudoState(const Element& element, CSSSelector::PseudoClassType pseudoState) |
| 691 | { |
| 692 | FAST_RETURN_IF_NO_FRONTENDS(false); |
| 693 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(element.document())) |
| 694 | return forcePseudoStateImpl(*instrumentingAgents, element, pseudoState); |
| 695 | return false; |
| 696 | } |
| 697 | |
| 698 | inline void InspectorInstrumentation::characterDataModified(Document& document, CharacterData& characterData) |
| 699 | { |
| 700 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 701 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 702 | characterDataModifiedImpl(*instrumentingAgents, characterData); |
| 703 | } |
| 704 | |
| 705 | inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url) |
| 706 | { |
| 707 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 708 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 709 | willSendXMLHttpRequestImpl(*instrumentingAgents, url); |
| 710 | } |
| 711 | |
| 712 | inline void InspectorInstrumentation::willFetch(ScriptExecutionContext& context, const String& url) |
| 713 | { |
| 714 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 715 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 716 | willFetchImpl(*instrumentingAgents, url); |
| 717 | } |
| 718 | |
| 719 | inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext& context, int timerId, Seconds timeout, bool singleShot) |
| 720 | { |
| 721 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 722 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 723 | didInstallTimerImpl(*instrumentingAgents, timerId, timeout, singleShot, context); |
| 724 | } |
| 725 | |
| 726 | inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext& context, int timerId) |
| 727 | { |
| 728 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 729 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 730 | didRemoveTimerImpl(*instrumentingAgents, timerId, context); |
| 731 | } |
| 732 | |
| 733 | inline void InspectorInstrumentation::didAddEventListener(EventTarget& target, const AtomicString& eventType, EventListener& listener, bool capture) |
| 734 | { |
| 735 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 736 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(target.scriptExecutionContext())) |
| 737 | didAddEventListenerImpl(*instrumentingAgents, target, eventType, listener, capture); |
| 738 | } |
| 739 | |
| 740 | inline void InspectorInstrumentation::willRemoveEventListener(EventTarget& target, const AtomicString& eventType, EventListener& listener, bool capture) |
| 741 | { |
| 742 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 743 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(target.scriptExecutionContext())) |
| 744 | willRemoveEventListenerImpl(*instrumentingAgents, target, eventType, listener, capture); |
| 745 | } |
| 746 | |
| 747 | inline bool InspectorInstrumentation::isEventListenerDisabled(EventTarget& target, const AtomicString& eventType, EventListener& listener, bool capture) |
| 748 | { |
| 749 | FAST_RETURN_IF_NO_FRONTENDS(false); |
| 750 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(target.scriptExecutionContext())) |
| 751 | return isEventListenerDisabledImpl(*instrumentingAgents, target, eventType, listener, capture); |
| 752 | return false; |
| 753 | } |
| 754 | |
| 755 | inline void InspectorInstrumentation::didPostMessage(Frame& frame, TimerBase& timer, JSC::ExecState& state) |
| 756 | { |
| 757 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 758 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 759 | didPostMessageImpl(*instrumentingAgents, timer, state); |
| 760 | } |
| 761 | |
| 762 | inline void InspectorInstrumentation::didFailPostMessage(Frame& frame, TimerBase& timer) |
| 763 | { |
| 764 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 765 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 766 | didFailPostMessageImpl(*instrumentingAgents, timer); |
| 767 | } |
| 768 | |
| 769 | inline void InspectorInstrumentation::willDispatchPostMessage(Frame& frame, TimerBase& timer) |
| 770 | { |
| 771 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 772 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 773 | willDispatchPostMessageImpl(*instrumentingAgents, timer); |
| 774 | } |
| 775 | |
| 776 | inline void InspectorInstrumentation::didDispatchPostMessage(Frame& frame, TimerBase& timer) |
| 777 | { |
| 778 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 779 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 780 | didDispatchPostMessageImpl(*instrumentingAgents, timer); |
| 781 | } |
| 782 | |
| 783 | inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine, int scriptColumn) |
| 784 | { |
| 785 | FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); |
| 786 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 787 | return willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, scriptColumn, context); |
| 788 | return InspectorInstrumentationCookie(); |
| 789 | } |
| 790 | |
| 791 | inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie, ScriptExecutionContext* context) |
| 792 | { |
| 793 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 794 | if (cookie.isValid()) |
| 795 | didCallFunctionImpl(cookie, context); |
| 796 | } |
| 797 | |
| 798 | inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document& document, const Event& event, bool hasEventListeners) |
| 799 | { |
| 800 | FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); |
| 801 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 802 | return willDispatchEventImpl(*instrumentingAgents, document, event, hasEventListeners); |
| 803 | return InspectorInstrumentationCookie(); |
| 804 | } |
| 805 | |
| 806 | inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrumentationCookie& cookie, bool defaultPrevented) |
| 807 | { |
| 808 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 809 | if (cookie.isValid()) |
| 810 | didDispatchEventImpl(cookie, defaultPrevented); |
| 811 | } |
| 812 | |
| 813 | inline void InspectorInstrumentation::willHandleEvent(ScriptExecutionContext& context, Event& event, const RegisteredEventListener& listener) |
| 814 | { |
| 815 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 816 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 817 | return willHandleEventImpl(*instrumentingAgents, event, listener); |
| 818 | } |
| 819 | |
| 820 | inline void InspectorInstrumentation::didHandleEvent(ScriptExecutionContext& context) |
| 821 | { |
| 822 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 823 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 824 | return didHandleEventImpl(*instrumentingAgents); |
| 825 | } |
| 826 | |
| 827 | inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow& window) |
| 828 | { |
| 829 | FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); |
| 830 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 831 | return willDispatchEventOnWindowImpl(*instrumentingAgents, event, window); |
| 832 | return InspectorInstrumentationCookie(); |
| 833 | } |
| 834 | |
| 835 | inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorInstrumentationCookie& cookie, bool defaultPrevented) |
| 836 | { |
| 837 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 838 | if (cookie.isValid()) |
| 839 | didDispatchEventOnWindowImpl(cookie, defaultPrevented); |
| 840 | } |
| 841 | |
| 842 | inline void InspectorInstrumentation::eventDidResetAfterDispatch(const Event& event) |
| 843 | { |
| 844 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 845 | |
| 846 | if (!is<Node>(event.target())) |
| 847 | return; |
| 848 | |
| 849 | auto* node = downcast<Node>(event.target()); |
| 850 | if (auto* instrumentingAgents = instrumentingAgentsForContext(node->scriptExecutionContext())) |
| 851 | return eventDidResetAfterDispatchImpl(*instrumentingAgents, event); |
| 852 | } |
| 853 | |
| 854 | inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber, int columnNumber) |
| 855 | { |
| 856 | FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); |
| 857 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 858 | return willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber, columnNumber); |
| 859 | return InspectorInstrumentationCookie(); |
| 860 | } |
| 861 | |
| 862 | inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie, Frame& frame) |
| 863 | { |
| 864 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 865 | if (cookie.isValid()) |
| 866 | didEvaluateScriptImpl(cookie, frame); |
| 867 | } |
| 868 | |
| 869 | inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext& context, int timerId, bool oneShot) |
| 870 | { |
| 871 | FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); |
| 872 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 873 | return willFireTimerImpl(*instrumentingAgents, timerId, oneShot, context); |
| 874 | return InspectorInstrumentationCookie(); |
| 875 | } |
| 876 | |
| 877 | inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentationCookie& cookie) |
| 878 | { |
| 879 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 880 | if (cookie.isValid()) |
| 881 | didFireTimerImpl(cookie); |
| 882 | } |
| 883 | |
| 884 | inline void InspectorInstrumentation::didInvalidateLayout(Frame& frame) |
| 885 | { |
| 886 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 887 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 888 | didInvalidateLayoutImpl(*instrumentingAgents, frame); |
| 889 | } |
| 890 | |
| 891 | inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame& frame) |
| 892 | { |
| 893 | FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); |
| 894 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 895 | return willLayoutImpl(*instrumentingAgents, frame); |
| 896 | return InspectorInstrumentationCookie(); |
| 897 | } |
| 898 | |
| 899 | inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie, RenderObject& root) |
| 900 | { |
| 901 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 902 | if (cookie.isValid()) |
| 903 | didLayoutImpl(cookie, root); |
| 904 | } |
| 905 | |
| 906 | inline void InspectorInstrumentation::didScroll(Page& page) |
| 907 | { |
| 908 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 909 | didScrollImpl(instrumentingAgentsForPage(page)); |
| 910 | } |
| 911 | |
| 912 | inline void InspectorInstrumentation::willComposite(Frame& frame) |
| 913 | { |
| 914 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 915 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 916 | willCompositeImpl(*instrumentingAgents, frame); |
| 917 | } |
| 918 | |
| 919 | inline void InspectorInstrumentation::didComposite(Frame& frame) |
| 920 | { |
| 921 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 922 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 923 | didCompositeImpl(*instrumentingAgents); |
| 924 | } |
| 925 | |
| 926 | inline void InspectorInstrumentation::willPaint(RenderObject& renderer) |
| 927 | { |
| 928 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 929 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer)) |
| 930 | return willPaintImpl(*instrumentingAgents, renderer); |
| 931 | } |
| 932 | |
| 933 | inline void InspectorInstrumentation::didPaint(RenderObject& renderer, const LayoutRect& rect) |
| 934 | { |
| 935 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 936 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer)) |
| 937 | didPaintImpl(*instrumentingAgents, renderer, rect); |
| 938 | } |
| 939 | |
| 940 | inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document& document) |
| 941 | { |
| 942 | FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); |
| 943 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 944 | return willRecalculateStyleImpl(*instrumentingAgents, document); |
| 945 | return InspectorInstrumentationCookie(); |
| 946 | } |
| 947 | |
| 948 | inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie) |
| 949 | { |
| 950 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 951 | if (cookie.isValid()) |
| 952 | didRecalculateStyleImpl(cookie); |
| 953 | } |
| 954 | |
| 955 | inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document& document) |
| 956 | { |
| 957 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 958 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 959 | didScheduleStyleRecalculationImpl(*instrumentingAgents, document); |
| 960 | } |
| 961 | |
| 962 | inline void InspectorInstrumentation::applyUserAgentOverride(Frame& frame, String& userAgent) |
| 963 | { |
| 964 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 965 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 966 | applyUserAgentOverrideImpl(*instrumentingAgents, userAgent); |
| 967 | } |
| 968 | |
| 969 | inline void InspectorInstrumentation::applyEmulatedMedia(Frame& frame, String& media) |
| 970 | { |
| 971 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 972 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 973 | applyEmulatedMediaImpl(*instrumentingAgents, media); |
| 974 | } |
| 975 | |
| 976 | inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse) |
| 977 | { |
| 978 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 979 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 980 | willSendRequestImpl(*instrumentingAgents, identifier, loader, request, redirectResponse); |
| 981 | } |
| 982 | |
| 983 | inline void InspectorInstrumentation::willSendRequest(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, ResourceRequest& request) |
| 984 | { |
| 985 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 986 | willSendRequestImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, nullptr, request, ResourceResponse { }); |
| 987 | } |
| 988 | |
| 989 | inline void InspectorInstrumentation::willSendRequestOfType(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, LoadType loadType) |
| 990 | { |
| 991 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 992 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 993 | willSendRequestOfTypeImpl(*instrumentingAgents, identifier, loader, request, loadType); |
| 994 | } |
| 995 | |
| 996 | inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page& page, DocumentLoader* loader, CachedResource* resource) |
| 997 | { |
| 998 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 999 | didLoadResourceFromMemoryCacheImpl(instrumentingAgentsForPage(page), loader, resource); |
| 1000 | } |
| 1001 | |
| 1002 | inline void InspectorInstrumentation::didReceiveResourceResponse(Frame& frame, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader) |
| 1003 | { |
| 1004 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1005 | didReceiveResourceResponseImpl(*instrumentingAgents, identifier, loader, response, resourceLoader); |
| 1006 | } |
| 1007 | |
| 1008 | inline void InspectorInstrumentation::didReceiveResourceResponse(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, const ResourceResponse& response) |
| 1009 | { |
| 1010 | didReceiveResourceResponseImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, nullptr, response, nullptr); |
| 1011 | } |
| 1012 | |
| 1013 | inline void InspectorInstrumentation::didReceiveThreadableLoaderResponse(DocumentThreadableLoader& documentThreadableLoader, unsigned long identifier) |
| 1014 | { |
| 1015 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1016 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(documentThreadableLoader.document())) |
| 1017 | didReceiveThreadableLoaderResponseImpl(*instrumentingAgents, documentThreadableLoader, identifier); |
| 1018 | } |
| 1019 | |
| 1020 | inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long identifier, const char* data, int dataLength, int encodedDataLength) |
| 1021 | { |
| 1022 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1023 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1024 | didReceiveDataImpl(*instrumentingAgents, identifier, data, dataLength, encodedDataLength); |
| 1025 | } |
| 1026 | |
| 1027 | inline void InspectorInstrumentation::didReceiveData(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, const char* data, int dataLength) |
| 1028 | { |
| 1029 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1030 | didReceiveDataImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, data, dataLength, dataLength); |
| 1031 | } |
| 1032 | |
| 1033 | inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const NetworkLoadMetrics& networkLoadMetrics, ResourceLoader* resourceLoader) |
| 1034 | { |
| 1035 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1036 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1037 | didFinishLoadingImpl(*instrumentingAgents, identifier, loader, networkLoadMetrics, resourceLoader); |
| 1038 | } |
| 1039 | |
| 1040 | inline void InspectorInstrumentation::didFinishLoading(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, const NetworkLoadMetrics& networkLoadMetrics) |
| 1041 | { |
| 1042 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1043 | didFinishLoadingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, nullptr, networkLoadMetrics, nullptr); |
| 1044 | } |
| 1045 | |
| 1046 | inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error) |
| 1047 | { |
| 1048 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1049 | didFailLoadingImpl(*instrumentingAgents, identifier, loader, error); |
| 1050 | } |
| 1051 | |
| 1052 | inline void InspectorInstrumentation::didFailLoading(WorkerGlobalScope& workerGlobalScope, unsigned long identifier, const ResourceError& error) |
| 1053 | { |
| 1054 | didFailLoadingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), identifier, nullptr, error); |
| 1055 | } |
| 1056 | |
| 1057 | inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame& frame, unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response) |
| 1058 | { |
| 1059 | // Treat the same as didReceiveResponse. |
| 1060 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1061 | didReceiveResourceResponseImpl(*instrumentingAgents, identifier, &loader, response, nullptr); |
| 1062 | } |
| 1063 | |
| 1064 | inline void InspectorInstrumentation::continueWithPolicyDownload(Frame& frame, unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response) |
| 1065 | { |
| 1066 | // Treat the same as didReceiveResponse. |
| 1067 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1068 | didReceiveResourceResponseImpl(*instrumentingAgents, identifier, &loader, response, nullptr); |
| 1069 | } |
| 1070 | |
| 1071 | inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame& frame, unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response) |
| 1072 | { |
| 1073 | // Treat the same as didReceiveResponse. |
| 1074 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1075 | didReceiveResourceResponseImpl(*instrumentingAgents, identifier, &loader, response, nullptr); |
| 1076 | } |
| 1077 | |
| 1078 | inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context) |
| 1079 | { |
| 1080 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1081 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 1082 | willLoadXHRSynchronouslyImpl(*instrumentingAgents); |
| 1083 | } |
| 1084 | |
| 1085 | inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context) |
| 1086 | { |
| 1087 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1088 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 1089 | didLoadXHRSynchronouslyImpl(*instrumentingAgents); |
| 1090 | } |
| 1091 | |
| 1092 | inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext& context, unsigned long identifier, const String& sourceString) |
| 1093 | { |
| 1094 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1095 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 1096 | scriptImportedImpl(*instrumentingAgents, identifier, sourceString); |
| 1097 | } |
| 1098 | |
| 1099 | inline void InspectorInstrumentation::scriptExecutionBlockedByCSP(ScriptExecutionContext* context, const String& directiveText) |
| 1100 | { |
| 1101 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1102 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 1103 | scriptExecutionBlockedByCSPImpl(*instrumentingAgents, directiveText); |
| 1104 | } |
| 1105 | |
| 1106 | inline void InspectorInstrumentation::didReceiveScriptResponse(ScriptExecutionContext* context, unsigned long identifier) |
| 1107 | { |
| 1108 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1109 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 1110 | didReceiveScriptResponseImpl(*instrumentingAgents, identifier); |
| 1111 | } |
| 1112 | |
| 1113 | inline void InspectorInstrumentation::domContentLoadedEventFired(Frame& frame) |
| 1114 | { |
| 1115 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1116 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1117 | domContentLoadedEventFiredImpl(*instrumentingAgents, frame); |
| 1118 | } |
| 1119 | |
| 1120 | inline void InspectorInstrumentation::loadEventFired(Frame* frame) |
| 1121 | { |
| 1122 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1123 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1124 | loadEventFiredImpl(*instrumentingAgents, frame); |
| 1125 | } |
| 1126 | |
| 1127 | inline void InspectorInstrumentation::frameDetachedFromParent(Frame& frame) |
| 1128 | { |
| 1129 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1130 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1131 | frameDetachedFromParentImpl(*instrumentingAgents, frame); |
| 1132 | } |
| 1133 | |
| 1134 | inline void InspectorInstrumentation::didCommitLoad(Frame& frame, DocumentLoader* loader) |
| 1135 | { |
| 1136 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1137 | didCommitLoadImpl(*instrumentingAgents, frame, loader); |
| 1138 | } |
| 1139 | |
| 1140 | inline void InspectorInstrumentation::frameDocumentUpdated(Frame& frame) |
| 1141 | { |
| 1142 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1143 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1144 | frameDocumentUpdatedImpl(*instrumentingAgents, frame); |
| 1145 | } |
| 1146 | |
| 1147 | inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame& frame, DocumentLoader& loader) |
| 1148 | { |
| 1149 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1150 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1151 | loaderDetachedFromFrameImpl(*instrumentingAgents, loader); |
| 1152 | } |
| 1153 | |
| 1154 | inline void InspectorInstrumentation::frameStartedLoading(Frame& frame) |
| 1155 | { |
| 1156 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1157 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1158 | frameStartedLoadingImpl(*instrumentingAgents, frame); |
| 1159 | } |
| 1160 | |
| 1161 | inline void InspectorInstrumentation::frameStoppedLoading(Frame& frame) |
| 1162 | { |
| 1163 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1164 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1165 | frameStoppedLoadingImpl(*instrumentingAgents, frame); |
| 1166 | } |
| 1167 | |
| 1168 | inline void InspectorInstrumentation::frameScheduledNavigation(Frame& frame, Seconds delay) |
| 1169 | { |
| 1170 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1171 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1172 | frameScheduledNavigationImpl(*instrumentingAgents, frame, delay); |
| 1173 | } |
| 1174 | |
| 1175 | inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& frame) |
| 1176 | { |
| 1177 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1178 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1179 | frameClearedScheduledNavigationImpl(*instrumentingAgents, frame); |
| 1180 | } |
| 1181 | |
| 1182 | inline void InspectorInstrumentation::defaultAppearanceDidChange(Page& page, bool useDarkAppearance) |
| 1183 | { |
| 1184 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1185 | defaultAppearanceDidChangeImpl(instrumentingAgentsForPage(page), useDarkAppearance); |
| 1186 | } |
| 1187 | |
| 1188 | inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource& cachedResource) |
| 1189 | { |
| 1190 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1191 | willDestroyCachedResourceImpl(cachedResource); |
| 1192 | } |
| 1193 | |
| 1194 | inline void InspectorInstrumentation::didOpenDatabase(Database& database) |
| 1195 | { |
| 1196 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1197 | if (auto* instrumentingAgents = instrumentingAgentsForContext(database.scriptExecutionContext())) |
| 1198 | didOpenDatabaseImpl(*instrumentingAgents, database); |
| 1199 | } |
| 1200 | |
| 1201 | inline void InspectorInstrumentation::didDispatchDOMStorageEvent(Page& page, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin) |
| 1202 | { |
| 1203 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1204 | didDispatchDOMStorageEventImpl(instrumentingAgentsForPage(page), key, oldValue, newValue, storageType, securityOrigin); |
| 1205 | } |
| 1206 | |
| 1207 | inline bool InspectorInstrumentation::shouldWaitForDebuggerOnStart(ScriptExecutionContext& context) |
| 1208 | { |
| 1209 | FAST_RETURN_IF_NO_FRONTENDS(false); |
| 1210 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 1211 | return shouldWaitForDebuggerOnStartImpl(*instrumentingAgents); |
| 1212 | return false; |
| 1213 | } |
| 1214 | |
| 1215 | inline void InspectorInstrumentation::workerStarted(ScriptExecutionContext& context, WorkerInspectorProxy* proxy, const URL& url) |
| 1216 | { |
| 1217 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1218 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 1219 | workerStartedImpl(*instrumentingAgents, proxy, url); |
| 1220 | } |
| 1221 | |
| 1222 | inline void InspectorInstrumentation::workerTerminated(ScriptExecutionContext& context, WorkerInspectorProxy* proxy) |
| 1223 | { |
| 1224 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1225 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 1226 | workerTerminatedImpl(*instrumentingAgents, proxy); |
| 1227 | } |
| 1228 | |
| 1229 | inline void InspectorInstrumentation::didCreateWebSocket(Document* document, unsigned long identifier, const URL& requestURL) |
| 1230 | { |
| 1231 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1232 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1233 | didCreateWebSocketImpl(*instrumentingAgents, identifier, requestURL); |
| 1234 | } |
| 1235 | |
| 1236 | inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(Document* document, unsigned long identifier, const ResourceRequest& request) |
| 1237 | { |
| 1238 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1239 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1240 | willSendWebSocketHandshakeRequestImpl(*instrumentingAgents, identifier, request); |
| 1241 | } |
| 1242 | |
| 1243 | inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(Document* document, unsigned long identifier, const ResourceResponse& response) |
| 1244 | { |
| 1245 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1246 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1247 | didReceiveWebSocketHandshakeResponseImpl(*instrumentingAgents, identifier, response); |
| 1248 | } |
| 1249 | |
| 1250 | inline void InspectorInstrumentation::didCloseWebSocket(Document* document, unsigned long identifier) |
| 1251 | { |
| 1252 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1253 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1254 | didCloseWebSocketImpl(*instrumentingAgents, identifier); |
| 1255 | } |
| 1256 | |
| 1257 | inline void InspectorInstrumentation::didReceiveWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame) |
| 1258 | { |
| 1259 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1260 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1261 | didReceiveWebSocketFrameImpl(*instrumentingAgents, identifier, frame); |
| 1262 | } |
| 1263 | |
| 1264 | inline void InspectorInstrumentation::didReceiveWebSocketFrameError(Document* document, unsigned long identifier, const String& errorMessage) |
| 1265 | { |
| 1266 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1267 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1268 | didReceiveWebSocketFrameErrorImpl(*instrumentingAgents, identifier, errorMessage); |
| 1269 | } |
| 1270 | |
| 1271 | inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame) |
| 1272 | { |
| 1273 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1274 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1275 | didSendWebSocketFrameImpl(*instrumentingAgents, identifier, frame); |
| 1276 | } |
| 1277 | |
| 1278 | #if ENABLE(RESOURCE_USAGE) |
| 1279 | inline void InspectorInstrumentation::didHandleMemoryPressure(Page& page, Critical critical) |
| 1280 | { |
| 1281 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1282 | didHandleMemoryPressureImpl(instrumentingAgentsForPage(page), critical); |
| 1283 | } |
| 1284 | #endif |
| 1285 | |
| 1286 | inline void InspectorInstrumentation::didChangeCSSCanvasClientNodes(CanvasBase& canvasBase) |
| 1287 | { |
| 1288 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1289 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(canvasBase.scriptExecutionContext())) |
| 1290 | didChangeCSSCanvasClientNodesImpl(*instrumentingAgents, canvasBase); |
| 1291 | } |
| 1292 | |
| 1293 | inline void InspectorInstrumentation::didCreateCanvasRenderingContext(CanvasRenderingContext& context) |
| 1294 | { |
| 1295 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1296 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext())) |
| 1297 | didCreateCanvasRenderingContextImpl(*instrumentingAgents, context); |
| 1298 | } |
| 1299 | |
| 1300 | inline void InspectorInstrumentation::didChangeCanvasMemory(CanvasRenderingContext& context) |
| 1301 | { |
| 1302 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1303 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext())) |
| 1304 | didChangeCanvasMemoryImpl(*instrumentingAgents, context); |
| 1305 | } |
| 1306 | |
| 1307 | inline void InspectorInstrumentation::recordCanvasAction(CanvasRenderingContext& context, const String& name, Vector<RecordCanvasActionVariant>&& parameters) |
| 1308 | { |
| 1309 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1310 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext())) |
| 1311 | recordCanvasActionImpl(*instrumentingAgents, context, name, WTFMove(parameters)); |
| 1312 | } |
| 1313 | |
| 1314 | inline void InspectorInstrumentation::didFinishRecordingCanvasFrame(CanvasRenderingContext& context, bool forceDispatch) |
| 1315 | { |
| 1316 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1317 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext())) |
| 1318 | didFinishRecordingCanvasFrameImpl(*instrumentingAgents, context, forceDispatch); |
| 1319 | } |
| 1320 | |
| 1321 | #if ENABLE(WEBGL) |
| 1322 | inline void InspectorInstrumentation::didEnableExtension(WebGLRenderingContextBase& contextWebGLBase, const String& extension) |
| 1323 | { |
| 1324 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1325 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext())) |
| 1326 | didEnableExtensionImpl(*instrumentingAgents, contextWebGLBase, extension); |
| 1327 | } |
| 1328 | |
| 1329 | inline void InspectorInstrumentation::didCreateProgram(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program) |
| 1330 | { |
| 1331 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1332 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext())) |
| 1333 | didCreateProgramImpl(*instrumentingAgents, contextWebGLBase, program); |
| 1334 | } |
| 1335 | |
| 1336 | inline void InspectorInstrumentation::willDeleteProgram(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program) |
| 1337 | { |
| 1338 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1339 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext())) |
| 1340 | willDeleteProgramImpl(*instrumentingAgents, program); |
| 1341 | } |
| 1342 | |
| 1343 | inline bool InspectorInstrumentation::isShaderProgramDisabled(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program) |
| 1344 | { |
| 1345 | FAST_RETURN_IF_NO_FRONTENDS(false); |
| 1346 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext())) |
| 1347 | return isShaderProgramDisabledImpl(*instrumentingAgents, program); |
| 1348 | return false; |
| 1349 | } |
| 1350 | |
| 1351 | inline bool InspectorInstrumentation::isShaderProgramHighlighted(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program) |
| 1352 | { |
| 1353 | FAST_RETURN_IF_NO_FRONTENDS(false); |
| 1354 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext())) |
| 1355 | return isShaderProgramHighlightedImpl(*instrumentingAgents, program); |
| 1356 | return false; |
| 1357 | } |
| 1358 | #endif |
| 1359 | |
| 1360 | inline void InspectorInstrumentation::networkStateChanged(Page& page) |
| 1361 | { |
| 1362 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1363 | networkStateChangedImpl(instrumentingAgentsForPage(page)); |
| 1364 | } |
| 1365 | |
| 1366 | inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame) |
| 1367 | { |
| 1368 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1369 | if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1370 | updateApplicationCacheStatusImpl(*instrumentingAgents, *frame); |
| 1371 | } |
| 1372 | |
| 1373 | inline void InspectorInstrumentation::addMessageToConsole(Page& page, std::unique_ptr<Inspector::ConsoleMessage> message) |
| 1374 | { |
| 1375 | addMessageToConsoleImpl(instrumentingAgentsForPage(page), WTFMove(message)); |
| 1376 | } |
| 1377 | |
| 1378 | inline void InspectorInstrumentation::addMessageToConsole(WorkerGlobalScope& workerGlobalScope, std::unique_ptr<Inspector::ConsoleMessage> message) |
| 1379 | { |
| 1380 | addMessageToConsoleImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), WTFMove(message)); |
| 1381 | } |
| 1382 | |
| 1383 | inline void InspectorInstrumentation::consoleCount(Page& page, JSC::ExecState* state, Ref<Inspector::ScriptArguments>&& arguments) |
| 1384 | { |
| 1385 | consoleCountImpl(instrumentingAgentsForPage(page), state, WTFMove(arguments)); |
| 1386 | } |
| 1387 | |
| 1388 | inline void InspectorInstrumentation::consoleCount(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* state, Ref<Inspector::ScriptArguments>&& arguments) |
| 1389 | { |
| 1390 | consoleCountImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), state, WTFMove(arguments)); |
| 1391 | } |
| 1392 | |
| 1393 | inline void InspectorInstrumentation::takeHeapSnapshot(Frame& frame, const String& title) |
| 1394 | { |
| 1395 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1396 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1397 | takeHeapSnapshotImpl(*instrumentingAgents, title); |
| 1398 | } |
| 1399 | |
| 1400 | inline void InspectorInstrumentation::startConsoleTiming(Frame& frame, const String& title) |
| 1401 | { |
| 1402 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1403 | startConsoleTimingImpl(*instrumentingAgents, frame, title); |
| 1404 | } |
| 1405 | |
| 1406 | inline void InspectorInstrumentation::startConsoleTiming(WorkerGlobalScope& workerGlobalScope, const String& title) |
| 1407 | { |
| 1408 | startConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title); |
| 1409 | } |
| 1410 | |
| 1411 | inline void InspectorInstrumentation::stopConsoleTiming(Frame& frame, const String& title, Ref<Inspector::ScriptCallStack>&& stack) |
| 1412 | { |
| 1413 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1414 | stopConsoleTimingImpl(*instrumentingAgents, frame, title, WTFMove(stack)); |
| 1415 | } |
| 1416 | |
| 1417 | inline void InspectorInstrumentation::stopConsoleTiming(WorkerGlobalScope& workerGlobalScope, const String& title, Ref<Inspector::ScriptCallStack>&& stack) |
| 1418 | { |
| 1419 | stopConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title, WTFMove(stack)); |
| 1420 | } |
| 1421 | |
| 1422 | inline void InspectorInstrumentation::consoleTimeStamp(Frame& frame, Ref<Inspector::ScriptArguments>&& arguments) |
| 1423 | { |
| 1424 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1425 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) |
| 1426 | consoleTimeStampImpl(*instrumentingAgents, frame, WTFMove(arguments)); |
| 1427 | } |
| 1428 | |
| 1429 | inline void InspectorInstrumentation::startProfiling(Page& page, JSC::ExecState* exec, const String &title) |
| 1430 | { |
| 1431 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1432 | startProfilingImpl(instrumentingAgentsForPage(page), exec, title); |
| 1433 | } |
| 1434 | |
| 1435 | inline void InspectorInstrumentation::stopProfiling(Page& page, JSC::ExecState* exec, const String &title) |
| 1436 | { |
| 1437 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1438 | stopProfilingImpl(instrumentingAgentsForPage(page), exec, title); |
| 1439 | } |
| 1440 | |
| 1441 | inline void InspectorInstrumentation::consoleStartRecordingCanvas(CanvasRenderingContext& context, JSC::ExecState& exec, JSC::JSObject* options) |
| 1442 | { |
| 1443 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1444 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context.canvasBase().scriptExecutionContext())) |
| 1445 | consoleStartRecordingCanvasImpl(*instrumentingAgents, context, exec, options); |
| 1446 | } |
| 1447 | |
| 1448 | inline void InspectorInstrumentation::didRequestAnimationFrame(Document& document, int callbackId) |
| 1449 | { |
| 1450 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1451 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1452 | didRequestAnimationFrameImpl(*instrumentingAgents, callbackId, document); |
| 1453 | } |
| 1454 | |
| 1455 | inline void InspectorInstrumentation::didCancelAnimationFrame(Document& document, int callbackId) |
| 1456 | { |
| 1457 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1458 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1459 | didCancelAnimationFrameImpl(*instrumentingAgents, callbackId, document); |
| 1460 | } |
| 1461 | |
| 1462 | inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrame(Document& document, int callbackId) |
| 1463 | { |
| 1464 | FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); |
| 1465 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) |
| 1466 | return willFireAnimationFrameImpl(*instrumentingAgents, callbackId, document); |
| 1467 | return InspectorInstrumentationCookie(); |
| 1468 | } |
| 1469 | |
| 1470 | inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstrumentationCookie& cookie) |
| 1471 | { |
| 1472 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1473 | if (cookie.isValid()) |
| 1474 | didFireAnimationFrameImpl(cookie); |
| 1475 | } |
| 1476 | |
| 1477 | inline InspectorInstrumentationCookie InspectorInstrumentation::willFireObserverCallback(ScriptExecutionContext& context, const String& callbackType) |
| 1478 | { |
| 1479 | FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); |
| 1480 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) |
| 1481 | return willFireObserverCallbackImpl(*instrumentingAgents, callbackType, context); |
| 1482 | return InspectorInstrumentationCookie(); |
| 1483 | } |
| 1484 | |
| 1485 | inline void InspectorInstrumentation::didFireObserverCallback(const InspectorInstrumentationCookie& cookie) |
| 1486 | { |
| 1487 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1488 | if (cookie.isValid()) |
| 1489 | didFireObserverCallbackImpl(cookie); |
| 1490 | } |
| 1491 | |
| 1492 | inline void InspectorInstrumentation::layerTreeDidChange(Page* page) |
| 1493 | { |
| 1494 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1495 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) |
| 1496 | layerTreeDidChangeImpl(*instrumentingAgents); |
| 1497 | } |
| 1498 | |
| 1499 | inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const RenderLayer& renderLayer) |
| 1500 | { |
| 1501 | FAST_RETURN_IF_NO_FRONTENDS(void()); |
| 1502 | if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) |
| 1503 | renderLayerDestroyedImpl(*instrumentingAgents, renderLayer); |
| 1504 | } |
| 1505 | |
| 1506 | inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context) |
| 1507 | { |
| 1508 | return context ? instrumentingAgentsForContext(*context) : nullptr; |
| 1509 | } |
| 1510 | |
| 1511 | inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext& context) |
| 1512 | { |
| 1513 | if (is<Document>(context)) |
| 1514 | return instrumentingAgentsForPage(downcast<Document>(context).page()); |
| 1515 | if (is<WorkerGlobalScope>(context)) |
| 1516 | return &instrumentingAgentsForWorkerGlobalScope(downcast<WorkerGlobalScope>(context)); |
| 1517 | return nullptr; |
| 1518 | } |
| 1519 | |
| 1520 | inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame) |
| 1521 | { |
| 1522 | return frame ? instrumentingAgentsForFrame(*frame) : nullptr; |
| 1523 | } |
| 1524 | |
| 1525 | inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame& frame) |
| 1526 | { |
| 1527 | return instrumentingAgentsForPage(frame.page()); |
| 1528 | } |
| 1529 | |
| 1530 | inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document* document) |
| 1531 | { |
| 1532 | return document ? instrumentingAgentsForDocument(*document) : nullptr; |
| 1533 | } |
| 1534 | |
| 1535 | inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document& document) |
| 1536 | { |
| 1537 | Page* page = document.page(); |
| 1538 | if (!page && document.templateDocumentHost()) |
| 1539 | page = document.templateDocumentHost()->page(); |
| 1540 | return instrumentingAgentsForPage(page); |
| 1541 | } |
| 1542 | |
| 1543 | inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page) |
| 1544 | { |
| 1545 | return page ? &instrumentingAgentsForPage(*page) : nullptr; |
| 1546 | } |
| 1547 | |
| 1548 | inline InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForPage(Page& page) |
| 1549 | { |
| 1550 | ASSERT(isMainThread()); |
| 1551 | return page.inspectorController().m_instrumentingAgents.get(); |
| 1552 | } |
| 1553 | |
| 1554 | inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope* workerGlobalScope) |
| 1555 | { |
| 1556 | return workerGlobalScope ? &instrumentingAgentsForWorkerGlobalScope(*workerGlobalScope) : nullptr; |
| 1557 | } |
| 1558 | |
| 1559 | inline InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope& workerGlobalScope) |
| 1560 | { |
| 1561 | return workerGlobalScope.inspectorController().m_instrumentingAgents; |
| 1562 | } |
| 1563 | |
| 1564 | inline void InspectorInstrumentation::frontendCreated() |
| 1565 | { |
| 1566 | ASSERT(isMainThread()); |
| 1567 | s_frontendCounter++; |
| 1568 | |
| 1569 | if (s_frontendCounter == 1) |
| 1570 | InspectorInstrumentation::firstFrontendCreated(); |
| 1571 | } |
| 1572 | |
| 1573 | inline void InspectorInstrumentation::frontendDeleted() |
| 1574 | { |
| 1575 | ASSERT(isMainThread()); |
| 1576 | s_frontendCounter--; |
| 1577 | |
| 1578 | if (!s_frontendCounter) |
| 1579 | InspectorInstrumentation::lastFrontendDeleted(); |
| 1580 | } |
| 1581 | |
| 1582 | } // namespace WebCore |
| 1583 | |