diff options
Diffstat (limited to 'Source/WebCore/inspector/InspectorInstrumentation.h')
-rw-r--r-- | Source/WebCore/inspector/InspectorInstrumentation.h | 1954 |
1 files changed, 698 insertions, 1256 deletions
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index 13d622455..9a99e9963 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Google Inc. All rights reserved. +* Copyright (C) 2014-2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,217 +29,208 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef InspectorInstrumentation_h -#define InspectorInstrumentation_h +#pragma once #include "CSSSelector.h" -#include "ConsoleAPITypes.h" -#include "ConsoleTypes.h" +#include "DocumentThreadableLoader.h" #include "Element.h" #include "FormData.h" #include "Frame.h" #include "HitTestResult.h" +#include "InspectorController.h" #include "InspectorInstrumentationCookie.h" +#include "MemoryPressureHandler.h" #include "Page.h" #include "ScriptExecutionContext.h" -#include "ScriptState.h" #include "StorageArea.h" -#include "WebSocketFrame.h" +#include "WorkerGlobalScope.h" +#include "WorkerInspectorController.h" #include <wtf/RefPtr.h> -namespace Deprecated { -class ScriptObject; +#if ENABLE(WEB_REPLAY) +#include "ReplaySession.h" +#include "ReplaySessionSegment.h" +#endif + + +namespace Inspector { +class ConsoleMessage; +class ScriptArguments; +class ScriptCallStack; } namespace WebCore { -class CSSRule; class CachedResource; class CharacterData; class DOMWindow; class DOMWrapperWorld; class Database; class Document; -class Element; class DocumentLoader; -class DocumentStyleSheetCollection; -class GraphicsContext; class HTTPHeaderMap; -class InspectorCSSAgent; -class InspectorCSSOMWrappers; -class InspectorInstrumentation; class InspectorTimelineAgent; class InstrumentingAgents; -class URL; class Node; class PseudoElement; class RenderLayer; -class RenderLayerBacking; class RenderObject; class ResourceRequest; class ResourceResponse; -class ScriptArguments; -class ScriptCallStack; -class ScriptExecutionContext; -class ScriptProfile; class SecurityOrigin; class ShadowRoot; -class StorageArea; -class StyleResolver; -class StyleRule; -class ThreadableLoaderClient; -class WorkerGlobalScope; -class WorkerGlobalScopeProxy; -class XMLHttpRequest; +class URL; +class WebKitNamedFlow; +class WorkerInspectorProxy; + +enum class StorageType; + +struct ReplayPosition; +struct WebSocketFrame; #define FAST_RETURN_IF_NO_FRONTENDS(value) if (LIKELY(!hasFrontends())) return value; class InspectorInstrumentation { public: - static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld&); + static void didClearWindowObjectInWorld(Frame&, DOMWrapperWorld&); static bool isDebuggerPaused(Frame*); - static void willInsertDOMNode(Document*, Node* parent); - static void didInsertDOMNode(Document*, Node*); - static void willRemoveDOMNode(Document*, Node*); - static void didRemoveDOMNode(Document*, Node*); - static void willModifyDOMAttr(Document*, Element*, const AtomicString& oldValue, const AtomicString& newValue); - static void didModifyDOMAttr(Document*, Element*, const AtomicString& name, const AtomicString& value); - static void didRemoveDOMAttr(Document*, Element*, const AtomicString& name); - static void characterDataModified(Document*, CharacterData*); - static void didInvalidateStyleAttr(Document*, Node*); - static void frameWindowDiscarded(Frame*, DOMWindow*); - static void mediaQueryResultChanged(Document*); - static void didPushShadowRoot(Element* host, ShadowRoot*); - static void willPopShadowRoot(Element* host, ShadowRoot*); - static void didCreateNamedFlow(Document*, WebKitNamedFlow*); - static void willRemoveNamedFlow(Document*, WebKitNamedFlow*); - static void didUpdateRegionLayout(Document*, WebKitNamedFlow*); - static void didChangeRegionOverset(Document*, WebKitNamedFlow*); - static void didRegisterNamedFlowContentElement(Document*, WebKitNamedFlow*, Node* contentElement, Node* nextContentElement = nullptr); - static void didUnregisterNamedFlowContentElement(Document*, WebKitNamedFlow*, Node* contentElement); - - static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags); - static bool handleMousePress(Page*); - static bool handleTouchEvent(Page*, Node*); - static bool forcePseudoState(Element*, CSSSelector::PseudoType); + static void willInsertDOMNode(Document&, Node& parent); + static void didInsertDOMNode(Document&, Node&); + static void willRemoveDOMNode(Document&, Node&); + static void didRemoveDOMNode(Document&, Node&); + static void willModifyDOMAttr(Document&, Element&, const AtomicString& oldValue, const AtomicString& newValue); + static void didModifyDOMAttr(Document&, Element&, const AtomicString& name, const AtomicString& value); + static void didRemoveDOMAttr(Document&, Element&, const AtomicString& name); + static void characterDataModified(Document&, CharacterData&); + static void didInvalidateStyleAttr(Document&, Node&); + static void documentDetached(Document&); + static void frameWindowDiscarded(Frame&, DOMWindow*); + static void mediaQueryResultChanged(Document&); + static void activeStyleSheetsUpdated(Document&); + static void didPushShadowRoot(Element& host, ShadowRoot&); + static void willPopShadowRoot(Element& host, ShadowRoot&); + static void didChangeCustomElementState(Element&); + static void pseudoElementCreated(Page*, PseudoElement&); + static void pseudoElementDestroyed(Page*, PseudoElement&); + static void didCreateNamedFlow(Document*, WebKitNamedFlow&); + static void willRemoveNamedFlow(Document*, WebKitNamedFlow&); + static void didChangeRegionOverset(Document&, WebKitNamedFlow&); + static void didRegisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr); + static void didUnregisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement); + + static void mouseDidMoveOverElement(Page&, const HitTestResult&, unsigned modifierFlags); + static bool handleMousePress(Frame&); + static bool handleTouchEvent(Frame&, Node&); + static bool forcePseudoState(const Element&, CSSSelector::PseudoClassType); static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url); - static void didScheduleResourceRequest(Document*, const String& url); - static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot); - static void didRemoveTimer(ScriptExecutionContext*, int timerId); + static void didInstallTimer(ScriptExecutionContext&, int timerId, std::chrono::milliseconds timeout, bool singleShot); + static void didRemoveTimer(ScriptExecutionContext&, int timerId); static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine); - static void didCallFunction(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext*, XMLHttpRequest*); - static void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event&, bool hasEventListeners); + static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*); + static InspectorInstrumentationCookie willDispatchEvent(Document&, const Event&, bool hasEventListeners); static void didDispatchEvent(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, Event*); - static void didHandleEvent(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window); + static void willHandleEvent(ScriptExecutionContext*, const Event&); + static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event&, DOMWindow&); static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willEvaluateScript(Frame*, const String& url, int lineNumber); - static void didEvaluateScript(const InspectorInstrumentationCookie&); - static void scriptsEnabled(Page*, bool isEnabled); - static void didCreateIsolatedContext(Frame*, JSC::ExecState*, SecurityOrigin*); - static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext*, int timerId); + static InspectorInstrumentationCookie willEvaluateScript(Frame&, const String& url, int lineNumber); + static void didEvaluateScript(const InspectorInstrumentationCookie&, Frame&); + static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext&, int timerId); static void didFireTimer(const InspectorInstrumentationCookie&); - static void didInvalidateLayout(Frame*); - static InspectorInstrumentationCookie willLayout(Frame*); - static void didLayout(const InspectorInstrumentationCookie&, RenderObject*); - static void didScroll(Page*); - static InspectorInstrumentationCookie willDispatchXHRLoadEvent(ScriptExecutionContext*, XMLHttpRequest*); - static void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&); - static void willScrollLayer(Frame*); - static void didScrollLayer(Frame*); - static void willPaint(RenderObject*); - static void didPaint(RenderObject*, GraphicsContext*, const LayoutRect&); - static void willComposite(Page*); - static void didComposite(Page*); - static InspectorInstrumentationCookie willRecalculateStyle(Document*); + static void didInvalidateLayout(Frame&); + static InspectorInstrumentationCookie willLayout(Frame&); + static void didLayout(const InspectorInstrumentationCookie&, RenderObject&); + static void didScroll(Page&); + static void willComposite(Frame&); + static void didComposite(Frame&); + static void willPaint(RenderObject&); + static void didPaint(RenderObject&, const LayoutRect&); + static InspectorInstrumentationCookie willRecalculateStyle(Document&); static void didRecalculateStyle(const InspectorInstrumentationCookie&); - static void didScheduleStyleRecalculation(Document*); + static void didScheduleStyleRecalculation(Document&); - static void applyEmulatedMedia(Frame*, String*); + static void applyEmulatedMedia(Frame&, String&); static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse); - static void continueAfterPingLoader(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&); - static void markResourceAsCached(Page*, unsigned long identifier); - static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, CachedResource*); - static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier, int length); - static void didReceiveResourceData(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&); - static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); - static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); - static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); - static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); + static void continueAfterPingLoader(Frame&, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&); + static void markResourceAsCached(Page&, unsigned long identifier); + static void didLoadResourceFromMemoryCache(Page&, DocumentLoader*, CachedResource*); + static void didReceiveResourceResponse(Frame&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); + static void didReceiveThreadableLoaderResponse(DocumentThreadableLoader&, unsigned long identifier); static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength); static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime); static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&); - static void documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext*, unsigned long identifier, ThreadableLoaderClient*); - static void willLoadXHR(ScriptExecutionContext*, ThreadableLoaderClient*, const String&, const URL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool); - static void didFailXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*); - static void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber); - static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier); + static void continueAfterXFrameOptionsDenied(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&); + static void continueWithPolicyDownload(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&); + static void continueWithPolicyIgnore(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&); + + static void didFinishXHRLoading(ScriptExecutionContext*, unsigned long identifier, std::optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber); static void willLoadXHRSynchronously(ScriptExecutionContext*); static void didLoadXHRSynchronously(ScriptExecutionContext*); - static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString); + static void scriptImported(ScriptExecutionContext&, unsigned long identifier, const String& sourceString); static void scriptExecutionBlockedByCSP(ScriptExecutionContext*, const String& directiveText); static void didReceiveScriptResponse(ScriptExecutionContext*, unsigned long identifier); - static void domContentLoadedEventFired(Frame*); + static void domContentLoadedEventFired(Frame&); static void loadEventFired(Frame*); - static void frameDetachedFromParent(Frame*); - static void didCommitLoad(Frame*, DocumentLoader*); - static void frameDocumentUpdated(Frame*); - static void loaderDetachedFromFrame(Frame*, DocumentLoader*); + static void frameDetachedFromParent(Frame&); + static void didCommitLoad(Frame&, DocumentLoader*); + static void frameDocumentUpdated(Frame&); + static void loaderDetachedFromFrame(Frame&, DocumentLoader&); static void frameStartedLoading(Frame&); static void frameStoppedLoading(Frame&); static void frameScheduledNavigation(Frame&, double delay); static void frameClearedScheduledNavigation(Frame&); - static InspectorInstrumentationCookie willRunJavaScriptDialog(Page*, const String& message); - static void didRunJavaScriptDialog(const InspectorInstrumentationCookie&); - static void willDestroyCachedResource(CachedResource*); - - static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned startLine); - static void didWriteHTML(const InspectorInstrumentationCookie&, unsigned endLine); - - // FIXME: Remove once we no longer generate stacks outside of Inspector. - static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier = 0); - static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, JSC::ExecState*, PassRefPtr<ScriptArguments>, unsigned long requestIdentifier = 0); - static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0); - - // FIXME: Convert to ScriptArguments to match non-worker context. - static void addMessageToConsole(WorkerGlobalScope*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier = 0); - static void addMessageToConsole(WorkerGlobalScope*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0); - - static void consoleCount(Page*, JSC::ExecState*, PassRefPtr<ScriptArguments>); - static void startConsoleTiming(Frame*, const String& title); - static void stopConsoleTiming(Frame*, const String& title, PassRefPtr<ScriptCallStack>); - static void consoleTimeStamp(Frame*, PassRefPtr<ScriptArguments>); + static void willDestroyCachedResource(CachedResource&); + + static void addMessageToConsole(Page&, std::unique_ptr<Inspector::ConsoleMessage>); + static void addMessageToConsole(WorkerGlobalScope&, std::unique_ptr<Inspector::ConsoleMessage>); + + static void consoleCount(Page&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); + static void consoleCount(WorkerGlobalScope&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); + static void takeHeapSnapshot(Frame&, const String& title); + static void startConsoleTiming(Frame&, const String& title); + static void startConsoleTiming(WorkerGlobalScope&, const String& title); + static void stopConsoleTiming(Frame&, const String& title, Ref<Inspector::ScriptCallStack>&&); + static void stopConsoleTiming(WorkerGlobalScope&, const String& title, Ref<Inspector::ScriptCallStack>&&); + static void consoleTimeStamp(Frame&, Ref<Inspector::ScriptArguments>&&); + static void startProfiling(Page&, JSC::ExecState*, const String& title); + static void stopProfiling(Page&, JSC::ExecState*, const String& title); static void didRequestAnimationFrame(Document*, int callbackId); static void didCancelAnimationFrame(Document*, int callbackId); static InspectorInstrumentationCookie willFireAnimationFrame(Document*, int callbackId); static void didFireAnimationFrame(const InspectorInstrumentationCookie&); - static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, unsigned columnNumber, const String& sourceURL); - static void addProfile(Page*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>); - static String getCurrentUserInitiatedProfileName(Page*, bool incrementProfileNumber); - static bool profilerEnabled(Page*); + static void didOpenDatabase(ScriptExecutionContext*, RefPtr<Database>&&, const String& domain, const String& name, const String& version); -#if ENABLE(SQL_DATABASE) - static void didOpenDatabase(ScriptExecutionContext*, PassRefPtr<Database>, const String& domain, const String& name, const String& version); -#endif + static void didDispatchDOMStorageEvent(Page&, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*); + + static bool shouldWaitForDebuggerOnStart(ScriptExecutionContext&); + static void workerStarted(ScriptExecutionContext&, WorkerInspectorProxy*, const URL&); + static void workerTerminated(ScriptExecutionContext&, WorkerInspectorProxy*); - static void didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*); +#if ENABLE(WEB_REPLAY) + static void sessionCreated(Page&, RefPtr<ReplaySession>&&); + static void sessionLoaded(Page&, RefPtr<ReplaySession>&&); + static void sessionModified(Page&, RefPtr<ReplaySession>&&); - static bool shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext*); - static void didStartWorkerGlobalScope(ScriptExecutionContext*, WorkerGlobalScopeProxy*, const URL&); - static void workerGlobalScopeTerminated(ScriptExecutionContext*, WorkerGlobalScopeProxy*); - static void willEvaluateWorkerScript(WorkerGlobalScope*, int workerThreadStartMode); + static void segmentCreated(Page&, RefPtr<ReplaySessionSegment>&&); + static void segmentCompleted(Page&, RefPtr<ReplaySessionSegment>&&); + static void segmentLoaded(Page&, RefPtr<ReplaySessionSegment>&&); + static void segmentUnloaded(Page&); + + static void captureStarted(Page&); + static void captureStopped(Page&); + + static void playbackStarted(Page&); + static void playbackPaused(Page&, const ReplayPosition&); + static void playbackHitPosition(Page&, const ReplayPosition&); + static void playbackFinished(Page&); +#endif #if ENABLE(WEB_SOCKETS) - static void didCreateWebSocket(Document*, unsigned long identifier, const URL& requestURL, const URL& documentURL, const String& protocol); + static void didCreateWebSocket(Document*, unsigned long identifier, const URL& requestURL); static void willSendWebSocketHandshakeRequest(Document*, unsigned long identifier, const ResourceRequest&); static void didReceiveWebSocketHandshakeResponse(Document*, unsigned long identifier, const ResourceResponse&); static void didCloseWebSocket(Document*, unsigned long identifier); @@ -247,1666 +239,1116 @@ public: static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage); #endif - static Deprecated::ScriptObject wrapCanvas2DRenderingContextForInstrumentation(Document*, const Deprecated::ScriptObject&); -#if ENABLE(WEBGL) - static Deprecated::ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const Deprecated::ScriptObject&); +#if ENABLE(RESOURCE_USAGE) + static void didHandleMemoryPressure(Page&, Critical); #endif - static void networkStateChanged(Page*); + static void networkStateChanged(Page&); static void updateApplicationCacheStatus(Frame*); -#if ENABLE(INSPECTOR) + static void layerTreeDidChange(Page*); + static void renderLayerDestroyed(Page*, const RenderLayer&); + static void frontendCreated() { s_frontendCounter += 1; } static void frontendDeleted() { s_frontendCounter -= 1; } static bool hasFrontends() { return s_frontendCounter; } - static bool canvasAgentEnabled(ScriptExecutionContext*); static bool consoleAgentEnabled(ScriptExecutionContext*); static bool timelineAgentEnabled(ScriptExecutionContext*); -#else - static bool hasFrontends() { return false; } - static bool canvasAgentEnabled(ScriptExecutionContext*) { return false; } - static bool consoleAgentEnabled(ScriptExecutionContext*) { return false; } - static bool runtimeAgentEnabled(Frame*) { return false; } - static bool timelineAgentEnabled(ScriptExecutionContext*) { return false; } -#endif + static bool replayAgentEnabled(ScriptExecutionContext*); - static void registerInstrumentingAgents(InstrumentingAgents*); - static void unregisterInstrumentingAgents(InstrumentingAgents*); + static InstrumentingAgents* instrumentingAgentsForPage(Page*); -#if USE(ACCELERATED_COMPOSITING) - static void layerTreeDidChange(Page*); - static void renderLayerDestroyed(Page*, const RenderLayer*); - static void pseudoElementDestroyed(Page*, PseudoElement*); -#endif + static void registerInstrumentingAgents(InstrumentingAgents&); + static void unregisterInstrumentingAgents(InstrumentingAgents&); private: -#if ENABLE(INSPECTOR) - static void didClearWindowObjectInWorldImpl(InstrumentingAgents*, Frame*, DOMWrapperWorld&); - static bool isDebuggerPausedImpl(InstrumentingAgents*); - - static void willInsertDOMNodeImpl(InstrumentingAgents*, Node* parent); - static void didInsertDOMNodeImpl(InstrumentingAgents*, Node*); - static void willRemoveDOMNodeImpl(InstrumentingAgents*, Node*); - static void didRemoveDOMNodeImpl(InstrumentingAgents*, Node*); - static void willModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& oldValue, const AtomicString& newValue); - static void didModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name, const AtomicString& value); - static void didRemoveDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name); - static void characterDataModifiedImpl(InstrumentingAgents*, CharacterData*); - static void didInvalidateStyleAttrImpl(InstrumentingAgents*, Node*); - static void frameWindowDiscardedImpl(InstrumentingAgents*, DOMWindow*); - static void mediaQueryResultChangedImpl(InstrumentingAgents*); - static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*); - static void willPopShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*); - static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*); - static void willRemoveNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*); - static void didUpdateRegionLayoutImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*); - static void didChangeRegionOversetImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*); - static void didRegisterNamedFlowContentElementImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*, Node* contentElement, Node* nextContentElement = nullptr); - static void didUnregisterNamedFlowContentElementImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*, Node* contentElement); - - static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags); - static bool handleTouchEventImpl(InstrumentingAgents*, Node*); - static bool handleMousePressImpl(InstrumentingAgents*); - static bool forcePseudoStateImpl(InstrumentingAgents*, Element*, CSSSelector::PseudoType); - - static void willSendXMLHttpRequestImpl(InstrumentingAgents*, const String& url); - static void didScheduleResourceRequestImpl(InstrumentingAgents*, const String& url, Frame*); - static void didInstallTimerImpl(InstrumentingAgents*, int timerId, int timeout, bool singleShot, ScriptExecutionContext*); - static void didRemoveTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*); - - static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents*, const String& scriptName, int scriptLine, ScriptExecutionContext*); - static void didCallFunctionImpl(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*); - static void didDispatchXHRReadyStateChangeEventImpl(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents*, const Event&, bool hasEventListeners, Document*); - static InspectorInstrumentationCookie willHandleEventImpl(InstrumentingAgents*, Event*); - static void didHandleEventImpl(const InspectorInstrumentationCookie&); + static void didClearWindowObjectInWorldImpl(InstrumentingAgents&, Frame&, DOMWrapperWorld&); + static bool isDebuggerPausedImpl(InstrumentingAgents&); + + static void willInsertDOMNodeImpl(InstrumentingAgents&, Node& parent); + static void didInsertDOMNodeImpl(InstrumentingAgents&, Node&); + static void willRemoveDOMNodeImpl(InstrumentingAgents&, Node&); + static void didRemoveDOMNodeImpl(InstrumentingAgents&, Node&); + static void willModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& oldValue, const AtomicString& newValue); + static void didModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& name, const AtomicString& value); + static void didRemoveDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& name); + static void characterDataModifiedImpl(InstrumentingAgents&, CharacterData&); + static void didInvalidateStyleAttrImpl(InstrumentingAgents&, Node&); + static void documentDetachedImpl(InstrumentingAgents&, Document&); + static void frameWindowDiscardedImpl(InstrumentingAgents&, DOMWindow*); + static void mediaQueryResultChangedImpl(InstrumentingAgents&); + static void activeStyleSheetsUpdatedImpl(InstrumentingAgents&, Document&); + static void didPushShadowRootImpl(InstrumentingAgents&, Element& host, ShadowRoot&); + static void willPopShadowRootImpl(InstrumentingAgents&, Element& host, ShadowRoot&); + static void didChangeCustomElementStateImpl(InstrumentingAgents&, Element&); + static void pseudoElementCreatedImpl(InstrumentingAgents&, PseudoElement&); + static void pseudoElementDestroyedImpl(InstrumentingAgents&, PseudoElement&); + static void didCreateNamedFlowImpl(InstrumentingAgents&, Document*, WebKitNamedFlow&); + static void willRemoveNamedFlowImpl(InstrumentingAgents&, Document*, WebKitNamedFlow&); + static void didChangeRegionOversetImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&); + static void didRegisterNamedFlowContentElementImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr); + static void didUnregisterNamedFlowContentElementImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&, Node& contentElement); + + static void mouseDidMoveOverElementImpl(InstrumentingAgents&, const HitTestResult&, unsigned modifierFlags); + static bool handleMousePressImpl(InstrumentingAgents&); + static bool handleTouchEventImpl(InstrumentingAgents&, Node&); + static bool forcePseudoStateImpl(InstrumentingAgents&, const Element&, CSSSelector::PseudoClassType); + + static void willSendXMLHttpRequestImpl(InstrumentingAgents&, const String& url); + static void didInstallTimerImpl(InstrumentingAgents&, int timerId, std::chrono::milliseconds timeout, bool singleShot, ScriptExecutionContext&); + static void didRemoveTimerImpl(InstrumentingAgents&, int timerId, ScriptExecutionContext&); + + static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, ScriptExecutionContext*); + static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*); + static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents&, Document&, const Event&, bool hasEventListeners); + static void willHandleEventImpl(InstrumentingAgents&, const Event&); static void didDispatchEventImpl(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents*, const Event&, DOMWindow*); + static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents&, const Event&, DOMWindow&); static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents*, const String& url, int lineNumber, Frame*); - static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&); - static void scriptsEnabledImpl(InstrumentingAgents*, bool isEnabled); - static void didCreateIsolatedContextImpl(InstrumentingAgents*, Frame*, JSC::ExecState*, SecurityOrigin*); - static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*); + static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber); + static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&, Frame&); + static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents&, int timerId, ScriptExecutionContext&); static void didFireTimerImpl(const InspectorInstrumentationCookie&); - static void didInvalidateLayoutImpl(InstrumentingAgents*, Frame*); - static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents*, Frame*); - static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject*); - static void didScrollImpl(InstrumentingAgents*); - static InspectorInstrumentationCookie willDispatchXHRLoadEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*); - static void didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie&); - static void willScrollLayerImpl(InstrumentingAgents*, Frame*); - static void didScrollLayerImpl(InstrumentingAgents*); - static void willPaintImpl(InstrumentingAgents*, RenderObject*); - static void didPaintImpl(InstrumentingAgents*, RenderObject*, GraphicsContext*, const LayoutRect&); - static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*); + static void didInvalidateLayoutImpl(InstrumentingAgents&, Frame&); + static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents&, Frame&); + static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject&); + static void didScrollImpl(InstrumentingAgents&); + static void willCompositeImpl(InstrumentingAgents&, Frame&); + static void didCompositeImpl(InstrumentingAgents&); + static void willPaintImpl(InstrumentingAgents&, RenderObject&); + static void didPaintImpl(InstrumentingAgents&, RenderObject&, const LayoutRect&); + static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents&, Document&); static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&); - static void didScheduleStyleRecalculationImpl(InstrumentingAgents*, Document*); - - static void applyEmulatedMediaImpl(InstrumentingAgents*, String*); - static void willSendRequestImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse); - static void continueAfterPingLoaderImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&); - static void markResourceAsCachedImpl(InstrumentingAgents*, unsigned long identifier); - static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents*, DocumentLoader*, CachedResource*); - static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents*, unsigned long identifier, Frame*, int length); - static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&); - static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Frame*); - static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); - static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); - static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); - static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); - static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); - static void didReceiveDataImpl(InstrumentingAgents*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength); - static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, double finishTime); - static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, const ResourceError&); - static void documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents*, unsigned long identifier, ThreadableLoaderClient*); - static void willLoadXHRImpl(InstrumentingAgents*, ThreadableLoaderClient*, const String&, const URL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool); - static void didFailXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*); - static void didFinishXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber); - static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier); - static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*); - static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*); - static void scriptImportedImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString); - static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents*, const String& directiveText); - static void didReceiveScriptResponseImpl(InstrumentingAgents*, unsigned long identifier); - static void domContentLoadedEventFiredImpl(InstrumentingAgents*, Frame*); - static void loadEventFiredImpl(InstrumentingAgents*, Frame*); - static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*); - static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*); - static void frameDocumentUpdatedImpl(InstrumentingAgents*, Frame*); - static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*); + static void didScheduleStyleRecalculationImpl(InstrumentingAgents&, Document&); + + static void applyEmulatedMediaImpl(InstrumentingAgents&, String&); + static void willSendRequestImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse); + static void continueAfterPingLoaderImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&); + static void markResourceAsCachedImpl(InstrumentingAgents&, unsigned long identifier); + static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents&, DocumentLoader*, CachedResource*); + static void didReceiveResourceResponseImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); + static void didReceiveThreadableLoaderResponseImpl(InstrumentingAgents&, DocumentThreadableLoader&, unsigned long identifier); + static void didReceiveDataImpl(InstrumentingAgents&, unsigned long identifier, const char* data, int dataLength, int encodedDataLength); + static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, double finishTime); + static void didFailLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceError&); + static void didFinishXHRLoadingImpl(InstrumentingAgents&, unsigned long identifier, std::optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber); + static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&); + static void didLoadXHRSynchronouslyImpl(InstrumentingAgents&); + static void scriptImportedImpl(InstrumentingAgents&, unsigned long identifier, const String& sourceString); + static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents&, const String& directiveText); + static void didReceiveScriptResponseImpl(InstrumentingAgents&, unsigned long identifier); + static void domContentLoadedEventFiredImpl(InstrumentingAgents&, Frame&); + static void loadEventFiredImpl(InstrumentingAgents&, Frame*); + static void frameDetachedFromParentImpl(InstrumentingAgents&, Frame&); + static void didCommitLoadImpl(InstrumentingAgents&, Frame&, DocumentLoader*); + static void frameDocumentUpdatedImpl(InstrumentingAgents&, Frame&); + static void loaderDetachedFromFrameImpl(InstrumentingAgents&, DocumentLoader&); static void frameStartedLoadingImpl(InstrumentingAgents&, Frame&); static void frameStoppedLoadingImpl(InstrumentingAgents&, Frame&); static void frameScheduledNavigationImpl(InstrumentingAgents&, Frame&, double delay); static void frameClearedScheduledNavigationImpl(InstrumentingAgents&, Frame&); - static InspectorInstrumentationCookie willRunJavaScriptDialogImpl(InstrumentingAgents*, const String& message); - static void didRunJavaScriptDialogImpl(const InspectorInstrumentationCookie&); - static void willDestroyCachedResourceImpl(CachedResource*); + static void willDestroyCachedResourceImpl(CachedResource&); + + static void addMessageToConsoleImpl(InstrumentingAgents&, std::unique_ptr<Inspector::ConsoleMessage>); - static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents*, unsigned startLine, Frame*); - static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned endLine); + static void consoleCountImpl(InstrumentingAgents&, JSC::ExecState*, Ref<Inspector::ScriptArguments>&&); + static void takeHeapSnapshotImpl(InstrumentingAgents&, const String& title); + static void startConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title); + static void startConsoleTimingImpl(InstrumentingAgents&, const String& title); + static void stopConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title, Ref<Inspector::ScriptCallStack>&&); + static void stopConsoleTimingImpl(InstrumentingAgents&, const String& title, Ref<Inspector::ScriptCallStack>&&); + static void consoleTimeStampImpl(InstrumentingAgents&, Frame&, Ref<Inspector::ScriptArguments>&&); - static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, JSC::ExecState*, PassRefPtr<ScriptArguments>, unsigned long requestIdentifier); - static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState*, unsigned long requestIdentifier); + static void didRequestAnimationFrameImpl(InstrumentingAgents&, int callbackId, Frame*); + static void didCancelAnimationFrameImpl(InstrumentingAgents&, int callbackId, Frame*); + static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents&, int callbackId, Frame*); + static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&); - // FIXME: Remove once we no longer generate stacks outside of Inspector. - static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier); + static void startProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title); + static void stopProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title); - static void consoleCountImpl(InstrumentingAgents*, JSC::ExecState*, PassRefPtr<ScriptArguments>); - static void startConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title); - static void stopConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title, PassRefPtr<ScriptCallStack>); - static void consoleTimeStampImpl(InstrumentingAgents*, Frame*, PassRefPtr<ScriptArguments>); + static void didOpenDatabaseImpl(InstrumentingAgents&, RefPtr<Database>&&, const String& domain, const String& name, const String& version); - static void didRequestAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*); - static void didCancelAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*); - static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*); - static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&); + static void didDispatchDOMStorageEventImpl(InstrumentingAgents&, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*); - static void addStartProfilingMessageToConsoleImpl(InstrumentingAgents*, const String& title, unsigned lineNumber, unsigned columnNumber, const String& sourceURL); - static void addProfileImpl(InstrumentingAgents*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>); - static String getCurrentUserInitiatedProfileNameImpl(InstrumentingAgents*, bool incrementProfileNumber); - static bool profilerEnabledImpl(InstrumentingAgents*); + static bool shouldWaitForDebuggerOnStartImpl(InstrumentingAgents&); + static void workerStartedImpl(InstrumentingAgents&, WorkerInspectorProxy*, const URL&); + static void workerTerminatedImpl(InstrumentingAgents&, WorkerInspectorProxy*); -#if ENABLE(SQL_DATABASE) - static void didOpenDatabaseImpl(InstrumentingAgents*, PassRefPtr<Database>, const String& domain, const String& name, const String& version); -#endif +#if ENABLE(WEB_REPLAY) + static void sessionCreatedImpl(InstrumentingAgents&, RefPtr<ReplaySession>&&); + static void sessionLoadedImpl(InstrumentingAgents&, RefPtr<ReplaySession>&&); + static void sessionModifiedImpl(InstrumentingAgents&, RefPtr<ReplaySession>&&); - static void didDispatchDOMStorageEventImpl(InstrumentingAgents*, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*); + static void segmentCreatedImpl(InstrumentingAgents&, RefPtr<ReplaySessionSegment>&&); + static void segmentCompletedImpl(InstrumentingAgents&, RefPtr<ReplaySessionSegment>&&); + static void segmentLoadedImpl(InstrumentingAgents&, RefPtr<ReplaySessionSegment>&&); + static void segmentUnloadedImpl(InstrumentingAgents&); - static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents*); - static void didStartWorkerGlobalScopeImpl(InstrumentingAgents*, WorkerGlobalScopeProxy*, const URL&); - static void workerGlobalScopeTerminatedImpl(InstrumentingAgents*, WorkerGlobalScopeProxy*); + static void captureStartedImpl(InstrumentingAgents&); + static void captureStoppedImpl(InstrumentingAgents&); + + static void playbackStartedImpl(InstrumentingAgents&); + static void playbackPausedImpl(InstrumentingAgents&, const ReplayPosition&); + static void playbackHitPositionImpl(InstrumentingAgents&, const ReplayPosition&); + static void playbackFinishedImpl(InstrumentingAgents&); +#endif #if ENABLE(WEB_SOCKETS) - static void didCreateWebSocketImpl(InstrumentingAgents*, unsigned long identifier, const URL& requestURL, const URL& documentURL, const String& protocol, Document*); - static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents*, unsigned long identifier, const ResourceRequest&, Document*); - static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Document*); - static void didCloseWebSocketImpl(InstrumentingAgents*, unsigned long identifier, Document*); - static void didReceiveWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&); - static void didSendWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&); - static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents*, unsigned long identifier, const String&); + static void didCreateWebSocketImpl(InstrumentingAgents&, unsigned long identifier, const URL& requestURL); + static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents&, unsigned long identifier, const ResourceRequest&); + static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents&, unsigned long identifier, const ResourceResponse&); + static void didCloseWebSocketImpl(InstrumentingAgents&, unsigned long identifier); + static void didReceiveWebSocketFrameImpl(InstrumentingAgents&, unsigned long identifier, const WebSocketFrame&); + static void didSendWebSocketFrameImpl(InstrumentingAgents&, unsigned long identifier, const WebSocketFrame&); + static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents&, unsigned long identifier, const String&); #endif - static void networkStateChangedImpl(InstrumentingAgents*); - static void updateApplicationCacheStatusImpl(InstrumentingAgents*, Frame*); +#if ENABLE(RESOURCE_USAGE) + static void didHandleMemoryPressureImpl(InstrumentingAgents&, Critical); +#endif - static InstrumentingAgents* instrumentingAgentsForPage(Page*); + static void networkStateChangedImpl(InstrumentingAgents&); + static void updateApplicationCacheStatusImpl(InstrumentingAgents&, Frame&); + + static void layerTreeDidChangeImpl(InstrumentingAgents&); + static void renderLayerDestroyedImpl(InstrumentingAgents&, const RenderLayer&); + + static InstrumentingAgents& instrumentingAgentsForPage(Page&); + static InstrumentingAgents& instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope&); + + static InstrumentingAgents* instrumentingAgentsForFrame(Frame&); static InstrumentingAgents* instrumentingAgentsForFrame(Frame*); static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*); + static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext&); + static InstrumentingAgents* instrumentingAgentsForDocument(Document&); static InstrumentingAgents* instrumentingAgentsForDocument(Document*); - static InstrumentingAgents* instrumentingAgentsForRenderer(RenderObject*); - + static InstrumentingAgents* instrumentingAgentsForRenderer(RenderObject&); static InstrumentingAgents* instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope*); - static InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ScriptExecutionContext*); - static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, bool isDOMEvent, const String& eventName, bool synchronous); - static void cancelPauseOnNativeEvent(InstrumentingAgents*); static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&); -#if USE(ACCELERATED_COMPOSITING) - static void layerTreeDidChangeImpl(InstrumentingAgents*); - static void renderLayerDestroyedImpl(InstrumentingAgents*, const RenderLayer*); - static void pseudoElementDestroyedImpl(InstrumentingAgents*, PseudoElement*); -#endif + static void pauseOnNativeEventIfNeeded(InstrumentingAgents&, bool isDOMEvent, const String& eventName, bool synchronous); - static int s_frontendCounter; -#endif + WEBCORE_EXPORT static int s_frontendCounter; }; -inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld& world) +inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame& frame, DOMWrapperWorld& world) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - didClearWindowObjectInWorldImpl(instrumentingAgents, frame, world); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(world); -#endif + didClearWindowObjectInWorldImpl(*instrumentingAgents, frame, world); } inline bool InspectorInstrumentation::isDebuggerPaused(Frame* frame) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(false); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - return isDebuggerPausedImpl(instrumentingAgents); -#else - UNUSED_PARAM(frame); -#endif + return isDebuggerPausedImpl(*instrumentingAgents); return false; } -inline void InspectorInstrumentation::willInsertDOMNode(Document* document, Node* parent) +inline void InspectorInstrumentation::willInsertDOMNode(Document& document, Node& parent) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - willInsertDOMNodeImpl(instrumentingAgents, parent); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(parent); -#endif + willInsertDOMNodeImpl(*instrumentingAgents, parent); } -inline void InspectorInstrumentation::didInsertDOMNode(Document* document, Node* node) +inline void InspectorInstrumentation::didInsertDOMNode(Document& document, Node& node) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didInsertDOMNodeImpl(instrumentingAgents, node); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(node); -#endif + didInsertDOMNodeImpl(*instrumentingAgents, node); } -inline void InspectorInstrumentation::willRemoveDOMNode(Document* document, Node* node) +inline void InspectorInstrumentation::willRemoveDOMNode(Document& document, Node& node) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - willRemoveDOMNodeImpl(instrumentingAgents, node); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(node); -#endif + willRemoveDOMNodeImpl(*instrumentingAgents, node); } -inline void InspectorInstrumentation::didRemoveDOMNode(Document* document, Node* node) +inline void InspectorInstrumentation::didRemoveDOMNode(Document& document, Node& node) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didRemoveDOMNodeImpl(instrumentingAgents, node); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(node); -#endif + didRemoveDOMNodeImpl(*instrumentingAgents, node); } -inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element, const AtomicString& oldValue, const AtomicString& newValue) +inline void InspectorInstrumentation::willModifyDOMAttr(Document& document, Element& element, const AtomicString& oldValue, const AtomicString& newValue) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - willModifyDOMAttrImpl(instrumentingAgents, element, oldValue, newValue); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(element); - UNUSED_PARAM(oldValue); - UNUSED_PARAM(newValue); -#endif + willModifyDOMAttrImpl(*instrumentingAgents, element, oldValue, newValue); } -inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element, const AtomicString& name, const AtomicString& value) +inline void InspectorInstrumentation::didModifyDOMAttr(Document& document, Element& element, const AtomicString& name, const AtomicString& value) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didModifyDOMAttrImpl(instrumentingAgents, element, name, value); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(element); - UNUSED_PARAM(name); - UNUSED_PARAM(value); -#endif + didModifyDOMAttrImpl(*instrumentingAgents, element, name, value); } -inline void InspectorInstrumentation::didRemoveDOMAttr(Document* document, Element* element, const AtomicString& name) +inline void InspectorInstrumentation::didRemoveDOMAttr(Document& document, Element& element, const AtomicString& name) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didRemoveDOMAttrImpl(instrumentingAgents, element, name); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(element); - UNUSED_PARAM(name); -#endif + didRemoveDOMAttrImpl(*instrumentingAgents, element, name); } -inline void InspectorInstrumentation::didInvalidateStyleAttr(Document* document, Node* node) +inline void InspectorInstrumentation::didInvalidateStyleAttr(Document& document, Node& node) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didInvalidateStyleAttrImpl(instrumentingAgents, node); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(node); -#endif + didInvalidateStyleAttrImpl(*instrumentingAgents, node); +} + +inline void InspectorInstrumentation::documentDetached(Document& document) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) + documentDetachedImpl(*instrumentingAgents, document); } -inline void InspectorInstrumentation::frameWindowDiscarded(Frame* frame, DOMWindow* domWindow) +inline void InspectorInstrumentation::frameWindowDiscarded(Frame& frame, DOMWindow* domWindow) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - frameWindowDiscardedImpl(instrumentingAgents, domWindow); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(domWindow); -#endif + frameWindowDiscardedImpl(*instrumentingAgents, domWindow); } -inline void InspectorInstrumentation::mediaQueryResultChanged(Document* document) +inline void InspectorInstrumentation::mediaQueryResultChanged(Document& document) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - mediaQueryResultChangedImpl(instrumentingAgents); -#else - UNUSED_PARAM(document); -#endif + mediaQueryResultChangedImpl(*instrumentingAgents); } -inline void InspectorInstrumentation::didPushShadowRoot(Element* host, ShadowRoot* root) +inline void InspectorInstrumentation::activeStyleSheetsUpdated(Document& document) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(&host->document())) - didPushShadowRootImpl(instrumentingAgents, host, root); -#else - UNUSED_PARAM(host); - UNUSED_PARAM(root); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) + activeStyleSheetsUpdatedImpl(*instrumentingAgents, document); } -inline void InspectorInstrumentation::willPopShadowRoot(Element* host, ShadowRoot* root) +inline void InspectorInstrumentation::didPushShadowRoot(Element& host, ShadowRoot& root) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(&host->document())) - willPopShadowRootImpl(instrumentingAgents, host, root); -#else - UNUSED_PARAM(host); - UNUSED_PARAM(root); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host.document())) + didPushShadowRootImpl(*instrumentingAgents, host, root); } -inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow) +inline void InspectorInstrumentation::willPopShadowRoot(Element& host, ShadowRoot& root) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didCreateNamedFlowImpl(instrumentingAgents, document, namedFlow); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(namedFlow); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host.document())) + willPopShadowRootImpl(*instrumentingAgents, host, root); +} + +inline void InspectorInstrumentation::didChangeCustomElementState(Element& element) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(element.document())) + didChangeCustomElementStateImpl(*instrumentingAgents, element); +} + +inline void InspectorInstrumentation::pseudoElementCreated(Page* page, PseudoElement& pseudoElement) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) + pseudoElementCreatedImpl(*instrumentingAgents, pseudoElement); +} + +inline void InspectorInstrumentation::pseudoElementDestroyed(Page* page, PseudoElement& pseudoElement) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) + pseudoElementDestroyedImpl(*instrumentingAgents, pseudoElement); } -inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow) +inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow& namedFlow) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - willRemoveNamedFlowImpl(instrumentingAgents, document, namedFlow); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(namedFlow); -#endif + didCreateNamedFlowImpl(*instrumentingAgents, document, namedFlow); } -inline void InspectorInstrumentation::didUpdateRegionLayout(Document* document, WebKitNamedFlow* namedFlow) +inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow& namedFlow) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didUpdateRegionLayoutImpl(instrumentingAgents, document, namedFlow); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(namedFlow); -#endif + willRemoveNamedFlowImpl(*instrumentingAgents, document, namedFlow); } -inline void InspectorInstrumentation::didChangeRegionOverset(Document* document, WebKitNamedFlow* namedFlow) +inline void InspectorInstrumentation::didChangeRegionOverset(Document& document, WebKitNamedFlow& namedFlow) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didChangeRegionOversetImpl(instrumentingAgents, document, namedFlow); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(namedFlow); -#endif + didChangeRegionOversetImpl(*instrumentingAgents, document, namedFlow); } -inline void InspectorInstrumentation::didRegisterNamedFlowContentElement(Document* document, WebKitNamedFlow* namedFlow, Node* contentElement, Node* nextContentElement) +inline void InspectorInstrumentation::didRegisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement, Node* nextContentElement) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didRegisterNamedFlowContentElementImpl(instrumentingAgents, document, namedFlow, contentElement, nextContentElement); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(namedFlow); - UNUSED_PARAM(contentElement); - UNUSED_PARAM(nextContentElement); -#endif + didRegisterNamedFlowContentElementImpl(*instrumentingAgents, document, namedFlow, contentElement, nextContentElement); } -inline void InspectorInstrumentation::didUnregisterNamedFlowContentElement(Document* document, WebKitNamedFlow* namedFlow, Node* contentElement) +inline void InspectorInstrumentation::didUnregisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didUnregisterNamedFlowContentElementImpl(instrumentingAgents, document, namedFlow, contentElement); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(namedFlow); - UNUSED_PARAM(contentElement); -#endif + didUnregisterNamedFlowContentElementImpl(*instrumentingAgents, document, namedFlow, contentElement); } -inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const HitTestResult& result, unsigned modifierFlags) +inline void InspectorInstrumentation::mouseDidMoveOverElement(Page& page, const HitTestResult& result, unsigned modifierFlags) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - mouseDidMoveOverElementImpl(instrumentingAgents, result, modifierFlags); -#else - UNUSED_PARAM(page); - UNUSED_PARAM(result); - UNUSED_PARAM(modifierFlags); -#endif + mouseDidMoveOverElementImpl(instrumentingAgentsForPage(page), result, modifierFlags); } -inline bool InspectorInstrumentation::handleTouchEvent(Page* page, Node* node) +inline bool InspectorInstrumentation::handleTouchEvent(Frame& frame, Node& node) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(false); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - return handleTouchEventImpl(instrumentingAgents, node); -#else - UNUSED_PARAM(page); - UNUSED_PARAM(node); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + return handleTouchEventImpl(*instrumentingAgents, node); return false; } -inline bool InspectorInstrumentation::handleMousePress(Page* page) +inline bool InspectorInstrumentation::handleMousePress(Frame& frame) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(false); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - return handleMousePressImpl(instrumentingAgents); -#else - UNUSED_PARAM(page); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + return handleMousePressImpl(*instrumentingAgents); return false; } -inline bool InspectorInstrumentation::forcePseudoState(Element* element, CSSSelector::PseudoType pseudoState) +inline bool InspectorInstrumentation::forcePseudoState(const Element& element, CSSSelector::PseudoClassType pseudoState) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(false); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(&element->document())) - return forcePseudoStateImpl(instrumentingAgents, element, pseudoState); -#else - UNUSED_PARAM(element); - UNUSED_PARAM(pseudoState); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(element.document())) + return forcePseudoStateImpl(*instrumentingAgents, element, pseudoState); return false; } -inline void InspectorInstrumentation::characterDataModified(Document* document, CharacterData* characterData) +inline void InspectorInstrumentation::characterDataModified(Document& document, CharacterData& characterData) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - characterDataModifiedImpl(instrumentingAgents, characterData); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(characterData); -#endif + characterDataModifiedImpl(*instrumentingAgents, characterData); } inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionContext* context, const String& url) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - willSendXMLHttpRequestImpl(instrumentingAgents, url); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(url); -#endif + willSendXMLHttpRequestImpl(*instrumentingAgents, url); } -inline void InspectorInstrumentation::didScheduleResourceRequest(Document* document, const String& url) +inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext& context, int timerId, std::chrono::milliseconds timeout, bool singleShot) { -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didScheduleResourceRequestImpl(instrumentingAgents, url, document->frame()); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(url); -#endif -} - -inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot) -{ -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didInstallTimerImpl(instrumentingAgents, timerId, timeout, singleShot, context); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(timerId); - UNUSED_PARAM(timeout); - UNUSED_PARAM(singleShot); -#endif + didInstallTimerImpl(*instrumentingAgents, timerId, timeout, singleShot, context); } -inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* context, int timerId) +inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext& context, int timerId) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didRemoveTimerImpl(instrumentingAgents, timerId, context); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(timerId); -#endif + didRemoveTimerImpl(*instrumentingAgents, timerId, context); } inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - return willCallFunctionImpl(instrumentingAgents, scriptName, scriptLine, context); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(scriptName); - UNUSED_PARAM(scriptLine); -#endif + return willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, context); return InspectorInstrumentationCookie(); } - -inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie) +inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumentationCookie& cookie, ScriptExecutionContext* context) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (cookie.isValid()) - didCallFunctionImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif + didCallFunctionImpl(cookie, context); } -inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext* context, XMLHttpRequest* request) +inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document& document, const Event& event, bool hasEventListeners) { -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - return willDispatchXHRReadyStateChangeEventImpl(instrumentingAgents, request, context); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(request); -#endif - return InspectorInstrumentationCookie(); -} - -inline void InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie& cookie) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (cookie.isValid()) - didDispatchXHRReadyStateChangeEventImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif -} - -inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, bool hasEventListeners) -{ -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - return willDispatchEventImpl(instrumentingAgents, event, hasEventListeners, document); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(event); - UNUSED_PARAM(hasEventListeners); -#endif + return willDispatchEventImpl(*instrumentingAgents, document, event, hasEventListeners); return InspectorInstrumentationCookie(); } inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrumentationCookie& cookie) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (cookie.isValid()) didDispatchEventImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif -} - -inline InspectorInstrumentationCookie InspectorInstrumentation::willHandleEvent(ScriptExecutionContext* context, Event* event) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - return willHandleEventImpl(instrumentingAgents, event); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(event); -#endif - return InspectorInstrumentationCookie(); } -inline void InspectorInstrumentation::didHandleEvent(const InspectorInstrumentationCookie& cookie) +inline void InspectorInstrumentation::willHandleEvent(ScriptExecutionContext* context, const Event& event) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (cookie.isValid()) - didHandleEventImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) + return willHandleEventImpl(*instrumentingAgents, event); } -inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window) +inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow& window) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - return willDispatchEventOnWindowImpl(instrumentingAgents, event, window); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(event); - UNUSED_PARAM(window); -#endif + return willDispatchEventOnWindowImpl(*instrumentingAgents, event, window); return InspectorInstrumentationCookie(); } inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorInstrumentationCookie& cookie) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (cookie.isValid()) didDispatchEventOnWindowImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif } -inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame* frame, const String& url, int lineNumber) +inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - return willEvaluateScriptImpl(instrumentingAgents, url, lineNumber, frame); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(url); - UNUSED_PARAM(lineNumber); -#endif + return willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber); return InspectorInstrumentationCookie(); } -inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie) +inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie, Frame& frame) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (cookie.isValid()) - didEvaluateScriptImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif -} - -inline void InspectorInstrumentation::scriptsEnabled(Page* page, bool isEnabled) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - return scriptsEnabledImpl(instrumentingAgents, isEnabled); -#else - UNUSED_PARAM(page); - UNUSED_PARAM(isEnabled); -#endif + didEvaluateScriptImpl(cookie, frame); } -inline void InspectorInstrumentation::didCreateIsolatedContext(Frame* frame, JSC::ExecState* scriptState, SecurityOrigin* origin) +inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext& context, int timerId) { -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - return didCreateIsolatedContextImpl(instrumentingAgents, frame, scriptState, origin); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(scriptState); - UNUSED_PARAM(origin); -#endif -} - -inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId) -{ -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - return willFireTimerImpl(instrumentingAgents, timerId, context); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(timerId); -#endif + return willFireTimerImpl(*instrumentingAgents, timerId, context); return InspectorInstrumentationCookie(); } inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentationCookie& cookie) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (cookie.isValid()) didFireTimerImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif } -inline void InspectorInstrumentation::didInvalidateLayout(Frame* frame) +inline void InspectorInstrumentation::didInvalidateLayout(Frame& frame) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - didInvalidateLayoutImpl(instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif + didInvalidateLayoutImpl(*instrumentingAgents, frame); } -inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame) +inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame& frame) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - return willLayoutImpl(instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif + return willLayoutImpl(*instrumentingAgents, frame); return InspectorInstrumentationCookie(); } -inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie, RenderObject* root) +inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie, RenderObject& root) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (cookie.isValid()) didLayoutImpl(cookie, root); -#else - UNUSED_PARAM(cookie); - UNUSED_PARAM(root); -#endif } -inline void InspectorInstrumentation::didScroll(Page* page) +inline void InspectorInstrumentation::didScroll(Page& page) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - didScrollImpl(instrumentingAgents); -#else - UNUSED_PARAM(page); -#endif + didScrollImpl(instrumentingAgentsForPage(page)); } -inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest* request) +inline void InspectorInstrumentation::willComposite(Frame& frame) { -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - return willDispatchXHRLoadEventImpl(instrumentingAgents, request, context); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(request); -#endif - return InspectorInstrumentationCookie(); -} - -inline void InspectorInstrumentation::didDispatchXHRLoadEvent(const InspectorInstrumentationCookie& cookie) -{ -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (cookie.isValid()) - didDispatchXHRLoadEventImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + willCompositeImpl(*instrumentingAgents, frame); } -inline void InspectorInstrumentation::willPaint(RenderObject* renderer) +inline void InspectorInstrumentation::didComposite(Frame& frame) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer)) - return willPaintImpl(instrumentingAgents, renderer); -#else - UNUSED_PARAM(renderer); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + didCompositeImpl(*instrumentingAgents); } -inline void InspectorInstrumentation::didPaint(RenderObject* renderer, GraphicsContext* context, const LayoutRect& rect) +inline void InspectorInstrumentation::willPaint(RenderObject& renderer) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer)) - didPaintImpl(instrumentingAgents, renderer, context, rect); -#else - UNUSED_PARAM(renderer); - UNUSED_PARAM(context); - UNUSED_PARAM(rect); -#endif + return willPaintImpl(*instrumentingAgents, renderer); } -inline void InspectorInstrumentation::willScrollLayer(Frame* frame) +inline void InspectorInstrumentation::didPaint(RenderObject& renderer, const LayoutRect& rect) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - willScrollLayerImpl(instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif -} - -inline void InspectorInstrumentation::didScrollLayer(Frame* frame) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - didScrollLayerImpl(instrumentingAgents); -#else - UNUSED_PARAM(frame); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer)) + didPaintImpl(*instrumentingAgents, renderer, rect); } -inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document) +inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document& document) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - return willRecalculateStyleImpl(instrumentingAgents, document->frame()); -#else - UNUSED_PARAM(document); -#endif + return willRecalculateStyleImpl(*instrumentingAgents, document); return InspectorInstrumentationCookie(); } inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrumentationCookie& cookie) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (cookie.isValid()) didRecalculateStyleImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif } -inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document* document) +inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document& document) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didScheduleStyleRecalculationImpl(instrumentingAgents, document); -#else - UNUSED_PARAM(document); -#endif + didScheduleStyleRecalculationImpl(*instrumentingAgents, document); } -inline void InspectorInstrumentation::applyEmulatedMedia(Frame* frame, String* media) +inline void InspectorInstrumentation::applyEmulatedMedia(Frame& frame, String& media) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - applyEmulatedMediaImpl(instrumentingAgents, media); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(media); -#endif + applyEmulatedMediaImpl(*instrumentingAgents, media); } inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - willSendRequestImpl(instrumentingAgents, identifier, loader, request, redirectResponse); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(identifier); - UNUSED_PARAM(loader); - UNUSED_PARAM(request); - UNUSED_PARAM(redirectResponse); -#endif + willSendRequestImpl(*instrumentingAgents, identifier, loader, request, redirectResponse); } -inline void InspectorInstrumentation::continueAfterPingLoader(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response) +inline void InspectorInstrumentation::continueAfterPingLoader(Frame& frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - InspectorInstrumentation::continueAfterPingLoaderImpl(instrumentingAgents, identifier, loader, request, response); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(identifier); - UNUSED_PARAM(loader); - UNUSED_PARAM(request); - UNUSED_PARAM(response); -#endif + InspectorInstrumentation::continueAfterPingLoaderImpl(*instrumentingAgents, identifier, loader, request, response); } -inline void InspectorInstrumentation::markResourceAsCached(Page* page, unsigned long identifier) +inline void InspectorInstrumentation::markResourceAsCached(Page& page, unsigned long identifier) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - markResourceAsCachedImpl(instrumentingAgents, identifier); -#else - UNUSED_PARAM(page); - UNUSED_PARAM(identifier); -#endif + markResourceAsCachedImpl(instrumentingAgentsForPage(page), identifier); } -inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, CachedResource* resource) +inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page& page, DocumentLoader* loader, CachedResource* resource) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - didLoadResourceFromMemoryCacheImpl(instrumentingAgents, loader, resource); -#else - UNUSED_PARAM(page); - UNUSED_PARAM(loader); - UNUSED_PARAM(resource); -#endif + didLoadResourceFromMemoryCacheImpl(instrumentingAgentsForPage(page), loader, resource); } -inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceData(Frame* frame, unsigned long identifier, int length) +inline void InspectorInstrumentation::didReceiveResourceResponse(Frame& frame, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader) { -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - return willReceiveResourceDataImpl(instrumentingAgents, identifier, frame, length); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(identifier); - UNUSED_PARAM(length); -#endif - return InspectorInstrumentationCookie(); + didReceiveResourceResponseImpl(*instrumentingAgents, identifier, loader, response, resourceLoader); } -inline void InspectorInstrumentation::didReceiveResourceData(const InspectorInstrumentationCookie& cookie) +inline void InspectorInstrumentation::didReceiveThreadableLoaderResponse(DocumentThreadableLoader& documentThreadableLoader, unsigned long identifier) { -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (cookie.isValid()) - didReceiveResourceDataImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(documentThreadableLoader.document())) + didReceiveThreadableLoaderResponseImpl(*instrumentingAgents, documentThreadableLoader, identifier); } - -inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponse(Frame* frame, unsigned long identifier, const ResourceResponse& response) -{ -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - return willReceiveResourceResponseImpl(instrumentingAgents, identifier, response, frame); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(identifier); - UNUSED_PARAM(response); -#endif - return InspectorInstrumentationCookie(); -} - -inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader) -{ -#if ENABLE(INSPECTOR) - // Call this unconditionally so that we're able to log to console with no front-end attached. - if (cookie.isValid()) - didReceiveResourceResponseImpl(cookie, identifier, loader, response, resourceLoader); -#else - UNUSED_PARAM(cookie); - UNUSED_PARAM(identifier); - UNUSED_PARAM(loader); - UNUSED_PARAM(response); - UNUSED_PARAM(resourceLoader); -#endif -} - -inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(frame, loader, identifier, r); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(loader); - UNUSED_PARAM(identifier); - UNUSED_PARAM(r); -#endif -} - -inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - InspectorInstrumentation::continueWithPolicyDownloadImpl(frame, loader, identifier, r); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(loader); - UNUSED_PARAM(identifier); - UNUSED_PARAM(r); -#endif -} - -inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - InspectorInstrumentation::continueWithPolicyIgnoreImpl(frame, loader, identifier, r); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(loader); - UNUSED_PARAM(identifier); - UNUSED_PARAM(r); -#endif -} - + inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long identifier, const char* data, int dataLength, int encodedDataLength) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - didReceiveDataImpl(instrumentingAgents, identifier, data, dataLength, encodedDataLength); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(identifier); - UNUSED_PARAM(data); - UNUSED_PARAM(dataLength); - UNUSED_PARAM(encodedDataLength); -#endif + didReceiveDataImpl(*instrumentingAgents, identifier, data, dataLength, encodedDataLength); } inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, double finishTime) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - didFinishLoadingImpl(instrumentingAgents, identifier, loader, finishTime); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(loader); - UNUSED_PARAM(identifier); - UNUSED_PARAM(finishTime); -#endif + didFinishLoadingImpl(*instrumentingAgents, identifier, loader, finishTime); } inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - didFailLoadingImpl(instrumentingAgents, identifier, loader, error); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(loader); - UNUSED_PARAM(identifier); - UNUSED_PARAM(error); -#endif + didFailLoadingImpl(*instrumentingAgents, identifier, loader, error); } -inline void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext* context, unsigned long identifier, ThreadableLoaderClient* client) +inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame& frame, unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - documentThreadableLoaderStartedLoadingForClientImpl(instrumentingAgents, identifier, client); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(identifier); - UNUSED_PARAM(client); -#endif -} - -inline void InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* context, ThreadableLoaderClient* client, const String& method, const URL& url, bool async, PassRefPtr<FormData> formData, const HTTPHeaderMap& headers, bool includeCredentials) -{ -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - willLoadXHRImpl(instrumentingAgents, client, method, url, async, formData, headers, includeCredentials); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(client); - UNUSED_PARAM(method); - UNUSED_PARAM(url); - UNUSED_PARAM(async); - UNUSED_PARAM(formData); - UNUSED_PARAM(headers); - UNUSED_PARAM(includeCredentials); -#endif + // Treat the same as didReceiveResponse. + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + didReceiveResourceResponseImpl(*instrumentingAgents, identifier, &loader, response, nullptr); } -inline void InspectorInstrumentation::didFailXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client) +inline void InspectorInstrumentation::continueWithPolicyDownload(Frame& frame, unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didFailXHRLoadingImpl(instrumentingAgents, client); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(client); -#endif + // Treat the same as didReceiveResponse. + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + didReceiveResourceResponseImpl(*instrumentingAgents, identifier, &loader, response, nullptr); } - -inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber) +inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame& frame, unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didFinishXHRLoadingImpl(instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber, sendColumnNumber); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(client); - UNUSED_PARAM(identifier); - UNUSED_PARAM(sourceString); - UNUSED_PARAM(url); - UNUSED_PARAM(sendURL); - UNUSED_PARAM(sendLineNumber); -#endif + // Treat the same as didReceiveResponse. + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + didReceiveResourceResponseImpl(*instrumentingAgents, identifier, &loader, response, nullptr); } -inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionContext* context, unsigned long identifier) +inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, unsigned long identifier, std::optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didReceiveXHRResponseImpl(instrumentingAgents, identifier); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(identifier); -#endif + didFinishXHRLoadingImpl(*instrumentingAgents, identifier, decodedText, url, sendURL, sendLineNumber, sendColumnNumber); } inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - willLoadXHRSynchronouslyImpl(instrumentingAgents); -#else - UNUSED_PARAM(context); -#endif + willLoadXHRSynchronouslyImpl(*instrumentingAgents); } inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didLoadXHRSynchronouslyImpl(instrumentingAgents); -#else - UNUSED_PARAM(context); -#endif + didLoadXHRSynchronouslyImpl(*instrumentingAgents); } -inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString) +inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext& context, unsigned long identifier, const String& sourceString) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - scriptImportedImpl(instrumentingAgents, identifier, sourceString); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(identifier); - UNUSED_PARAM(sourceString); -#endif + scriptImportedImpl(*instrumentingAgents, identifier, sourceString); } inline void InspectorInstrumentation::scriptExecutionBlockedByCSP(ScriptExecutionContext* context, const String& directiveText) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - scriptExecutionBlockedByCSPImpl(instrumentingAgents, directiveText); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(directiveText); -#endif + scriptExecutionBlockedByCSPImpl(*instrumentingAgents, directiveText); } inline void InspectorInstrumentation::didReceiveScriptResponse(ScriptExecutionContext* context, unsigned long identifier) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didReceiveScriptResponseImpl(instrumentingAgents, identifier); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(identifier); -#endif + didReceiveScriptResponseImpl(*instrumentingAgents, identifier); } -inline void InspectorInstrumentation::domContentLoadedEventFired(Frame* frame) +inline void InspectorInstrumentation::domContentLoadedEventFired(Frame& frame) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - domContentLoadedEventFiredImpl(instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif + domContentLoadedEventFiredImpl(*instrumentingAgents, frame); } inline void InspectorInstrumentation::loadEventFired(Frame* frame) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - loadEventFiredImpl(instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif + loadEventFiredImpl(*instrumentingAgents, frame); } -inline void InspectorInstrumentation::frameDetachedFromParent(Frame* frame) +inline void InspectorInstrumentation::frameDetachedFromParent(Frame& frame) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - frameDetachedFromParentImpl(instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif + frameDetachedFromParentImpl(*instrumentingAgents, frame); } -inline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader) +inline void InspectorInstrumentation::didCommitLoad(Frame& frame, DocumentLoader* loader) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - didCommitLoadImpl(instrumentingAgents, frame->page(), loader); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(loader); -#endif + didCommitLoadImpl(*instrumentingAgents, frame, loader); } -inline void InspectorInstrumentation::frameDocumentUpdated(Frame* frame) +inline void InspectorInstrumentation::frameDocumentUpdated(Frame& frame) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - frameDocumentUpdatedImpl(instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif + frameDocumentUpdatedImpl(*instrumentingAgents, frame); } -inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame* frame, DocumentLoader* loader) +inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame& frame, DocumentLoader& loader) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - loaderDetachedFromFrameImpl(instrumentingAgents, loader); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(loader); -#endif + loaderDetachedFromFrameImpl(*instrumentingAgents, loader); } inline void InspectorInstrumentation::frameStartedLoading(Frame& frame) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame)) + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) frameStartedLoadingImpl(*instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif } inline void InspectorInstrumentation::frameStoppedLoading(Frame& frame) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame)) + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) frameStoppedLoadingImpl(*instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif } inline void InspectorInstrumentation::frameScheduledNavigation(Frame& frame, double delay) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame)) + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) frameScheduledNavigationImpl(*instrumentingAgents, frame, delay); -#else - UNUSED_PARAM(frame); - UNUSED_PARAM(delay); -#endif } inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& frame) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame)) + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) frameClearedScheduledNavigationImpl(*instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif -} - -inline InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialog(Page* page, const String& message) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - return willRunJavaScriptDialogImpl(instrumentingAgents, message); -#else - UNUSED_PARAM(page); - UNUSED_PARAM(message); -#endif - return InspectorInstrumentationCookie(); } -inline void InspectorInstrumentation::didRunJavaScriptDialog(const InspectorInstrumentationCookie& cookie) +inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource& cachedResource) { -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (cookie.isValid()) - didRunJavaScriptDialogImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif -} - -inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource* cachedResource) -{ -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); willDestroyCachedResourceImpl(cachedResource); -#else - UNUSED_PARAM(cachedResource); -#endif -} - -inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Document* document, unsigned startLine) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - return willWriteHTMLImpl(instrumentingAgents, startLine, document->frame()); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(startLine); -#endif - return InspectorInstrumentationCookie(); } -inline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentationCookie& cookie, unsigned endLine) +inline void InspectorInstrumentation::didOpenDatabase(ScriptExecutionContext* context, RefPtr<Database>&& database, const String& domain, const String& name, const String& version) { -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(void()); - if (cookie.isValid()) - didWriteHTMLImpl(cookie, endLine); -#else - UNUSED_PARAM(cookie); - UNUSED_PARAM(endLine); -#endif + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) + didOpenDatabaseImpl(*instrumentingAgents, WTFMove(database), domain, name, version); } -inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page) +inline void InspectorInstrumentation::didDispatchDOMStorageEvent(Page& page, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - didDispatchDOMStorageEventImpl(instrumentingAgents, key, oldValue, newValue, storageType, securityOrigin, page); -#else - UNUSED_PARAM(key); - UNUSED_PARAM(oldValue); - UNUSED_PARAM(newValue); - UNUSED_PARAM(storageType); - UNUSED_PARAM(securityOrigin); - UNUSED_PARAM(page); -#endif // ENABLE(INSPECTOR) + didDispatchDOMStorageEventImpl(instrumentingAgentsForPage(page), key, oldValue, newValue, storageType, securityOrigin); } -inline bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext* context) +inline bool InspectorInstrumentation::shouldWaitForDebuggerOnStart(ScriptExecutionContext& context) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(false); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - return shouldPauseDedicatedWorkerOnStartImpl(instrumentingAgents); -#else - UNUSED_PARAM(context); -#endif + return shouldWaitForDebuggerOnStartImpl(*instrumentingAgents); return false; } -inline void InspectorInstrumentation::didStartWorkerGlobalScope(ScriptExecutionContext* context, WorkerGlobalScopeProxy* proxy, const URL& url) +inline void InspectorInstrumentation::workerStarted(ScriptExecutionContext& context, WorkerInspectorProxy* proxy, const URL& url) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - didStartWorkerGlobalScopeImpl(instrumentingAgents, proxy, url); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(proxy); - UNUSED_PARAM(url); -#endif + workerStartedImpl(*instrumentingAgents, proxy, url); } -inline void InspectorInstrumentation::workerGlobalScopeTerminated(ScriptExecutionContext* context, WorkerGlobalScopeProxy* proxy) +inline void InspectorInstrumentation::workerTerminated(ScriptExecutionContext& context, WorkerInspectorProxy* proxy) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) - workerGlobalScopeTerminatedImpl(instrumentingAgents, proxy); -#else - UNUSED_PARAM(context); - UNUSED_PARAM(proxy); -#endif + workerTerminatedImpl(*instrumentingAgents, proxy); } #if ENABLE(WEB_SOCKETS) -inline void InspectorInstrumentation::didCreateWebSocket(Document* document, unsigned long identifier, const URL& requestURL, const URL& documentURL, const String& protocol) +inline void InspectorInstrumentation::didCreateWebSocket(Document* document, unsigned long identifier, const URL& requestURL) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didCreateWebSocketImpl(instrumentingAgents, identifier, requestURL, documentURL, protocol, document); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(identifier); - UNUSED_PARAM(requestURL); - UNUSED_PARAM(documentURL); - UNUSED_PARAM(protocol); -#endif + didCreateWebSocketImpl(*instrumentingAgents, identifier, requestURL); } inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(Document* document, unsigned long identifier, const ResourceRequest& request) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - willSendWebSocketHandshakeRequestImpl(instrumentingAgents, identifier, request, document); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(identifier); - UNUSED_PARAM(request); -#endif + willSendWebSocketHandshakeRequestImpl(*instrumentingAgents, identifier, request); } inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(Document* document, unsigned long identifier, const ResourceResponse& response) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didReceiveWebSocketHandshakeResponseImpl(instrumentingAgents, identifier, response, document); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(identifier); - UNUSED_PARAM(response); -#endif + didReceiveWebSocketHandshakeResponseImpl(*instrumentingAgents, identifier, response); } inline void InspectorInstrumentation::didCloseWebSocket(Document* document, unsigned long identifier) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didCloseWebSocketImpl(instrumentingAgents, identifier, document); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(identifier); -#endif + didCloseWebSocketImpl(*instrumentingAgents, identifier); } + inline void InspectorInstrumentation::didReceiveWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didReceiveWebSocketFrameImpl(instrumentingAgents, identifier, frame); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(identifier); - UNUSED_PARAM(frame); -#endif + didReceiveWebSocketFrameImpl(*instrumentingAgents, identifier, frame); } + inline void InspectorInstrumentation::didReceiveWebSocketFrameError(Document* document, unsigned long identifier, const String& errorMessage) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didReceiveWebSocketFrameErrorImpl(instrumentingAgents, identifier, errorMessage); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(identifier); - UNUSED_PARAM(errorMessage); -#endif + didReceiveWebSocketFrameErrorImpl(*instrumentingAgents, identifier, errorMessage); } + inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document, unsigned long identifier, const WebSocketFrame& frame) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didSendWebSocketFrameImpl(instrumentingAgents, identifier, frame); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(identifier); - UNUSED_PARAM(frame); -#endif + didSendWebSocketFrameImpl(*instrumentingAgents, identifier, frame); } -#endif +#endif // ENABLE(WEB_SOCKETS) -inline void InspectorInstrumentation::networkStateChanged(Page* page) +#if ENABLE(WEB_REPLAY) +inline void InspectorInstrumentation::sessionCreated(Page& page, RefPtr<ReplaySession>&& session) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - networkStateChangedImpl(instrumentingAgents); -#else - UNUSED_PARAM(page); + sessionCreatedImpl(instrumentingAgentsForPage(page), WTFMove(session)); +} + +inline void InspectorInstrumentation::sessionLoaded(Page& page, RefPtr<ReplaySession>&& session) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + sessionLoadedImpl(instrumentingAgentsForPage(page), WTFMove(session)); +} + +inline void InspectorInstrumentation::sessionModified(Page& page, RefPtr<ReplaySession>&& session) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + sessionModifiedImpl(instrumentingAgentsForPage(page), WTFMove(session)); +} + +inline void InspectorInstrumentation::segmentCreated(Page& page, RefPtr<ReplaySessionSegment>&& segment) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + segmentCreatedImpl(instrumentingAgentsForPage(page), WTFMove(segment)); +} + +inline void InspectorInstrumentation::segmentCompleted(Page& page, RefPtr<ReplaySessionSegment>&& segment) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + segmentCompletedImpl(instrumentingAgentsForPage(page), WTFMove(segment)); +} + +inline void InspectorInstrumentation::segmentLoaded(Page& page, RefPtr<ReplaySessionSegment>&& segment) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + segmentLoadedImpl(instrumentingAgentsForPage(page), WTFMove(segment)); +} + +inline void InspectorInstrumentation::segmentUnloaded(Page& page) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + segmentUnloadedImpl(instrumentingAgentsForPage(page)); +} + +inline void InspectorInstrumentation::captureStarted(Page& page) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + captureStartedImpl(instrumentingAgentsForPage(page)); +} + +inline void InspectorInstrumentation::captureStopped(Page& page) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + captureStoppedImpl(instrumentingAgentsForPage(page)); +} + +inline void InspectorInstrumentation::playbackStarted(Page& page) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + playbackStartedImpl(instrumentingAgentsForPage(page)); +} + +inline void InspectorInstrumentation::playbackPaused(Page& page, const ReplayPosition& position) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + playbackPausedImpl(instrumentingAgentsForPage(page), position); +} + +inline void InspectorInstrumentation::playbackFinished(Page& page) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + playbackFinishedImpl(instrumentingAgentsForPage(page)); +} + +inline void InspectorInstrumentation::playbackHitPosition(Page& page, const ReplayPosition& position) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + playbackHitPositionImpl(instrumentingAgentsForPage(page), position); +} +#endif // ENABLE(WEB_REPLAY) + +#if ENABLE(RESOURCE_USAGE) +inline void InspectorInstrumentation::didHandleMemoryPressure(Page& page, Critical critical) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + didHandleMemoryPressureImpl(instrumentingAgentsForPage(page), critical); +} #endif + +inline void InspectorInstrumentation::networkStateChanged(Page& page) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + networkStateChangedImpl(instrumentingAgentsForPage(page)); } inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); + if (auto* instrumentingAgents = instrumentingAgentsForFrame(frame)) + updateApplicationCacheStatusImpl(*instrumentingAgents, *frame); +} + +inline void InspectorInstrumentation::addMessageToConsole(Page& page, std::unique_ptr<Inspector::ConsoleMessage> message) +{ + addMessageToConsoleImpl(instrumentingAgentsForPage(page), WTFMove(message)); +} + +inline void InspectorInstrumentation::addMessageToConsole(WorkerGlobalScope& workerGlobalScope, std::unique_ptr<Inspector::ConsoleMessage> message) +{ + addMessageToConsoleImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), WTFMove(message)); +} + +inline void InspectorInstrumentation::consoleCount(Page& page, JSC::ExecState* state, Ref<Inspector::ScriptArguments>&& arguments) +{ + consoleCountImpl(instrumentingAgentsForPage(page), state, WTFMove(arguments)); +} + +inline void InspectorInstrumentation::consoleCount(WorkerGlobalScope& workerGlobalScope, JSC::ExecState* state, Ref<Inspector::ScriptArguments>&& arguments) +{ + consoleCountImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), state, WTFMove(arguments)); +} + +inline void InspectorInstrumentation::takeHeapSnapshot(Frame& frame, const String& title) +{ FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) - updateApplicationCacheStatusImpl(instrumentingAgents, frame); -#else - UNUSED_PARAM(frame); -#endif + takeHeapSnapshotImpl(*instrumentingAgents, title); +} + +inline void InspectorInstrumentation::startConsoleTiming(Frame& frame, const String& title) +{ + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + startConsoleTimingImpl(*instrumentingAgents, frame, title); +} + +inline void InspectorInstrumentation::startConsoleTiming(WorkerGlobalScope& workerGlobalScope, const String& title) +{ + startConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title); +} + +inline void InspectorInstrumentation::stopConsoleTiming(Frame& frame, const String& title, Ref<Inspector::ScriptCallStack>&& stack) +{ + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + stopConsoleTimingImpl(*instrumentingAgents, frame, title, WTFMove(stack)); +} + +inline void InspectorInstrumentation::stopConsoleTiming(WorkerGlobalScope& workerGlobalScope, const String& title, Ref<Inspector::ScriptCallStack>&& stack) +{ + stopConsoleTimingImpl(instrumentingAgentsForWorkerGlobalScope(workerGlobalScope), title, WTFMove(stack)); +} + +inline void InspectorInstrumentation::consoleTimeStamp(Frame& frame, Ref<Inspector::ScriptArguments>&& arguments) +{ + FAST_RETURN_IF_NO_FRONTENDS(void()); + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + consoleTimeStampImpl(*instrumentingAgents, frame, WTFMove(arguments)); +} + +inline void InspectorInstrumentation::startProfiling(Page& page, JSC::ExecState* exec, const String &title) +{ + startProfilingImpl(instrumentingAgentsForPage(page), exec, title); +} + +inline void InspectorInstrumentation::stopProfiling(Page& page, JSC::ExecState* exec, const String &title) +{ + stopProfilingImpl(instrumentingAgentsForPage(page), exec, title); } inline void InspectorInstrumentation::didRequestAnimationFrame(Document* document, int callbackId) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didRequestAnimationFrameImpl(instrumentingAgents, callbackId, document->frame()); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(callbackId); -#endif + didRequestAnimationFrameImpl(*instrumentingAgents, callbackId, document->frame()); } inline void InspectorInstrumentation::didCancelAnimationFrame(Document* document, int callbackId) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - didCancelAnimationFrameImpl(instrumentingAgents, callbackId, document->frame()); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(callbackId); -#endif + didCancelAnimationFrameImpl(*instrumentingAgents, callbackId, document->frame()); } inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrame(Document* document, int callbackId) { -#if ENABLE(INSPECTOR) if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) - return willFireAnimationFrameImpl(instrumentingAgents, callbackId, document->frame()); -#else - UNUSED_PARAM(document); - UNUSED_PARAM(callbackId); -#endif + return willFireAnimationFrameImpl(*instrumentingAgents, callbackId, document->frame()); return InspectorInstrumentationCookie(); } inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstrumentationCookie& cookie) { -#if ENABLE(INSPECTOR) FAST_RETURN_IF_NO_FRONTENDS(void()); if (cookie.isValid()) didFireAnimationFrameImpl(cookie); -#else - UNUSED_PARAM(cookie); -#endif } -#if USE(ACCELERATED_COMPOSITING) inline void InspectorInstrumentation::layerTreeDidChange(Page* page) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - layerTreeDidChangeImpl(instrumentingAgents); -#else - UNUSED_PARAM(page); -#endif + layerTreeDidChangeImpl(*instrumentingAgents); } -inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const RenderLayer* renderLayer) +inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const RenderLayer& renderLayer) { -#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(void()); if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - renderLayerDestroyedImpl(instrumentingAgents, renderLayer); -#else - UNUSED_PARAM(page); - UNUSED_PARAM(renderLayer); -#endif + renderLayerDestroyedImpl(*instrumentingAgents, renderLayer); } -inline void InspectorInstrumentation::pseudoElementDestroyed(Page* page, PseudoElement* pseudoElement) +inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context) { -#if ENABLE(INSPECTOR) - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - pseudoElementDestroyedImpl(instrumentingAgents, pseudoElement); -#else - UNUSED_PARAM(page); - UNUSED_PARAM(pseudoElement); -#endif + return context ? instrumentingAgentsForContext(*context) : nullptr; } -#endif -#if ENABLE(INSPECTOR) -inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext* context) +inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext& context) { - if (!context) - return nullptr; - if (context->isDocument()) - return instrumentingAgentsForPage(toDocument(context)->page()); - return instrumentingAgentsForNonDocumentContext(context); + if (is<Document>(context)) + return instrumentingAgentsForPage(downcast<Document>(context).page()); + if (is<WorkerGlobalScope>(context)) + return &instrumentingAgentsForWorkerGlobalScope(downcast<WorkerGlobalScope>(context)); + return nullptr; } inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame) { - if (frame) - return instrumentingAgentsForPage(frame->page()); - return nullptr; + return frame ? instrumentingAgentsForFrame(*frame) : nullptr; +} + +inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame& frame) +{ + return instrumentingAgentsForPage(frame.page()); } inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document* document) { - if (document) { - Page* page = document->page(); -#if ENABLE(TEMPLATE_ELEMENT) - if (!page && document->templateDocumentHost()) - page = document->templateDocumentHost()->page(); -#endif - return instrumentingAgentsForPage(page); - } - return nullptr; + return document ? instrumentingAgentsForDocument(*document) : nullptr; } -#endif -} // namespace WebCore +inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document& document) +{ + Page* page = document.page(); + if (!page && document.templateDocumentHost()) + page = document.templateDocumentHost()->page(); + return instrumentingAgentsForPage(page); +} -#endif // !defined(InspectorInstrumentation_h) +inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page) +{ + return page ? &instrumentingAgentsForPage(*page) : nullptr; +} + +inline InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForPage(Page& page) +{ + ASSERT(isMainThread()); + return page.inspectorController().m_instrumentingAgents.get(); +} + +inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope* workerGlobalScope) +{ + return workerGlobalScope ? &instrumentingAgentsForWorkerGlobalScope(*workerGlobalScope) : nullptr; +} + +inline InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope& workerGlobalScope) +{ + return workerGlobalScope.inspectorController().m_instrumentingAgents; +} + +} // namespace WebCore |