Web Inspector: pass parameters to inspector agents by reference where possible
authorburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 21:45:08 +0000 (21:45 +0000)
committerburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 21:45:08 +0000 (21:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140002

Reviewed by Andreas Kling.

Pass parameters by-reference from inspector instrumentation entry
points to inspector agents. If the event doesn't make sense with null
arguments, perform null checks before calling agent methods.

No new tests, no behavior changed.

* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::didCreateNamedFlow):
(WebCore::InspectorCSSAgent::willRemoveNamedFlow):
(WebCore::InspectorCSSAgent::didChangeRegionOverset):
(WebCore::InspectorCSSAgent::didRegisterNamedFlowContentElement):
(WebCore::InspectorCSSAgent::didUnregisterNamedFlowContentElement):
(WebCore::InspectorCSSAgent::forcePseudoState):
* inspector/InspectorCSSAgent.h: Reorder methods to match instrumentation.
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::handleTouchEvent):
(WebCore::InspectorDOMAgent::didInsertDOMNode):
(WebCore::InspectorDOMAgent::didRemoveDOMNode):
(WebCore::InspectorDOMAgent::willModifyDOMAttr):
(WebCore::InspectorDOMAgent::didModifyDOMAttr):
(WebCore::InspectorDOMAgent::didRemoveDOMAttr):
(WebCore::InspectorDOMAgent::characterDataModified):
(WebCore::InspectorDOMAgent::didInvalidateStyleAttr):
(WebCore::InspectorDOMAgent::didPushShadowRoot):
(WebCore::InspectorDOMAgent::willPopShadowRoot):
* inspector/InspectorDOMAgent.h: Reorder methods to match instrumentation.
* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
(WebCore::InspectorDOMDebuggerAgent::didInsertDOMNode):
(WebCore::InspectorDOMDebuggerAgent::didRemoveDOMNode):
(WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
(WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
(WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
* inspector/InspectorDOMDebuggerAgent.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
(WebCore::InspectorInstrumentation::willInsertDOMNodeImpl):
(WebCore::InspectorInstrumentation::didInsertDOMNodeImpl):
(WebCore::InspectorInstrumentation::willRemoveDOMNodeImpl):
(WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl):
(WebCore::InspectorInstrumentation::willModifyDOMAttrImpl):
(WebCore::InspectorInstrumentation::didModifyDOMAttrImpl):
(WebCore::InspectorInstrumentation::didRemoveDOMAttrImpl):
(WebCore::InspectorInstrumentation::didInvalidateStyleAttrImpl):
(WebCore::InspectorInstrumentation::didPushShadowRootImpl):
(WebCore::InspectorInstrumentation::willPopShadowRootImpl):
(WebCore::InspectorInstrumentation::didCreateNamedFlowImpl): Add null check.
(WebCore::InspectorInstrumentation::willRemoveNamedFlowImpl): Add null check.
(WebCore::InspectorInstrumentation::didChangeRegionOversetImpl):
(WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElementImpl):
(WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElementImpl):
(WebCore::InspectorInstrumentation::handleTouchEventImpl):
(WebCore::InspectorInstrumentation::forcePseudoStateImpl):
(WebCore::InspectorInstrumentation::characterDataModifiedImpl):
(WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
(WebCore::InspectorInstrumentation::didEvaluateScriptImpl):
(WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
(WebCore::InspectorInstrumentation::willLayoutImpl):
(WebCore::InspectorInstrumentation::willPaintImpl):
(WebCore::InspectorInstrumentation::willScrollLayerImpl):
(WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
(WebCore::InspectorInstrumentation::applyEmulatedMediaImpl):
(WebCore::InspectorInstrumentation::willSendRequestImpl): Add null check.
(WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl): Add null checks.
(WebCore::InspectorInstrumentation::willReceiveResourceResponseImpl):  Add null check.
(WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
(WebCore::InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl): Add null check.
(WebCore::InspectorInstrumentation::didFinishLoadingImpl): Add null check.
(WebCore::InspectorInstrumentation::didFailLoadingImpl): Add null check.
(WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
(WebCore::InspectorInstrumentation::loadEventFiredImpl): Add null check.
(WebCore::InspectorInstrumentation::frameDetachedFromParentImpl):
(WebCore::InspectorInstrumentation::didCommitLoadImpl): Add null checks.
(WebCore::InspectorInstrumentation::loaderDetachedFromFrameImpl):
(WebCore::InspectorInstrumentation::willDestroyCachedResourceImpl):
(WebCore::InspectorInstrumentation::startConsoleTimingImpl):
(WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
(WebCore::InspectorInstrumentation::consoleTimeStampImpl):
(WebCore::InspectorInstrumentation::didCreateWebSocketImpl): Add null check.
(WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl): Add null check.
(WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl): Add null check.
(WebCore::InspectorInstrumentation::didCloseWebSocketImpl): Add null check.
(WebCore::InspectorInstrumentation::renderLayerDestroyedImpl):
(WebCore::InspectorInstrumentation::pseudoElementDestroyedImpl):
(WebCore::InspectorInstrumentation::scriptsEnabledImpl): Deleted.
(WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClientImpl): Deleted.
(WebCore::InspectorInstrumentation::frameStartedLoadingImpl): Deleted.
(WebCore::InspectorInstrumentation::willWriteHTMLImpl): Deleted.
(WebCore::InspectorInstrumentation::startProfilingImpl): Deleted.
* inspector/InspectorLayerTreeAgent.cpp:
(WebCore::InspectorLayerTreeAgent::renderLayerDestroyed):
(WebCore::InspectorLayerTreeAgent::pseudoElementDestroyed):
* inspector/InspectorLayerTreeAgent.h:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::frameDetached):
(WebCore::InspectorPageAgent::loaderDetachedFromFrame):
(WebCore::InspectorPageAgent::applyEmulatedMedia):
* inspector/InspectorPageAgent.h:
* inspector/InspectorReplayAgent.cpp:
(WebCore::InspectorReplayAgent::frameDetached):
* inspector/InspectorReplayAgent.h:
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::willSendRequest):
(WebCore::InspectorResourceAgent::didReceiveResponse):
(WebCore::InspectorResourceAgent::didFinishLoading):
(WebCore::InspectorResourceAgent::didFailLoading):
(WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):
(WebCore::InspectorResourceAgent::willDestroyCachedResource):
(WebCore::InspectorResourceAgent::didScheduleStyleRecalculation):
(WebCore::InspectorResourceAgent::mainFrameNavigated):
* inspector/InspectorResourceAgent.h: Reorder methods to match instrumentation.
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didInvalidateLayout):
(WebCore::InspectorTimelineAgent::willLayout):
(WebCore::InspectorTimelineAgent::willPaint):
(WebCore::InspectorTimelineAgent::willScroll):
(WebCore::InspectorTimelineAgent::willEvaluateScript):
(WebCore::InspectorTimelineAgent::didEvaluateScript):
(WebCore::InspectorTimelineAgent::didTimeStamp):
(WebCore::InspectorTimelineAgent::time):
(WebCore::InspectorTimelineAgent::timeEnd):
(WebCore::InspectorTimelineAgent::didMarkDOMContentEvent):
(WebCore::InspectorTimelineAgent::didMarkLoadEvent):
* inspector/InspectorTimelineAgent.h: Reorder methods to match instrumentation.
* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::didCreateMainWorldContext):
(WebCore::PageRuntimeAgent::didCreateIsolatedContext): Deleted. It has no callers.
* inspector/PageRuntimeAgent.h:
* replay/ReplayController.cpp:
(WebCore::ReplayController::frameDetached):
* replay/ReplayController.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177993 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorCSSAgent.h
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorDOMAgent.h
Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp
Source/WebCore/inspector/InspectorDOMDebuggerAgent.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorLayerTreeAgent.cpp
Source/WebCore/inspector/InspectorLayerTreeAgent.h
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.h
Source/WebCore/inspector/InspectorReplayAgent.cpp
Source/WebCore/inspector/InspectorReplayAgent.h
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/InspectorTimelineAgent.h
Source/WebCore/inspector/PageRuntimeAgent.cpp
Source/WebCore/inspector/PageRuntimeAgent.h
Source/WebCore/replay/ReplayController.cpp
Source/WebCore/replay/ReplayController.h

index c75eba8..35460fa 100644 (file)
@@ -1,3 +1,142 @@
+2015-01-06  Brian J. Burg  <burg@cs.washington.edu>
+
+        Web Inspector: pass parameters to inspector agents by reference where possible
+        https://bugs.webkit.org/show_bug.cgi?id=140002
+
+        Reviewed by Andreas Kling.
+
+        Pass parameters by-reference from inspector instrumentation entry
+        points to inspector agents. If the event doesn't make sense with null
+        arguments, perform null checks before calling agent methods.
+
+        No new tests, no behavior changed.
+
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::didCreateNamedFlow):
+        (WebCore::InspectorCSSAgent::willRemoveNamedFlow):
+        (WebCore::InspectorCSSAgent::didChangeRegionOverset):
+        (WebCore::InspectorCSSAgent::didRegisterNamedFlowContentElement):
+        (WebCore::InspectorCSSAgent::didUnregisterNamedFlowContentElement):
+        (WebCore::InspectorCSSAgent::forcePseudoState):
+        * inspector/InspectorCSSAgent.h: Reorder methods to match instrumentation.
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::handleTouchEvent):
+        (WebCore::InspectorDOMAgent::didInsertDOMNode):
+        (WebCore::InspectorDOMAgent::didRemoveDOMNode):
+        (WebCore::InspectorDOMAgent::willModifyDOMAttr):
+        (WebCore::InspectorDOMAgent::didModifyDOMAttr):
+        (WebCore::InspectorDOMAgent::didRemoveDOMAttr):
+        (WebCore::InspectorDOMAgent::characterDataModified):
+        (WebCore::InspectorDOMAgent::didInvalidateStyleAttr):
+        (WebCore::InspectorDOMAgent::didPushShadowRoot):
+        (WebCore::InspectorDOMAgent::willPopShadowRoot):
+        * inspector/InspectorDOMAgent.h: Reorder methods to match instrumentation.
+        * inspector/InspectorDOMDebuggerAgent.cpp:
+        (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
+        (WebCore::InspectorDOMDebuggerAgent::didInsertDOMNode):
+        (WebCore::InspectorDOMDebuggerAgent::didRemoveDOMNode):
+        (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
+        (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
+        (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
+        * inspector/InspectorDOMDebuggerAgent.h:
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
+        (WebCore::InspectorInstrumentation::willInsertDOMNodeImpl):
+        (WebCore::InspectorInstrumentation::didInsertDOMNodeImpl):
+        (WebCore::InspectorInstrumentation::willRemoveDOMNodeImpl):
+        (WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl):
+        (WebCore::InspectorInstrumentation::willModifyDOMAttrImpl):
+        (WebCore::InspectorInstrumentation::didModifyDOMAttrImpl):
+        (WebCore::InspectorInstrumentation::didRemoveDOMAttrImpl):
+        (WebCore::InspectorInstrumentation::didInvalidateStyleAttrImpl):
+        (WebCore::InspectorInstrumentation::didPushShadowRootImpl):
+        (WebCore::InspectorInstrumentation::willPopShadowRootImpl):
+        (WebCore::InspectorInstrumentation::didCreateNamedFlowImpl): Add null check.
+        (WebCore::InspectorInstrumentation::willRemoveNamedFlowImpl): Add null check.
+        (WebCore::InspectorInstrumentation::didChangeRegionOversetImpl):
+        (WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElementImpl):
+        (WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElementImpl):
+        (WebCore::InspectorInstrumentation::handleTouchEventImpl):
+        (WebCore::InspectorInstrumentation::forcePseudoStateImpl):
+        (WebCore::InspectorInstrumentation::characterDataModifiedImpl):
+        (WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
+        (WebCore::InspectorInstrumentation::didEvaluateScriptImpl):
+        (WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
+        (WebCore::InspectorInstrumentation::willLayoutImpl):
+        (WebCore::InspectorInstrumentation::willPaintImpl):
+        (WebCore::InspectorInstrumentation::willScrollLayerImpl):
+        (WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
+        (WebCore::InspectorInstrumentation::applyEmulatedMediaImpl):
+        (WebCore::InspectorInstrumentation::willSendRequestImpl): Add null check.
+        (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl): Add null checks.
+        (WebCore::InspectorInstrumentation::willReceiveResourceResponseImpl):  Add null check.
+        (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
+        (WebCore::InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl): Add null check.
+        (WebCore::InspectorInstrumentation::didFinishLoadingImpl): Add null check.
+        (WebCore::InspectorInstrumentation::didFailLoadingImpl): Add null check.
+        (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
+        (WebCore::InspectorInstrumentation::loadEventFiredImpl): Add null check.
+        (WebCore::InspectorInstrumentation::frameDetachedFromParentImpl):
+        (WebCore::InspectorInstrumentation::didCommitLoadImpl): Add null checks.
+        (WebCore::InspectorInstrumentation::loaderDetachedFromFrameImpl):
+        (WebCore::InspectorInstrumentation::willDestroyCachedResourceImpl):
+        (WebCore::InspectorInstrumentation::startConsoleTimingImpl):
+        (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
+        (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
+        (WebCore::InspectorInstrumentation::didCreateWebSocketImpl): Add null check.
+        (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl): Add null check.
+        (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl): Add null check.
+        (WebCore::InspectorInstrumentation::didCloseWebSocketImpl): Add null check.
+        (WebCore::InspectorInstrumentation::renderLayerDestroyedImpl):
+        (WebCore::InspectorInstrumentation::pseudoElementDestroyedImpl):
+        (WebCore::InspectorInstrumentation::scriptsEnabledImpl): Deleted.
+        (WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClientImpl): Deleted.
+        (WebCore::InspectorInstrumentation::frameStartedLoadingImpl): Deleted.
+        (WebCore::InspectorInstrumentation::willWriteHTMLImpl): Deleted.
+        (WebCore::InspectorInstrumentation::startProfilingImpl): Deleted.
+        * inspector/InspectorLayerTreeAgent.cpp:
+        (WebCore::InspectorLayerTreeAgent::renderLayerDestroyed):
+        (WebCore::InspectorLayerTreeAgent::pseudoElementDestroyed):
+        * inspector/InspectorLayerTreeAgent.h:
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::frameDetached):
+        (WebCore::InspectorPageAgent::loaderDetachedFromFrame):
+        (WebCore::InspectorPageAgent::applyEmulatedMedia):
+        * inspector/InspectorPageAgent.h:
+        * inspector/InspectorReplayAgent.cpp:
+        (WebCore::InspectorReplayAgent::frameDetached):
+        * inspector/InspectorReplayAgent.h:
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::InspectorResourceAgent::willSendRequest):
+        (WebCore::InspectorResourceAgent::didReceiveResponse):
+        (WebCore::InspectorResourceAgent::didFinishLoading):
+        (WebCore::InspectorResourceAgent::didFailLoading):
+        (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):
+        (WebCore::InspectorResourceAgent::willDestroyCachedResource):
+        (WebCore::InspectorResourceAgent::didScheduleStyleRecalculation):
+        (WebCore::InspectorResourceAgent::mainFrameNavigated):
+        * inspector/InspectorResourceAgent.h: Reorder methods to match instrumentation.
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::didInvalidateLayout):
+        (WebCore::InspectorTimelineAgent::willLayout):
+        (WebCore::InspectorTimelineAgent::willPaint):
+        (WebCore::InspectorTimelineAgent::willScroll):
+        (WebCore::InspectorTimelineAgent::willEvaluateScript):
+        (WebCore::InspectorTimelineAgent::didEvaluateScript):
+        (WebCore::InspectorTimelineAgent::didTimeStamp):
+        (WebCore::InspectorTimelineAgent::time):
+        (WebCore::InspectorTimelineAgent::timeEnd):
+        (WebCore::InspectorTimelineAgent::didMarkDOMContentEvent):
+        (WebCore::InspectorTimelineAgent::didMarkLoadEvent):
+        * inspector/InspectorTimelineAgent.h: Reorder methods to match instrumentation.
+        * inspector/PageRuntimeAgent.cpp:
+        (WebCore::PageRuntimeAgent::didCreateMainWorldContext):
+        (WebCore::PageRuntimeAgent::didCreateIsolatedContext): Deleted. It has no callers.
+        * inspector/PageRuntimeAgent.h:
+        * replay/ReplayController.cpp:
+        (WebCore::ReplayController::frameDetached):
+        * replay/ReplayController.h:
+
 2015-01-06  Anders Carlsson  <andersca@apple.com>
 
         Remove an old workaround for an old unsupported plug-in
index 6097623..65f5dc4 100644 (file)
@@ -500,37 +500,37 @@ void InspectorCSSAgent::mediaQueryResultChanged()
         m_frontendDispatcher->mediaQueryResultChanged();
 }
 
-void InspectorCSSAgent::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+void InspectorCSSAgent::didCreateNamedFlow(Document& document, WebKitNamedFlow& namedFlow)
 {
-    int documentNodeId = documentNodeWithRequestedFlowsId(document);
+    int documentNodeId = documentNodeWithRequestedFlowsId(&document);
     if (!documentNodeId)
         return;
 
     ErrorString unused;
-    m_frontendDispatcher->namedFlowCreated(buildObjectForNamedFlow(unused, namedFlow, documentNodeId));
+    m_frontendDispatcher->namedFlowCreated(buildObjectForNamedFlow(unused, &namedFlow, documentNodeId));
 }
 
-void InspectorCSSAgent::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+void InspectorCSSAgent::willRemoveNamedFlow(Document& document, WebKitNamedFlow& namedFlow)
 {
-    int documentNodeId = documentNodeWithRequestedFlowsId(document);
+    int documentNodeId = documentNodeWithRequestedFlowsId(&document);
     if (!documentNodeId)
         return;
 
     if (m_changeRegionOversetTask)
-        m_changeRegionOversetTask->unschedule(namedFlow);
+        m_changeRegionOversetTask->unschedule(&namedFlow);
 
-    m_frontendDispatcher->namedFlowRemoved(documentNodeId, namedFlow->name().string());
+    m_frontendDispatcher->namedFlowRemoved(documentNodeId, namedFlow.name().string());
 }
 
-void InspectorCSSAgent::didChangeRegionOverset(Document* document, WebKitNamedFlow* namedFlow)
+void InspectorCSSAgent::didChangeRegionOverset(Document& document, WebKitNamedFlow& namedFlow)
 {
-    int documentNodeId = documentNodeWithRequestedFlowsId(document);
+    int documentNodeId = documentNodeWithRequestedFlowsId(&document);
     if (!documentNodeId)
         return;
 
     if (!m_changeRegionOversetTask)
         m_changeRegionOversetTask = std::make_unique<ChangeRegionOversetTask>(this);
-    m_changeRegionOversetTask->scheduleFor(namedFlow, documentNodeId);
+    m_changeRegionOversetTask->scheduleFor(&namedFlow, documentNodeId);
 }
 
 void InspectorCSSAgent::regionOversetChanged(WebKitNamedFlow* namedFlow, int documentNodeId)
@@ -544,39 +544,39 @@ void InspectorCSSAgent::regionOversetChanged(WebKitNamedFlow* namedFlow, int doc
     m_frontendDispatcher->regionOversetChanged(buildObjectForNamedFlow(unused, namedFlow, documentNodeId));
 }
 
-void InspectorCSSAgent::didRegisterNamedFlowContentElement(Document* document, WebKitNamedFlow* namedFlow, Node* contentElement, Node* nextContentElement)
+void InspectorCSSAgent::didRegisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement, Node* nextContentElement)
 {
-    int documentNodeId = documentNodeWithRequestedFlowsId(document);
+    int documentNodeId = documentNodeWithRequestedFlowsId(&document);
     if (!documentNodeId)
         return;
 
     ErrorString unused;
-    int contentElementNodeId = m_domAgent->pushNodeToFrontend(unused, documentNodeId, contentElement);
+    int contentElementNodeId = m_domAgent->pushNodeToFrontend(unused, documentNodeId, &contentElement);
     int nextContentElementNodeId = nextContentElement ? m_domAgent->pushNodeToFrontend(unused, documentNodeId, nextContentElement) : 0;
-    m_frontendDispatcher->registeredNamedFlowContentElement(documentNodeId, namedFlow->name().string(), contentElementNodeId, nextContentElementNodeId);
+    m_frontendDispatcher->registeredNamedFlowContentElement(documentNodeId, namedFlow.name().string(), contentElementNodeId, nextContentElementNodeId);
 }
 
-void InspectorCSSAgent::didUnregisterNamedFlowContentElement(Document* document, WebKitNamedFlow* namedFlow, Node* contentElement)
+void InspectorCSSAgent::didUnregisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement)
 {
-    int documentNodeId = documentNodeWithRequestedFlowsId(document);
+    int documentNodeId = documentNodeWithRequestedFlowsId(&document);
     if (!documentNodeId)
         return;
 
     ErrorString unused;
-    int contentElementNodeId = m_domAgent->pushNodeToFrontend(unused, documentNodeId, contentElement);
+    int contentElementNodeId = m_domAgent->pushNodeToFrontend(unused, documentNodeId, &contentElement);
     if (!contentElementNodeId) {
         // We've already notified that the DOM node was removed from the DOM, so there's no need to send another event.
         return;
     }
-    m_frontendDispatcher->unregisteredNamedFlowContentElement(documentNodeId, namedFlow->name().string(), contentElementNodeId);
+    m_frontendDispatcher->unregisteredNamedFlowContentElement(documentNodeId, namedFlow.name().string(), contentElementNodeId);
 }
 
-bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoClassType pseudoClassType)
+bool InspectorCSSAgent::forcePseudoState(Element& element, CSSSelector::PseudoClassType pseudoClassType)
 {
     if (m_nodeIdToForcedPseudoState.isEmpty())
         return false;
 
-    int nodeId = m_domAgent->boundNodeId(element);
+    int nodeId = m_domAgent->boundNodeId(&element);
     if (!nodeId)
         return false;
 
index f9ef9fd..3ddca9b 100644 (file)
@@ -94,20 +94,22 @@ public:
 
     static CSSStyleRule* asCSSStyleRule(CSSRule&);
 
-    bool forcePseudoState(Element*, CSSSelector::PseudoClassType);
     virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) override;
     virtual void willDestroyFrontendAndBackend(Inspector::InspectorDisconnectReason) override;
     virtual void discardAgent() override;
     virtual void enable(ErrorString&) override;
     virtual void disable(ErrorString&) override;
+    void regionOversetChanged(WebKitNamedFlow*, int documentNodeId);
     void reset();
+
+    // InspectorInstrumentation callbacks.
     void mediaQueryResultChanged();
-    void didCreateNamedFlow(Document*, WebKitNamedFlow*);
-    void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
-    void didChangeRegionOverset(Document*, WebKitNamedFlow*);
-    void regionOversetChanged(WebKitNamedFlow*, int documentNodeId);
-    void didRegisterNamedFlowContentElement(Document*, WebKitNamedFlow*, Node* contentElement, Node* nextContentElement = nullptr);
-    void didUnregisterNamedFlowContentElement(Document*, WebKitNamedFlow*, Node* contentElement);
+    void didCreateNamedFlow(Document&, WebKitNamedFlow&);
+    void willRemoveNamedFlow(Document&, WebKitNamedFlow&);
+    void didChangeRegionOverset(Document&, WebKitNamedFlow&);
+    void didRegisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr);
+    void didUnregisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement);
+    bool forcePseudoState(Element&, CSSSelector::PseudoClassType);
 
     virtual void getComputedStyleForNode(ErrorString&, int nodeId, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSComputedStyleProperty>>&) override;
     virtual void getInlineStylesForNode(ErrorString&, int nodeId, RefPtr<Inspector::Protocol::CSS::CSSStyle>& inlineStyle, RefPtr<Inspector::Protocol::CSS::CSSStyle>& attributes) override;
index 1158088..bbacdc4 100644 (file)
@@ -953,13 +953,13 @@ bool InspectorDOMAgent::handleMousePress()
     return false;
 }
 
-bool InspectorDOMAgent::handleTouchEvent(Node* node)
+bool InspectorDOMAgent::handleTouchEvent(Node& node)
 {
     if (!m_searchingForNode)
         return false;
-    if (node && m_inspectModeHighlightConfig) {
-        m_overlay->highlightNode(node, *m_inspectModeHighlightConfig);
-        inspect(node);
+    if (m_inspectModeHighlightConfig) {
+        m_overlay->highlightNode(&node, *m_inspectModeHighlightConfig);
+        inspect(&node);
         return true;
     }
     return false;
@@ -1760,15 +1760,15 @@ void InspectorDOMAgent::didCommitLoad(Document* document)
     m_frontendDispatcher->childNodeInserted(parentId, prevId, value.release());
 }
 
-void InspectorDOMAgent::didInsertDOMNode(Node* node)
+void InspectorDOMAgent::didInsertDOMNode(Node& node)
 {
-    if (isWhitespace(node))
+    if (isWhitespace(&node))
         return;
 
     // We could be attaching existing subtree. Forget the bindings.
-    unbind(node, &m_documentNodeToIdMap);
+    unbind(&node, &m_documentNodeToIdMap);
 
-    ContainerNode* parent = node->parentNode();
+    ContainerNode* parent = node.parentNode();
     if (!parent)
         return;
 
@@ -1782,19 +1782,19 @@ void InspectorDOMAgent::didInsertDOMNode(Node* node)
         m_frontendDispatcher->childNodeCountUpdated(parentId, innerChildNodeCount(parent));
     } else {
         // Children have been requested -> return value of a new child.
-        Node* prevSibling = innerPreviousSibling(node);
+        Node* prevSibling = innerPreviousSibling(&node);
         int prevId = prevSibling ? m_documentNodeToIdMap.get(prevSibling) : 0;
-        RefPtr<Inspector::Protocol::DOM::Node> value = buildObjectForNode(node, 0, &m_documentNodeToIdMap);
+        RefPtr<Inspector::Protocol::DOM::Node> value = buildObjectForNode(&node, 0, &m_documentNodeToIdMap);
         m_frontendDispatcher->childNodeInserted(parentId, prevId, value.release());
     }
 }
 
-void InspectorDOMAgent::didRemoveDOMNode(Node* node)
+void InspectorDOMAgent::didRemoveDOMNode(Node& node)
 {
-    if (isWhitespace(node))
+    if (isWhitespace(&node))
         return;
 
-    ContainerNode* parent = node->parentNode();
+    ContainerNode* parent = node.parentNode();
 
     // If parent is not mapped yet -> ignore the event.
     if (!m_documentNodeToIdMap.contains(parent))
@@ -1807,42 +1807,42 @@ void InspectorDOMAgent::didRemoveDOMNode(Node* node)
         if (innerChildNodeCount(parent) == 1)
             m_frontendDispatcher->childNodeCountUpdated(parentId, 0);
     } else
-        m_frontendDispatcher->childNodeRemoved(parentId, m_documentNodeToIdMap.get(node));
-    unbind(node, &m_documentNodeToIdMap);
+        m_frontendDispatcher->childNodeRemoved(parentId, m_documentNodeToIdMap.get(&node));
+    unbind(&node, &m_documentNodeToIdMap);
 }
 
-void InspectorDOMAgent::willModifyDOMAttr(Element*, const AtomicString& oldValue, const AtomicString& newValue)
+void InspectorDOMAgent::willModifyDOMAttr(Element&, const AtomicString& oldValue, const AtomicString& newValue)
 {
     m_suppressAttributeModifiedEvent = (oldValue == newValue);
 }
 
-void InspectorDOMAgent::didModifyDOMAttr(Element* element, const AtomicString& name, const AtomicString& value)
+void InspectorDOMAgent::didModifyDOMAttr(Element& element, const AtomicString& name, const AtomicString& value)
 {
     bool shouldSuppressEvent = m_suppressAttributeModifiedEvent;
     m_suppressAttributeModifiedEvent = false;
     if (shouldSuppressEvent)
         return;
 
-    int id = boundNodeId(element);
+    int id = boundNodeId(&element);
     // If node is not mapped yet -> ignore the event.
     if (!id)
         return;
 
     if (m_domListener)
-        m_domListener->didModifyDOMAttr(element);
+        m_domListener->didModifyDOMAttr(&element);
 
     m_frontendDispatcher->attributeModified(id, name, value);
 }
 
-void InspectorDOMAgent::didRemoveDOMAttr(Element* element, const AtomicString& name)
+void InspectorDOMAgent::didRemoveDOMAttr(Element& element, const AtomicString& name)
 {
-    int id = boundNodeId(element);
+    int id = boundNodeId(&element);
     // If node is not mapped yet -> ignore the event.
     if (!id)
         return;
 
     if (m_domListener)
-        m_domListener->didModifyDOMAttr(element);
+        m_domListener->didModifyDOMAttr(&element);
 
     m_frontendDispatcher->attributeRemoved(id, name);
 }
@@ -1864,40 +1864,40 @@ void InspectorDOMAgent::styleAttributeInvalidated(const Vector<Element*>& elemen
     m_frontendDispatcher->inlineStyleInvalidated(nodeIds.release());
 }
 
-void InspectorDOMAgent::characterDataModified(CharacterData* characterData)
+void InspectorDOMAgent::characterDataModified(CharacterData& characterData)
 {
-    int id = m_documentNodeToIdMap.get(characterData);
+    int id = m_documentNodeToIdMap.get(&characterData);
     if (!id) {
         // Push text node if it is being created.
         didInsertDOMNode(characterData);
         return;
     }
-    m_frontendDispatcher->characterDataModified(id, characterData->data());
+    m_frontendDispatcher->characterDataModified(id, characterData.data());
 }
 
-void InspectorDOMAgent::didInvalidateStyleAttr(Node* node)
+void InspectorDOMAgent::didInvalidateStyleAttr(Node& node)
 {
-    int id = m_documentNodeToIdMap.get(node);
+    int id = m_documentNodeToIdMap.get(&node);
     // If node is not mapped yet -> ignore the event.
     if (!id)
         return;
 
     if (!m_revalidateStyleAttrTask)
         m_revalidateStyleAttrTask = std::make_unique<RevalidateStyleAttributeTask>(this);
-    m_revalidateStyleAttrTask->scheduleFor(downcast<Element>(node));
+    m_revalidateStyleAttrTask->scheduleFor(downcast<Element>(&node));
 }
 
-void InspectorDOMAgent::didPushShadowRoot(Element* host, ShadowRoot* root)
+void InspectorDOMAgent::didPushShadowRoot(Element& host, ShadowRoot& root)
 {
-    int hostId = m_documentNodeToIdMap.get(host);
+    int hostId = m_documentNodeToIdMap.get(&host);
     if (hostId)
-        m_frontendDispatcher->shadowRootPushed(hostId, buildObjectForNode(root, 0, &m_documentNodeToIdMap));
+        m_frontendDispatcher->shadowRootPushed(hostId, buildObjectForNode(&root, 0, &m_documentNodeToIdMap));
 }
 
-void InspectorDOMAgent::willPopShadowRoot(Element* host, ShadowRoot* root)
+void InspectorDOMAgent::willPopShadowRoot(Element& host, ShadowRoot& root)
 {
-    int hostId = m_documentNodeToIdMap.get(host);
-    int rootId = m_documentNodeToIdMap.get(root);
+    int hostId = m_documentNodeToIdMap.get(&host);
+    int rootId = m_documentNodeToIdMap.get(&root);
     if (hostId && rootId)
         m_frontendDispatcher->shadowRootPopped(hostId, rootId);
 }
index 9eb30d1..5305056 100644 (file)
@@ -156,24 +156,27 @@ public:
 
     void getEventListeners(Node*, Vector<EventListenerInfo>& listenersArray, bool includeAncestors);
 
-    // Methods called from the InspectorInstrumentation.
+
+    // InspectorInstrumentation callbacks.
+    void didInsertDOMNode(Node&);
+    void didRemoveDOMNode(Node&);
+    void willModifyDOMAttr(Element&, const AtomicString& oldValue, const AtomicString& newValue);
+    void didModifyDOMAttr(Element&, const AtomicString& name, const AtomicString& value);
+    void didRemoveDOMAttr(Element&, const AtomicString& name);
+    void characterDataModified(CharacterData&);
+    void didInvalidateStyleAttr(Node&);
+    void didPushShadowRoot(Element& host, ShadowRoot&);
+    void willPopShadowRoot(Element& host, ShadowRoot&);
+    bool handleTouchEvent(Node&);
+    void didCommitLoad(Document*);
+    void frameDocumentUpdated(Frame*);
+
+    // Callbacks that don't directly correspond to an instrumentation entry point.
     void setDocument(Document*);
     void releaseDanglingNodes();
-
     void mainFrameDOMContentLoaded();
-    void didCommitLoad(Document*);
 
-    void didInsertDOMNode(Node*);
-    void didRemoveDOMNode(Node*);
-    void willModifyDOMAttr(Element*, const AtomicString& oldValue, const AtomicString& newValue);
-    void didModifyDOMAttr(Element*, const AtomicString& name, const AtomicString& value);
-    void didRemoveDOMAttr(Element*, const AtomicString& name);
     void styleAttributeInvalidated(const Vector<Element*>& elements);
-    void characterDataModified(CharacterData*);
-    void didInvalidateStyleAttr(Node*);
-    void didPushShadowRoot(Element* host, ShadowRoot*);
-    void willPopShadowRoot(Element* host, ShadowRoot*);
-    void frameDocumentUpdated(Frame*);
 
     int pushNodeToFrontend(ErrorString&, int documentNodeId, Node*);
     Node* nodeForId(int nodeId);
@@ -185,7 +188,6 @@ public:
 
     PassRefPtr<Inspector::Protocol::Runtime::RemoteObject> resolveNode(Node*, const String& objectGroup);
     bool handleMousePress();
-    bool handleTouchEvent(Node*);
     void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
     void inspect(Node*);
     void focusNode();
index c1ec74f..7826a93 100644 (file)
@@ -167,31 +167,31 @@ void InspectorDOMDebuggerAgent::removeBreakpoint(ErrorString& error, const Strin
     m_eventListenerBreakpoints.remove(eventName);
 }
 
-void InspectorDOMDebuggerAgent::didInvalidateStyleAttr(Node* node)
+void InspectorDOMDebuggerAgent::didInvalidateStyleAttr(Node& node)
 {
-    if (hasBreakpoint(node, AttributeModified)) {
+    if (hasBreakpoint(&node, AttributeModified)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
-        descriptionForDOMEvent(node, AttributeModified, false, eventData.get());
+        descriptionForDOMEvent(&node, AttributeModified, false, eventData.get());
         m_debuggerAgent->breakProgram(InspectorDebuggerFrontendDispatcher::Reason::DOM, eventData.release());
     }
 }
 
-void InspectorDOMDebuggerAgent::didInsertDOMNode(Node* node)
+void InspectorDOMDebuggerAgent::didInsertDOMNode(Node& node)
 {
     if (m_domBreakpoints.size()) {
-        uint32_t mask = m_domBreakpoints.get(InspectorDOMAgent::innerParentNode(node));
+        uint32_t mask = m_domBreakpoints.get(InspectorDOMAgent::innerParentNode(&node));
         uint32_t inheritableTypesMask = (mask | (mask >> domBreakpointDerivedTypeShift)) & inheritableDOMBreakpointTypesMask;
         if (inheritableTypesMask)
-            updateSubtreeBreakpoints(node, inheritableTypesMask, true);
+            updateSubtreeBreakpoints(&node, inheritableTypesMask, true);
     }
 }
 
-void InspectorDOMDebuggerAgent::didRemoveDOMNode(Node* node)
+void InspectorDOMDebuggerAgent::didRemoveDOMNode(Node& node)
 {
     if (m_domBreakpoints.size()) {
         // Remove subtree breakpoints.
-        m_domBreakpoints.remove(node);
-        Vector<Node*> stack(1, InspectorDOMAgent::innerFirstChild(node));
+        m_domBreakpoints.remove(&node);
+        Vector<Node*> stack(1, InspectorDOMAgent::innerFirstChild(&node));
         do {
             Node* node = stack.last();
             stack.removeLast();
@@ -267,34 +267,34 @@ void InspectorDOMDebuggerAgent::removeDOMBreakpoint(ErrorString& errorString, in
     }
 }
 
-void InspectorDOMDebuggerAgent::willInsertDOMNode(Node* parent)
+void InspectorDOMDebuggerAgent::willInsertDOMNode(Node& parent)
 {
-    if (hasBreakpoint(parent, SubtreeModified)) {
+    if (hasBreakpoint(&parent, SubtreeModified)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
-        descriptionForDOMEvent(parent, SubtreeModified, true, eventData.get());
+        descriptionForDOMEvent(&parent, SubtreeModified, true, eventData.get());
         m_debuggerAgent->breakProgram(InspectorDebuggerFrontendDispatcher::Reason::DOM, eventData.release());
     }
 }
 
-void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node* node)
+void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node& node)
 {
-    Node* parentNode = InspectorDOMAgent::innerParentNode(node);
-    if (hasBreakpoint(node, NodeRemoved)) {
+    Node* parentNode = InspectorDOMAgent::innerParentNode(&node);
+    if (hasBreakpoint(&node, NodeRemoved)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
-        descriptionForDOMEvent(node, NodeRemoved, false, eventData.get());
+        descriptionForDOMEvent(&node, NodeRemoved, false, eventData.get());
         m_debuggerAgent->breakProgram(InspectorDebuggerFrontendDispatcher::Reason::DOM, eventData.release());
     } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
-        descriptionForDOMEvent(node, SubtreeModified, false, eventData.get());
+        descriptionForDOMEvent(&node, SubtreeModified, false, eventData.get());
         m_debuggerAgent->breakProgram(InspectorDebuggerFrontendDispatcher::Reason::DOM, eventData.release());
     }
 }
 
-void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element* element)
+void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element& element)
 {
-    if (hasBreakpoint(element, AttributeModified)) {
+    if (hasBreakpoint(&element, AttributeModified)) {
         RefPtr<InspectorObject> eventData = InspectorObject::create();
-        descriptionForDOMEvent(element, AttributeModified, false, eventData.get());
+        descriptionForDOMEvent(&element, AttributeModified, false, eventData.get());
         m_debuggerAgent->breakProgram(InspectorDebuggerFrontendDispatcher::Reason::DOM, eventData.release());
     }
 }
index 77491ce..5587337 100644 (file)
@@ -70,13 +70,13 @@ public:
     virtual void setDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;
     virtual void removeDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;
 
-    // InspectorInstrumentation API
-    void willInsertDOMNode(Node* parent);
-    void didInvalidateStyleAttr(Node*);
-    void didInsertDOMNode(Node*);
-    void willRemoveDOMNode(Node*);
-    void didRemoveDOMNode(Node*);
-    void willModifyDOMAttr(Element*);
+    // InspectorInstrumentation callbacks.
+    void willInsertDOMNode(Node& parent);
+    void didInvalidateStyleAttr(Node&);
+    void didInsertDOMNode(Node&);
+    void willRemoveDOMNode(Node&);
+    void didRemoveDOMNode(Node&);
+    void willModifyDOMAttr(Element&);
     void willSendXMLHttpRequest(const String& url);
     void pauseOnNativeEventIfNeeded(bool isDOMEvent, const String& eventName, bool synchronous);
 
index ea5ce5b..3589eff 100644 (file)
@@ -118,7 +118,7 @@ void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgen
     }
     if (PageRuntimeAgent* pageRuntimeAgent = instrumentingAgents.pageRuntimeAgent()) {
         if (&world == &mainThreadNormalWorld())
-            pageRuntimeAgent->didCreateMainWorldContext(&frame);
+            pageRuntimeAgent->didCreateMainWorldContext(frame);
     }
 }
 
@@ -132,57 +132,57 @@ bool InspectorInstrumentation::isDebuggerPausedImpl(InstrumentingAgents& instrum
 void InspectorInstrumentation::willInsertDOMNodeImpl(InstrumentingAgents& instrumentingAgents, Node& parent)
 {
     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
-        domDebuggerAgent->willInsertDOMNode(&parent);
+        domDebuggerAgent->willInsertDOMNode(parent);
 }
 
 void InspectorInstrumentation::didInsertDOMNodeImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        domAgent->didInsertDOMNode(&node);
+        domAgent->didInsertDOMNode(node);
     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
-        domDebuggerAgent->didInsertDOMNode(&node);
+        domDebuggerAgent->didInsertDOMNode(node);
 }
 
 void InspectorInstrumentation::willRemoveDOMNodeImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
-        domDebuggerAgent->willRemoveDOMNode(&node);
+        domDebuggerAgent->willRemoveDOMNode(node);
 }
 
 void InspectorInstrumentation::didRemoveDOMNodeImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
-        domDebuggerAgent->didRemoveDOMNode(&node);
+        domDebuggerAgent->didRemoveDOMNode(node);
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        domAgent->didRemoveDOMNode(&node);
+        domAgent->didRemoveDOMNode(node);
 }
 
 void InspectorInstrumentation::willModifyDOMAttrImpl(InstrumentingAgents& instrumentingAgents, Element& element, const AtomicString& oldValue, const AtomicString& newValue)
 {
     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
-        domDebuggerAgent->willModifyDOMAttr(&element);
+        domDebuggerAgent->willModifyDOMAttr(element);
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        domAgent->willModifyDOMAttr(&element, oldValue, newValue);
+        domAgent->willModifyDOMAttr(element, oldValue, newValue);
 }
 
 void InspectorInstrumentation::didModifyDOMAttrImpl(InstrumentingAgents& instrumentingAgents, Element& element, const AtomicString& name, const AtomicString& value)
 {
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        domAgent->didModifyDOMAttr(&element, name, value);
+        domAgent->didModifyDOMAttr(element, name, value);
 }
 
 void InspectorInstrumentation::didRemoveDOMAttrImpl(InstrumentingAgents& instrumentingAgents, Element& element, const AtomicString& name)
 {
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        domAgent->didRemoveDOMAttr(&element, name);
+        domAgent->didRemoveDOMAttr(element, name);
 }
 
 void InspectorInstrumentation::didInvalidateStyleAttrImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        domAgent->didInvalidateStyleAttr(&node);
+        domAgent->didInvalidateStyleAttr(node);
     if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
-        domDebuggerAgent->didInvalidateStyleAttr(&node);
+        domDebuggerAgent->didInvalidateStyleAttr(node);
 }
 
 void InspectorInstrumentation::frameWindowDiscardedImpl(InstrumentingAgents& instrumentingAgents, DOMWindow* window)
@@ -200,43 +200,49 @@ void InspectorInstrumentation::mediaQueryResultChangedImpl(InstrumentingAgents&
 void InspectorInstrumentation::didPushShadowRootImpl(InstrumentingAgents& instrumentingAgents, Element& host, ShadowRoot& root)
 {
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        domAgent->didPushShadowRoot(&host, &root);
+        domAgent->didPushShadowRoot(host, root);
 }
 
 void InspectorInstrumentation::willPopShadowRootImpl(InstrumentingAgents& instrumentingAgents, Element& host, ShadowRoot& root)
 {
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        domAgent->willPopShadowRoot(&host, &root);
+        domAgent->willPopShadowRoot(host, root);
 }
 
 void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents& instrumentingAgents, Document* document, WebKitNamedFlow& namedFlow)
 {
+    if (!document)
+        return;
+
     if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
-        cssAgent->didCreateNamedFlow(document, &namedFlow);
+        cssAgent->didCreateNamedFlow(*document, namedFlow);
 }
 
 void InspectorInstrumentation::willRemoveNamedFlowImpl(InstrumentingAgents& instrumentingAgents, Document* document, WebKitNamedFlow& namedFlow)
 {
+    if (!document)
+        return;
+
     if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
-        cssAgent->willRemoveNamedFlow(document, &namedFlow);
+        cssAgent->willRemoveNamedFlow(*document, namedFlow);
 }
 
 void InspectorInstrumentation::didChangeRegionOversetImpl(InstrumentingAgents& instrumentingAgents, Document& document, WebKitNamedFlow& namedFlow)
 {
     if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
-        cssAgent->didChangeRegionOverset(&document, &namedFlow);
+        cssAgent->didChangeRegionOverset(document, namedFlow);
 }
 
 void InspectorInstrumentation::didRegisterNamedFlowContentElementImpl(InstrumentingAgents& instrumentingAgents, Document& document, WebKitNamedFlow& namedFlow, Node& contentElement, Node* nextContentElement)
 {
     if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
-        cssAgent->didRegisterNamedFlowContentElement(&document, &namedFlow, &contentElement, nextContentElement);
+        cssAgent->didRegisterNamedFlowContentElement(document, namedFlow, contentElement, nextContentElement);
 }
 
 void InspectorInstrumentation::didUnregisterNamedFlowContentElementImpl(InstrumentingAgents& instrumentingAgents, Document& document, WebKitNamedFlow& namedFlow, Node& contentElement)
 {
     if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
-        cssAgent->didUnregisterNamedFlowContentElement(&document, &namedFlow, &contentElement);
+        cssAgent->didUnregisterNamedFlowContentElement(document, namedFlow, contentElement);
 }
 
 void InspectorInstrumentation::mouseDidMoveOverElementImpl(InstrumentingAgents& instrumentingAgents, const HitTestResult& result, unsigned modifierFlags)
@@ -254,7 +260,7 @@ void InspectorInstrumentation::didScrollImpl(InstrumentingAgents& instrumentingA
 bool InspectorInstrumentation::handleTouchEventImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        return domAgent->handleTouchEvent(&node);
+        return domAgent->handleTouchEvent(node);
     return false;
 }
 
@@ -268,14 +274,14 @@ bool InspectorInstrumentation::handleMousePressImpl(InstrumentingAgents& instrum
 bool InspectorInstrumentation::forcePseudoStateImpl(InstrumentingAgents& instrumentingAgents, Element& element, CSSSelector::PseudoClassType pseudoState)
 {
     if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
-        return cssAgent->forcePseudoState(&element, pseudoState);
+        return cssAgent->forcePseudoState(element, pseudoState);
     return false;
 }
 
 void InspectorInstrumentation::characterDataModifiedImpl(InstrumentingAgents& instrumentingAgents, CharacterData& characterData)
 {
     if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
-        domAgent->characterDataModified(&characterData);
+        domAgent->characterDataModified(characterData);
 }
 
 void InspectorInstrumentation::willSendXMLHttpRequestImpl(InstrumentingAgents& instrumentingAgents, const String& url)
@@ -395,7 +401,7 @@ InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(
 {
     int timelineAgentId = 0;
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
-        timelineAgent->willEvaluateScript(url, lineNumber, &frame);
+        timelineAgent->willEvaluateScript(url, lineNumber, frame);
         timelineAgentId = timelineAgent->id();
     }
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
@@ -404,7 +410,7 @@ InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(
 void InspectorInstrumentation::didEvaluateScriptImpl(const InspectorInstrumentationCookie& cookie, Frame& frame)
 {
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
-        timelineAgent->didEvaluateScript(&frame);
+        timelineAgent->didEvaluateScript(frame);
 }
 
 void InspectorInstrumentation::scriptsEnabledImpl(InstrumentingAgents& instrumentingAgents, bool isEnabled)
@@ -437,14 +443,14 @@ void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCo
 void InspectorInstrumentation::didInvalidateLayoutImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
-        timelineAgent->didInvalidateLayout(&frame);
+        timelineAgent->didInvalidateLayout(frame);
 }
 
 InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
     int timelineAgentId = 0;
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
-        timelineAgent->willLayout(&frame);
+        timelineAgent->willLayout(frame);
         timelineAgentId = timelineAgent->id();
     }
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
@@ -479,7 +485,7 @@ void InspectorInstrumentation::didDispatchXHRLoadEventImpl(const InspectorInstru
 void InspectorInstrumentation::willPaintImpl(InstrumentingAgents& instrumentingAgents, RenderObject* renderer)
 {
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
-        timelineAgent->willPaint(&renderer->frame());
+        timelineAgent->willPaint(renderer->frame());
 }
 
 void InspectorInstrumentation::didPaintImpl(InstrumentingAgents& instrumentingAgents, RenderObject* renderer, const LayoutRect& rect)
@@ -494,7 +500,7 @@ void InspectorInstrumentation::didPaintImpl(InstrumentingAgents& instrumentingAg
 void InspectorInstrumentation::willScrollLayerImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
-        timelineAgent->willScroll(&frame);
+        timelineAgent->willScroll(frame);
 }
 
 void InspectorInstrumentation::didScrollLayerImpl(InstrumentingAgents& instrumentingAgents)
@@ -535,21 +541,24 @@ void InspectorInstrumentation::didScheduleStyleRecalculationImpl(InstrumentingAg
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didScheduleStyleRecalculation(document.frame());
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
-        resourceAgent->didScheduleStyleRecalculation(&document);
+        resourceAgent->didScheduleStyleRecalculation(document);
 }
 
 void InspectorInstrumentation::applyEmulatedMediaImpl(InstrumentingAgents& instrumentingAgents, String& media)
 {
     if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
-        pageAgent->applyEmulatedMedia(&media);
+        pageAgent->applyEmulatedMedia(media);
 }
 
 void InspectorInstrumentation::willSendRequestImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
+    if (!loader)
+        return;
+
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->willSendResourceRequest(identifier, request, loader->frame());
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
-        resourceAgent->willSendRequest(identifier, loader, request, redirectResponse);
+        resourceAgent->willSendRequest(identifier, *loader, request, redirectResponse);
 }
 
 void InspectorInstrumentation::continueAfterPingLoaderImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
@@ -567,8 +576,12 @@ void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InstrumentingA
 {
     if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
         return;
+    
+    if (!loader || !cachedResource)
+        return;
+
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
-        resourceAgent->didLoadResourceFromMemoryCache(loader, cachedResource);
+        resourceAgent->didLoadResourceFromMemoryCache(*loader, *cachedResource);
 }
 
 InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InstrumentingAgents& instrumentingAgents, Frame* frame, unsigned long identifier, int length)
@@ -591,7 +604,7 @@ InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResp
 {
     int timelineAgentId = 0;
     InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
-    if (timelineAgent) {
+    if (timelineAgent && frame) {
         timelineAgent->willReceiveResourceResponse(identifier, response, frame);
         timelineAgentId = timelineAgent->id();
     }
@@ -611,13 +624,16 @@ void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorIns
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
         timelineAgent->didReceiveResourceResponse();
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
-        resourceAgent->didReceiveResponse(identifier, loader, response, resourceLoader);
+        resourceAgent->didReceiveResponse(identifier, *loader, response, resourceLoader);
     if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->didReceiveResponse(identifier, response); // This should come AFTER resource notification, front-end relies on this.
 }
 
 void InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl(Frame* frame, DocumentLoader& loader, unsigned long identifier, const ResourceResponse& r)
 {
+    if (!frame)
+        return;
+
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(frame, identifier, r);
     InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, &loader, r, nullptr);
 }
@@ -645,18 +661,24 @@ void InspectorInstrumentation::didReceiveDataImpl(InstrumentingAgents& instrumen
 
 void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime)
 {
+    if (!loader)
+        return;
+
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didFinishLoadingResource(identifier, false, finishTime, loader->frame());
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
-        resourceAgent->didFinishLoading(identifier, loader, finishTime);
+        resourceAgent->didFinishLoading(identifier, *loader, finishTime);
 }
 
 void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
 {
+    if (!loader)
+        return;
+
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didFinishLoadingResource(identifier, true, 0, loader->frame());
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
-        resourceAgent->didFailLoading(identifier, loader, error);
+        resourceAgent->didFailLoading(identifier, *loader, error);
     if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
 }
@@ -726,7 +748,7 @@ void InspectorInstrumentation::didReceiveScriptResponseImpl(InstrumentingAgents&
 void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
-        timelineAgent->didMarkDOMContentEvent(&frame);
+        timelineAgent->didMarkDOMContentEvent(frame);
 
     if (!frame.isMainFrame())
         return;
@@ -740,8 +762,11 @@ void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgent
 
 void InspectorInstrumentation::loadEventFiredImpl(InstrumentingAgents& instrumentingAgents, Frame* frame)
 {
+    if (!frame)
+        return;
+
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
-        timelineAgent->didMarkLoadEvent(frame);
+        timelineAgent->didMarkLoadEvent(*frame);
 
     if (!frame->isMainFrame())
         return;
@@ -753,13 +778,14 @@ void InspectorInstrumentation::loadEventFiredImpl(InstrumentingAgents& instrumen
 void InspectorInstrumentation::frameDetachedFromParentImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
     if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
-        pageAgent->frameDetached(&frame);
+        pageAgent->frameDetached(frame);
 
 #if ENABLE(WEB_REPLAY)
-    if (frame.isMainFrame()) {
-        if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
-            replayAgent->frameDetached(&frame);
-    }
+    if (!frame.isMainFrame())
+        return;
+
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
+        replayAgent->frameDetached(frame);
 #endif
 }
 
@@ -768,12 +794,15 @@ void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents& instrument
     if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
         return;
 
+    if (!page || !loader || !loader->frame())
+        return;
+
     if (loader->frame()->isMainFrame()) {
         if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
             consoleAgent->reset();
 
         if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
-            resourceAgent->mainFrameNavigated(loader);
+            resourceAgent->mainFrameNavigated(*loader);
 
         if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
             cssAgent->reset();
@@ -813,7 +842,7 @@ void InspectorInstrumentation::frameDocumentUpdatedImpl(InstrumentingAgents& ins
 void InspectorInstrumentation::loaderDetachedFromFrameImpl(InstrumentingAgents& instrumentingAgents, DocumentLoader& loader)
 {
     if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
-        inspectorPageAgent->loaderDetachedFromFrame(&loader);
+        inspectorPageAgent->loaderDetachedFromFrame(loader);
 }
 
 void InspectorInstrumentation::frameStartedLoadingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
@@ -860,7 +889,7 @@ void InspectorInstrumentation::willDestroyCachedResourceImpl(CachedResource& cac
 
     for (auto* instrumentingAgent : *s_instrumentingAgentsSet) {
         if (InspectorResourceAgent* inspectorResourceAgent = instrumentingAgent->inspectorResourceAgent())
-            inspectorResourceAgent->willDestroyCachedResource(&cachedResource);
+            inspectorResourceAgent->willDestroyCachedResource(cachedResource);
     }
 }
 
@@ -929,7 +958,7 @@ void InspectorInstrumentation::consoleCountImpl(InstrumentingAgents& instrumenti
 void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& title)
 {
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
-        timelineAgent->time(&frame, title);
+        timelineAgent->time(frame, title);
     if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->startTiming(title);
 }
@@ -939,7 +968,7 @@ void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents& instru
     if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->stopTiming(title, stack);
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
-        timelineAgent->timeEnd(&frame, title);
+        timelineAgent->timeEnd(frame, title);
 }
 
 void InspectorInstrumentation::consoleTimeStampImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, PassRefPtr<ScriptArguments> arguments)
@@ -947,7 +976,7 @@ void InspectorInstrumentation::consoleTimeStampImpl(InstrumentingAgents& instrum
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
         String message;
         arguments->getFirstArgumentAsString(message);
-        timelineAgent->didTimeStamp(&frame, message);
+        timelineAgent->didTimeStamp(frame, message);
      }
 }
 
@@ -1017,6 +1046,10 @@ void InspectorInstrumentation::didCreateWebSocketImpl(InstrumentingAgents& instr
 {
     if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
         return;
+
+    if (!document)
+        return;
+
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didCreateWebSocket(identifier, requestURL);
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
@@ -1025,6 +1058,9 @@ void InspectorInstrumentation::didCreateWebSocketImpl(InstrumentingAgents& instr
 
 void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const ResourceRequest& request, Document* document)
 {
+    if (!document)
+        return;
+
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->willSendWebSocketHandshakeRequest(identifier, request);
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
@@ -1033,6 +1069,9 @@ void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(Instrumenti
 
 void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const ResourceResponse& response, Document* document)
 {
+    if (!document)
+        return;
+
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didReceiveWebSocketHandshakeResponse(identifier, response);
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
@@ -1041,6 +1080,9 @@ void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(Instrume
 
 void InspectorInstrumentation::didCloseWebSocketImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, Document* document)
 {
+    if (!document)
+        return;
+
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didCloseWebSocket(identifier);
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
@@ -1295,13 +1337,13 @@ void InspectorInstrumentation::layerTreeDidChangeImpl(InstrumentingAgents& instr
 void InspectorInstrumentation::renderLayerDestroyedImpl(InstrumentingAgents& instrumentingAgents, const RenderLayer& renderLayer)
 {
     if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents.inspectorLayerTreeAgent())
-        layerTreeAgent->renderLayerDestroyed(&renderLayer);
+        layerTreeAgent->renderLayerDestroyed(renderLayer);
 }
 
 void InspectorInstrumentation::pseudoElementDestroyedImpl(InstrumentingAgents& instrumentingAgents, PseudoElement& pseudoElement)
 {
     if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents.inspectorLayerTreeAgent())
-        layerTreeAgent->pseudoElementDestroyed(&pseudoElement);
+        layerTreeAgent->pseudoElementDestroyed(pseudoElement);
 }
 
 } // namespace WebCore
index a970d2a..6cb2124 100644 (file)
@@ -97,14 +97,14 @@ void InspectorLayerTreeAgent::layerTreeDidChange()
     m_frontendDispatcher->layerTreeDidChange();
 }
 
-void InspectorLayerTreeAgent::renderLayerDestroyed(const RenderLayer* renderLayer)
+void InspectorLayerTreeAgent::renderLayerDestroyed(const RenderLayer& renderLayer)
 {
-    unbind(renderLayer);
+    unbind(&renderLayer);
 }
 
-void InspectorLayerTreeAgent::pseudoElementDestroyed(PseudoElement* pseudoElement)
+void InspectorLayerTreeAgent::pseudoElementDestroyed(PseudoElement& pseudoElement)
 {
-    unbindPseudoElement(pseudoElement);
+    unbindPseudoElement(&pseudoElement);
 }
 
 void InspectorLayerTreeAgent::layersForNode(ErrorString& errorString, int nodeId, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::LayerTree::Layer>>& layers)
index 6dab1ae..6633932 100644 (file)
@@ -56,9 +56,10 @@ public:
     virtual void willDestroyFrontendAndBackend(Inspector::InspectorDisconnectReason) override;
     void reset();
 
+    // InspectorInstrumentation callbacks.
     void layerTreeDidChange();
-    void renderLayerDestroyed(const RenderLayer*);
-    void pseudoElementDestroyed(PseudoElement*);
+    void renderLayerDestroyed(const RenderLayer&);
+    void pseudoElementDestroyed(PseudoElement&);
 
     // Called from the front-end.
     virtual void enable(ErrorString&) override;
index aa9411a..7e2cbdb 100644 (file)
@@ -730,9 +730,9 @@ void InspectorPageAgent::frameNavigated(DocumentLoader* loader)
     m_frontendDispatcher->frameNavigated(buildObjectForFrame(loader->frame()));
 }
 
-void InspectorPageAgent::frameDetached(Frame* frame)
+void InspectorPageAgent::frameDetached(Frame& frame)
 {
-    HashMap<Frame*, String>::iterator iterator = m_frameToIdentifier.find(frame);
+    HashMap<Frame*, String>::iterator iterator = m_frameToIdentifier.find(&frame);
     if (iterator != m_frameToIdentifier.end()) {
         m_frontendDispatcher->frameDetached(iterator->value);
         m_identifierToFrame.remove(iterator->value);
@@ -809,9 +809,9 @@ DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString& errorStrin
     return documentLoader;
 }
 
-void InspectorPageAgent::loaderDetachedFromFrame(DocumentLoader* loader)
+void InspectorPageAgent::loaderDetachedFromFrame(DocumentLoader& loader)
 {
-    m_loaderToIdentifier.remove(loader);
+    m_loaderToIdentifier.remove(&loader);
 }
 
 void InspectorPageAgent::frameStartedLoading(Frame& frame)
@@ -984,10 +984,10 @@ void InspectorPageAgent::setEmulatedMedia(ErrorString&, const String& media)
     }
 }
 
-void InspectorPageAgent::applyEmulatedMedia(String* media)
+void InspectorPageAgent::applyEmulatedMedia(String& media)
 {
     if (!m_emulatedMedia.isEmpty())
-        *media = m_emulatedMedia;
+        media = m_emulatedMedia;
 }
 
 void InspectorPageAgent::getCompositingBordersVisible(ErrorString&, bool* outParam)
index 246995f..5343af8 100644 (file)
@@ -120,20 +120,20 @@ public:
     virtual void handleJavaScriptDialog(ErrorString&, bool accept, const String* promptText) override;
     virtual void archive(ErrorString&, String* data) override;
 
-    // InspectorInstrumentation API
+    // InspectorInstrumentation callbacks.
     void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld&);
     void domContentEventFired();
     void loadEventFired();
     void frameNavigated(DocumentLoader*);
-    void frameDetached(Frame*);
-    void loaderDetachedFromFrame(DocumentLoader*);
+    void frameDetached(Frame&);
+    void loaderDetachedFromFrame(DocumentLoader&);
     void frameStartedLoading(Frame&);
     void frameStoppedLoading(Frame&);
     void frameScheduledNavigation(Frame&, double delay);
     void frameClearedScheduledNavigation(Frame&);
     void willRunJavaScriptDialog(const String& message);
     void didRunJavaScriptDialog();
-    void applyEmulatedMedia(String*);
+    void applyEmulatedMedia(String&);
     void didPaint(RenderObject*, const LayoutRect&);
     void didLayout();
     void didScroll();
index d1d48f0..779be62 100644 (file)
@@ -208,7 +208,7 @@ void InspectorReplayAgent::frameNavigated(DocumentLoader* loader)
         m_page.replayController().frameNavigated(loader);
 }
 
-void InspectorReplayAgent::frameDetached(Frame* frame)
+void InspectorReplayAgent::frameDetached(Frame& frame)
 {
     if (sessionState() != WebCore::SessionState::Inactive)
         m_page.replayController().frameDetached(frame);
index 5ae3984..173aea7 100644 (file)
@@ -67,9 +67,9 @@ public:
     virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) override;
     virtual void willDestroyFrontendAndBackend(Inspector::InspectorDisconnectReason) override;
 
-    // Callbacks from InspectorInstrumentation.
+    // InspectorInstrumentation callbacks.
     void frameNavigated(DocumentLoader*);
-    void frameDetached(Frame*);
+    void frameDetached(Frame&);
     void willDispatchEvent(const Event&, Frame*);
 
     // Notifications from ReplayController.
index 3d872fc..e264560 100644 (file)
@@ -279,7 +279,7 @@ double InspectorResourceAgent::timestamp()
     return m_instrumentingAgents->inspectorEnvironment().executionStopwatch()->elapsedTime();
 }
 
-void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
+void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader& loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
     if (request.hiddenFromInspector()) {
         m_hiddenRequestIdentifiers.add(identifier);
@@ -287,16 +287,16 @@ void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL
     }
 
     String requestId = IdentifiersFactory::requestId(identifier);
-    m_resourcesData->resourceCreated(requestId, m_pageAgent->loaderId(loader));
+    m_resourcesData->resourceCreated(requestId, m_pageAgent->loaderId(&loader));
 
-    CachedResource* cachedResource = loader ? InspectorPageAgent::cachedResource(loader->frame(), request.url()) : nullptr;
+    CachedResource* cachedResource = InspectorPageAgent::cachedResource(loader.frame(), request.url());
     InspectorPageAgent::ResourceType type = cachedResource ? InspectorPageAgent::cachedResourceType(*cachedResource) : m_resourcesData->resourceType(requestId);
     if (type == InspectorPageAgent::OtherResource) {
         if (m_loadingXHRSynchronously)
             type = InspectorPageAgent::XHRResource;
-        else if (equalIgnoringFragmentIdentifier(request.url(), loader->frameLoader()->icon().url()))
+        else if (equalIgnoringFragmentIdentifier(request.url(), loader.frameLoader()->icon().url()))
             type = InspectorPageAgent::ImageResource;
-        else if (equalIgnoringFragmentIdentifier(request.url(), loader->url()) && !loader->isCommitted())
+        else if (equalIgnoringFragmentIdentifier(request.url(), loader.url()) && !loader.isCommitted())
             type = InspectorPageAgent::DocumentResource;
     }
 
@@ -322,8 +322,8 @@ void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL
 
     Inspector::Protocol::Page::ResourceType resourceType = InspectorPageAgent::resourceTypeJson(type);
 
-    RefPtr<Inspector::Protocol::Network::Initiator> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : nullptr);
-    m_frontendDispatcher->requestWillBeSent(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), buildObjectForResourceRequest(request), timestamp(), initiatorObject, buildObjectForResourceResponse(redirectResponse, loader), type != InspectorPageAgent::OtherResource ? &resourceType : nullptr);
+    RefPtr<Inspector::Protocol::Network::Initiator> initiatorObject = buildInitiatorObject(loader.frame() ? loader.frame()->document() : nullptr);
+    m_frontendDispatcher->requestWillBeSent(requestId, m_pageAgent->frameId(loader.frame()), m_pageAgent->loaderId(&loader), loader.url().string(), buildObjectForResourceRequest(request), timestamp(), initiatorObject, buildObjectForResourceResponse(redirectResponse, &loader), type != InspectorPageAgent::OtherResource ? &resourceType : nullptr);
 }
 
 void InspectorResourceAgent::markResourceAsCached(unsigned long identifier)
@@ -334,13 +334,13 @@ void InspectorResourceAgent::markResourceAsCached(unsigned long identifier)
     m_frontendDispatcher->requestServedFromCache(IdentifiersFactory::requestId(identifier));
 }
 
-void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
+void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, DocumentLoader& loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
 {
     if (m_hiddenRequestIdentifiers.contains(identifier))
         return;
 
     String requestId = IdentifiersFactory::requestId(identifier);
-    RefPtr<Inspector::Protocol::Network::Response> resourceResponse = buildObjectForResourceResponse(response, loader);
+    RefPtr<Inspector::Protocol::Network::Response> resourceResponse = buildObjectForResourceResponse(response, &loader);
 
     bool isNotModified = response.httpStatusCode() == 304;
 
@@ -348,7 +348,7 @@ void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, Docume
     if (resourceLoader && resourceLoader->isSubresourceLoader() && !isNotModified)
         cachedResource = static_cast<SubresourceLoader*>(resourceLoader)->cachedResource();
     if (!cachedResource)
-        cachedResource = InspectorPageAgent::cachedResource(loader->frame(), response.url());
+        cachedResource = InspectorPageAgent::cachedResource(loader.frame(), response.url());
 
     if (cachedResource) {
         // Use mime type from cached resource in case the one in response is empty.
@@ -365,10 +365,10 @@ void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, Docume
     if (type != newType && newType != InspectorPageAgent::XHRResource && newType != InspectorPageAgent::OtherResource)
         type = newType;
 
-    m_resourcesData->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), response);
+    m_resourcesData->responseReceived(requestId, m_pageAgent->frameId(loader.frame()), response);
     m_resourcesData->setResourceType(requestId, type);
 
-    m_frontendDispatcher->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), timestamp(), InspectorPageAgent::resourceTypeJson(type), resourceResponse);
+    m_frontendDispatcher->responseReceived(requestId, m_pageAgent->frameId(loader.frame()), m_pageAgent->loaderId(&loader), timestamp(), InspectorPageAgent::resourceTypeJson(type), resourceResponse);
 
     // If we revalidated the resource and got Not modified, send content length following didReceiveResponse
     // as there will be no calls to didReceiveData from the network stack.
@@ -397,17 +397,14 @@ void InspectorResourceAgent::didReceiveData(unsigned long identifier, const char
     m_frontendDispatcher->dataReceived(requestId, timestamp(), dataLength, encodedDataLength);
 }
 
-void InspectorResourceAgent::didFinishLoading(unsigned long identifier, DocumentLoader* loader, double finishTime)
+void InspectorResourceAgent::didFinishLoading(unsigned long identifier, DocumentLoader& loader, double finishTime)
 {
     if (m_hiddenRequestIdentifiers.remove(identifier))
         return;
 
     String requestId = IdentifiersFactory::requestId(identifier);
-    if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::DocumentResource) {
-        m_resourcesData->addResourceSharedBuffer(requestId,
-            loader->frameLoader()->documentLoader()->mainResourceData(),
-            loader->frame()->document()->inputEncoding());
-    }
+    if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::DocumentResource)
+        m_resourcesData->addResourceSharedBuffer(requestId, loader.frameLoader()->documentLoader()->mainResourceData(), loader.frame()->document()->inputEncoding());
 
     m_resourcesData->maybeDecodeDataToContent(requestId);
 
@@ -425,7 +422,7 @@ void InspectorResourceAgent::didFinishLoading(unsigned long identifier, Document
     m_frontendDispatcher->loadingFinished(requestId, finishTime, !sourceMappingURL.isEmpty() ? &sourceMappingURL : nullptr);
 }
 
-void InspectorResourceAgent::didFailLoading(unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
+void InspectorResourceAgent::didFailLoading(unsigned long identifier, DocumentLoader& loader, const ResourceError& error)
 {
     if (m_hiddenRequestIdentifiers.remove(identifier))
         return;
@@ -433,7 +430,7 @@ void InspectorResourceAgent::didFailLoading(unsigned long identifier, DocumentLo
     String requestId = IdentifiersFactory::requestId(identifier);
 
     if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::DocumentResource) {
-        Frame* frame = loader ? loader->frame() : nullptr;
+        Frame* frame = loader.frame();
         if (frame && frame->loader().documentLoader() && frame->document()) {
             m_resourcesData->addResourceSharedBuffer(requestId,
                 frame->loader().documentLoader()->mainResourceData(),
@@ -445,22 +442,22 @@ void InspectorResourceAgent::didFailLoading(unsigned long identifier, DocumentLo
     m_frontendDispatcher->loadingFailed(requestId, timestamp(), error.localizedDescription(), canceled ? &canceled : nullptr);
 }
 
-void InspectorResourceAgent::didLoadResourceFromMemoryCache(DocumentLoader* loader, CachedResource* resource)
+void InspectorResourceAgent::didLoadResourceFromMemoryCache(DocumentLoader& loader, CachedResource& resource)
 {
-    String loaderId = m_pageAgent->loaderId(loader);
-    String frameId = m_pageAgent->frameId(loader->frame());
-    unsigned long identifier = loader->frame()->page()->progress().createUniqueIdentifier();
+    String loaderId = m_pageAgent->loaderId(&loader);
+    String frameId = m_pageAgent->frameId(loader.frame());
+    unsigned long identifier = loader.frame()->page()->progress().createUniqueIdentifier();
     String requestId = IdentifiersFactory::requestId(identifier);
     m_resourcesData->resourceCreated(requestId, loaderId);
-    m_resourcesData->addCachedResource(requestId, resource);
-    if (resource->type() == CachedResource::RawResource) {
-        String rawRequestId = IdentifiersFactory::requestId(downcast<CachedRawResource>(*resource).identifier());
+    m_resourcesData->addCachedResource(requestId, &resource);
+    if (resource.type() == CachedResource::RawResource) {
+        String rawRequestId = IdentifiersFactory::requestId(downcast<CachedRawResource>(resource).identifier());
         m_resourcesData->reuseXHRReplayData(requestId, rawRequestId);
     }
 
-    RefPtr<Inspector::Protocol::Network::Initiator> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : nullptr);
+    RefPtr<Inspector::Protocol::Network::Initiator> initiatorObject = buildInitiatorObject(loader.frame() ? loader.frame()->document() : nullptr);
 
-    m_frontendDispatcher->requestServedFromMemoryCache(requestId, frameId, loaderId, loader->url().string(), timestamp(), initiatorObject, buildObjectForCachedResource(resource, loader));
+    m_frontendDispatcher->requestServedFromMemoryCache(requestId, frameId, loaderId, loader.url().string(), timestamp(), initiatorObject, buildObjectForCachedResource(&resource, &loader));
 }
 
 void InspectorResourceAgent::setInitialScriptContent(unsigned long identifier, const String& sourceString)
@@ -523,15 +520,15 @@ void InspectorResourceAgent::didLoadXHRSynchronously()
     m_loadingXHRSynchronously = false;
 }
 
-void InspectorResourceAgent::willDestroyCachedResource(CachedResource* cachedResource)
+void InspectorResourceAgent::willDestroyCachedResource(CachedResource& cachedResource)
 {
-    Vector<String> requestIds = m_resourcesData->removeCachedResource(cachedResource);
+    Vector<String> requestIds = m_resourcesData->removeCachedResource(&cachedResource);
     if (!requestIds.size())
         return;
 
     String content;
     bool base64Encoded;
-    if (!InspectorPageAgent::cachedResourceContent(cachedResource, &content, &base64Encoded))
+    if (!InspectorPageAgent::cachedResourceContent(&cachedResource, &content, &base64Encoded))
         return;
     Vector<String>::iterator end = requestIds.end();
     for (Vector<String>::iterator it = requestIds.begin(); it != end; ++it)
@@ -549,10 +546,10 @@ void InspectorResourceAgent::didRecalculateStyle()
     m_styleRecalculationInitiator = nullptr;
 }
 
-void InspectorResourceAgent::didScheduleStyleRecalculation(Document* document)
+void InspectorResourceAgent::didScheduleStyleRecalculation(Document& document)
 {
     if (!m_styleRecalculationInitiator)
-        m_styleRecalculationInitiator = buildInitiatorObject(document);
+        m_styleRecalculationInitiator = buildInitiatorObject(&document);
 }
 
 PassRefPtr<Inspector::Protocol::Network::Initiator> InspectorResourceAgent::buildInitiatorObject(Document* document)
@@ -786,12 +783,12 @@ void InspectorResourceAgent::loadResource(ErrorString& errorString, const String
     inspectorThreadableLoaderClient->setLoader(loader.release());
 }
 
-void InspectorResourceAgent::mainFrameNavigated(DocumentLoader* loader)
+void InspectorResourceAgent::mainFrameNavigated(DocumentLoader& loader)
 {
     if (m_cacheDisabled)
         memoryCache().evictResources();
 
-    m_resourcesData->clear(m_pageAgent->loaderId(loader));
+    m_resourcesData->clear(m_pageAgent->loaderId(&loader));
 }
 
 } // namespace WebCore
index 2522555..9c3133b 100644 (file)
@@ -84,17 +84,16 @@ public:
     virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) override;
     virtual void willDestroyFrontendAndBackend(Inspector::InspectorDisconnectReason) override;
 
-    void willSendRequest(unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
+    // InspectorInstrumentation callbacks.
+    void willRecalculateStyle();
+    void didRecalculateStyle();
+    void willSendRequest(unsigned long identifier, DocumentLoader&, ResourceRequest&, const ResourceResponse& redirectResponse);
     void markResourceAsCached(unsigned long identifier);
-    void didReceiveResponse(unsigned long identifier, DocumentLoader* laoder, const ResourceResponse&, ResourceLoader*);
+    void didReceiveResponse(unsigned long identifier, DocumentLoader& loader, const ResourceResponse&, ResourceLoader*);
     void didReceiveData(unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
-    void didFinishLoading(unsigned long identifier, DocumentLoader*, double finishTime);
-    void didFailLoading(unsigned long identifier, DocumentLoader*, const ResourceError&);
-    void didLoadResourceFromMemoryCache(DocumentLoader*, CachedResource*);
-    void mainFrameNavigated(DocumentLoader*);
-    void setInitialScriptContent(unsigned long identifier, const String& sourceString);
-    void didReceiveScriptResponse(unsigned long identifier);
-
+    void didFinishLoading(unsigned long identifier, DocumentLoader&, double finishTime);
+    void didFailLoading(unsigned long identifier, DocumentLoader&, const ResourceError&);
+    void didLoadResourceFromMemoryCache(DocumentLoader&, CachedResource&);
     void documentThreadableLoaderStartedLoadingForClient(unsigned long identifier, ThreadableLoaderClient*);
     void willLoadXHR(ThreadableLoaderClient*, const String& method, const URL&, bool async, PassRefPtr<FormData> body, const HTTPHeaderMap& headers, bool includeCrendentials);
     void didFailXHRLoading(ThreadableLoaderClient*);
@@ -102,16 +101,8 @@ public:
     void didReceiveXHRResponse(unsigned long identifier);
     void willLoadXHRSynchronously();
     void didLoadXHRSynchronously();
-
-    void willDestroyCachedResource(CachedResource*);
-
-    // FIXME: InspectorResourceAgent should now be aware of style recalculation.
-    void willRecalculateStyle();
-    void didRecalculateStyle();
-    void didScheduleStyleRecalculation(Document*);
-
-    PassRefPtr<Inspector::Protocol::Network::Initiator> buildInitiatorObject(Document*);
-
+    void didReceiveScriptResponse(unsigned long identifier);
+    void willDestroyCachedResource(CachedResource&);
 #if ENABLE(WEB_SOCKETS)
     void didCreateWebSocket(unsigned long identifier, const URL& requestURL);
     void willSendWebSocketHandshakeRequest(unsigned long identifier, const ResourceRequest&);
@@ -122,6 +113,13 @@ public:
     void didReceiveWebSocketFrameError(unsigned long identifier, const String&);
 #endif
 
+    void mainFrameNavigated(DocumentLoader&);
+    void setInitialScriptContent(unsigned long identifier, const String& sourceString);
+
+    void didScheduleStyleRecalculation(Document&);
+
+    PassRefPtr<Inspector::Protocol::Network::Initiator> buildInitiatorObject(Document*);
+
     // Called from frontend.
     virtual void enable(ErrorString&) override;
     virtual void disable(ErrorString&) override;
index 8894277..bd3278e 100644 (file)
@@ -44,6 +44,7 @@
 #include "InstrumentingAgents.h"
 #include "IntRect.h"
 #include "JSDOMWindow.h"
+#include "MainFrame.h"
 #include "PageScriptDebugServer.h"
 #include "RenderElement.h"
 #include "RenderView.h"
@@ -274,18 +275,18 @@ void InspectorTimelineAgent::didDispatchEvent()
     didCompleteCurrentRecord(TimelineRecordType::EventDispatch);
 }
 
-void InspectorTimelineAgent::didInvalidateLayout(Frame* frame)
+void InspectorTimelineAgent::didInvalidateLayout(Frame& frame)
 {
-    appendRecord(InspectorObject::create(), TimelineRecordType::InvalidateLayout, true, frame);
+    appendRecord(InspectorObject::create(), TimelineRecordType::InvalidateLayout, true, &frame);
 }
 
-void InspectorTimelineAgent::willLayout(Frame* frame)
+void InspectorTimelineAgent::willLayout(Frame& frame)
 {
-    RenderObject* root = frame->view()->layoutRoot();
+    RenderObject* root = frame.view()->layoutRoot();
     bool partialLayout = !!root;
 
     if (!partialLayout)
-        root = frame->contentRenderer();
+        root = frame.contentRenderer();
 
     unsigned dirtyObjects = 0;
     unsigned totalObjects = 0;
@@ -294,7 +295,7 @@ void InspectorTimelineAgent::willLayout(Frame* frame)
         if (o->needsLayout())
             ++dirtyObjects;
     }
-    pushCurrentRecord(TimelineRecordFactory::createLayoutData(dirtyObjects, totalObjects, partialLayout), TimelineRecordType::Layout, true, frame);
+    pushCurrentRecord(TimelineRecordFactory::createLayoutData(dirtyObjects, totalObjects, partialLayout), TimelineRecordType::Layout, true, &frame);
 }
 
 void InspectorTimelineAgent::didLayout(RenderObject* root)
@@ -327,9 +328,9 @@ void InspectorTimelineAgent::didRecalculateStyle()
     didCompleteCurrentRecord(TimelineRecordType::RecalculateStyles);
 }
 
-void InspectorTimelineAgent::willPaint(Frame* frame)
+void InspectorTimelineAgent::willPaint(Frame& frame)
 {
-    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Paint, true, frame);
+    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Paint, true, &frame);
 }
 
 void InspectorTimelineAgent::didPaint(RenderObject* renderer, const LayoutRect& clipRect)
@@ -342,9 +343,9 @@ void InspectorTimelineAgent::didPaint(RenderObject* renderer, const LayoutRect&
     didCompleteCurrentRecord(TimelineRecordType::Paint);
 }
 
-void InspectorTimelineAgent::willScroll(Frame* frame)
+void InspectorTimelineAgent::willScroll(Frame& frame)
 {
-    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::ScrollLayer, false, frame);
+    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::ScrollLayer, false, &frame);
 }
 
 void InspectorTimelineAgent::didScroll()
@@ -406,19 +407,19 @@ void InspectorTimelineAgent::didDispatchXHRLoadEvent()
     didCompleteCurrentRecord(TimelineRecordType::XHRLoad);
 }
 
-void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber, Frame* frame)
+void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber, Frame& frame)
 {
-    pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, frame);
+    pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, &frame);
 
-    if (frame && !m_callStackDepth) {
+    if (!m_callStackDepth) {
         ++m_callStackDepth;
-        startProfiling(frame, ASCIILiteral("Timeline EvaluateScript"), m_instrumentingAgents->inspectorEnvironment().executionStopwatch());
+        startProfiling(&frame, ASCIILiteral("Timeline EvaluateScript"), m_instrumentingAgents->inspectorEnvironment().executionStopwatch());
     }
 }
 
-void InspectorTimelineAgent::didEvaluateScript(Frame* frame)
+void InspectorTimelineAgent::didEvaluateScript(Frame& frame)
 {
-    if (frame && m_callStackDepth) {
+    if (m_callStackDepth) {
         --m_callStackDepth;
         ASSERT(m_callStackDepth >= 0);
 
@@ -429,7 +430,7 @@ void InspectorTimelineAgent::didEvaluateScript(Frame* frame)
             TimelineRecordEntry& entry = m_recordStack.last();
             ASSERT(entry.type == TimelineRecordType::EvaluateScript);
 
-            RefPtr<JSC::Profile> profile = stopProfiling(frame, ASCIILiteral("Timeline EvaluateScript"));
+            RefPtr<JSC::Profile> profile = stopProfiling(&frame, ASCIILiteral("Timeline EvaluateScript"));
             if (profile)
                 TimelineRecordFactory::appendProfile(entry.data.get(), profile.release());
         }
@@ -476,31 +477,29 @@ void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier,
     appendRecord(TimelineRecordFactory::createResourceFinishData(IdentifiersFactory::requestId(identifier), didFail, finishTime * 1000), TimelineRecordType::ResourceFinish, false, frame);
 }
 
-void InspectorTimelineAgent::didTimeStamp(Frame* frame, const String& message)
+void InspectorTimelineAgent::didTimeStamp(Frame& frame, const String& message)
 {
-    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeStamp, true, frame);
+    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeStamp, true, &frame);
 }
 
-void InspectorTimelineAgent::time(Frame* frame, const String& message)
+void InspectorTimelineAgent::time(Frame& frame, const String& message)
 {
-    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::Time, true, frame);
+    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::Time, true, &frame);
 }
 
-void InspectorTimelineAgent::timeEnd(Frame* frame, const String& message)
+void InspectorTimelineAgent::timeEnd(Frame& frame, const String& message)
 {
-    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeEnd, true, frame);
+    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeEnd, true, &frame);
 }
 
-void InspectorTimelineAgent::didMarkDOMContentEvent(Frame* frame)
+void InspectorTimelineAgent::didMarkDOMContentEvent(Frame& frame)
 {
-    bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame());
-    appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRecordType::MarkDOMContent, false, frame);
+    appendRecord(TimelineRecordFactory::createMarkData(frame.isMainFrame()), TimelineRecordType::MarkDOMContent, false, &frame);
 }
 
-void InspectorTimelineAgent::didMarkLoadEvent(Frame* frame)
+void InspectorTimelineAgent::didMarkLoadEvent(Frame& frame)
 {
-    bool isMainFrame = frame && m_pageAgent && (frame == m_pageAgent->mainFrame());
-    appendRecord(TimelineRecordFactory::createMarkData(isMainFrame), TimelineRecordType::MarkLoad, false, frame);
+    appendRecord(TimelineRecordFactory::createMarkData(frame.isMainFrame()), TimelineRecordType::MarkLoad, false, &frame);
 }
 
 void InspectorTimelineAgent::didCommitLoad()
index 69e09a0..352a1f5 100644 (file)
@@ -142,62 +142,49 @@ public:
     void startFromConsole(JSC::ExecState*, const String &title);
     PassRefPtr<JSC::Profile> stopFromConsole(JSC::ExecState*, const String& title);
 
+    // InspectorInstrumentation callbacks.
+    void didScheduleResourceRequest(const String& url, Frame*);
+    void didInstallTimer(int timerId, int timeout, bool singleShot, Frame*);
+    void didRemoveTimer(int timerId, Frame*);
+    void willFireTimer(int timerId, Frame*);
+    void didFireTimer();
     void willCallFunction(const String& scriptName, int scriptLine, Frame*);
     void didCallFunction(Frame*);
-
+    void willDispatchXHRReadyStateChangeEvent(const String&, int, Frame*);
+    void didDispatchXHRReadyStateChangeEvent();
     void willDispatchEvent(const Event&, Frame*);
     void didDispatchEvent();
-
-    void didInvalidateLayout(Frame*);
-    void willLayout(Frame*);
+    void willEvaluateScript(const String&, int, Frame&);
+    void didEvaluateScript(Frame&);
+    void didInvalidateLayout(Frame&);
+    void willLayout(Frame&);
     void didLayout(RenderObject*);
-
-    void didScheduleStyleRecalculation(Frame*);
+    void willScroll(Frame&);
+    void didScroll();
+    void willDispatchXHRLoadEvent(const String&, Frame*);
+    void didDispatchXHRLoadEvent();
+    void willPaint(Frame&);
+    void didPaint(RenderObject*, const LayoutRect&);
     void willRecalculateStyle(Frame*);
     void didRecalculateStyle();
-
-    void willPaint(Frame*);
-    void didPaint(RenderObject*, const LayoutRect&);
-
-    void willScroll(Frame*);
-    void didScroll();
-
+    void didScheduleStyleRecalculation(Frame*);
     void willWriteHTML(unsigned startLine, Frame*);
     void didWriteHTML(unsigned endLine);
-
-    void didInstallTimer(int timerId, int timeout, bool singleShot, Frame*);
-    void didRemoveTimer(int timerId, Frame*);
-    void willFireTimer(int timerId, Frame*);
-    void didFireTimer();
-
-    void willDispatchXHRReadyStateChangeEvent(const String&, int, Frame*);
-    void didDispatchXHRReadyStateChangeEvent();
-    void willDispatchXHRLoadEvent(const String&, Frame*);
-    void didDispatchXHRLoadEvent();
-
-    void willEvaluateScript(const String&, int, Frame*);
-    void didEvaluateScript(Frame*);
-
-    void didTimeStamp(Frame*, const String&);
-    void didMarkDOMContentEvent(Frame*);
-    void didMarkLoadEvent(Frame*);
-
-    void time(Frame*, const String&);
-    void timeEnd(Frame*, const String&);
-
-    void didScheduleResourceRequest(const String& url, Frame*);
+    void didTimeStamp(Frame&, const String&);
+    void didMarkDOMContentEvent(Frame&);
+    void didMarkLoadEvent(Frame&);
     void willSendResourceRequest(unsigned long, const ResourceRequest&, Frame*);
     void willReceiveResourceResponse(unsigned long, const ResourceResponse&, Frame*);
     void didReceiveResourceResponse();
     void didFinishLoadingResource(unsigned long, bool didFail, double finishTime, Frame*);
     void willReceiveResourceData(unsigned long identifier, Frame*, int length);
     void didReceiveResourceData();
-
     void didRequestAnimationFrame(int callbackId, Frame*);
     void didCancelAnimationFrame(int callbackId, Frame*);
     void willFireAnimationFrame(int callbackId, Frame*);
     void didFireAnimationFrame();
-
+    void time(Frame&, const String&);
+    void timeEnd(Frame&, const String&);
 #if ENABLE(WEB_SOCKETS)
     void didCreateWebSocket(unsigned long identifier, const URL&, const String& protocol, Frame*);
     void willSendWebSocketHandshakeRequest(unsigned long identifier, Frame*);
index 971bf98..11fb2d5 100644 (file)
@@ -100,7 +100,7 @@ void PageRuntimeAgent::disable(ErrorString& errorString)
     InspectorRuntimeAgent::disable(errorString);
 }
 
-void PageRuntimeAgent::didCreateMainWorldContext(Frame* frame)
+void PageRuntimeAgent::didCreateMainWorldContext(Frame& frame)
 {
     m_mainWorldContextCreated = true;
 
@@ -108,21 +108,11 @@ void PageRuntimeAgent::didCreateMainWorldContext(Frame* frame)
         return;
 
     ASSERT(m_frontendDispatcher);
-    String frameId = m_pageAgent->frameId(frame);
-    JSC::ExecState* scriptState = mainWorldExecState(frame);
+    String frameId = m_pageAgent->frameId(&frame);
+    JSC::ExecState* scriptState = mainWorldExecState(&frame);
     notifyContextCreated(frameId, scriptState, nullptr, true);
 }
 
-void PageRuntimeAgent::didCreateIsolatedContext(Frame* frame, JSC::ExecState* scriptState, SecurityOrigin* origin)
-{
-    if (!enabled())
-        return;
-
-    ASSERT(m_frontendDispatcher);
-    String frameId = m_pageAgent->frameId(frame);
-    notifyContextCreated(frameId, scriptState, origin, false);
-}
-
 JSC::VM& PageRuntimeAgent::globalVM()
 {
     return JSDOMWindowBase::commonVM();
index 1c12cd4..c412fbc 100644 (file)
@@ -57,14 +57,14 @@ class PageRuntimeAgent final : public Inspector::InspectorRuntimeAgent {
 public:
     PageRuntimeAgent(Inspector::InjectedScriptManager*, Page*, InspectorPageAgent*);
     virtual ~PageRuntimeAgent() { }
-    
+
     virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) override;
     virtual void willDestroyFrontendAndBackend(Inspector::InspectorDisconnectReason) override;
     virtual void enable(ErrorString&) override;
     virtual void disable(ErrorString&) override;
 
-    void didCreateMainWorldContext(Frame*);
-    void didCreateIsolatedContext(Frame*, JSC::ExecState*, SecurityOrigin*);
+    // InspectorInstrumentation callbacks.
+    void didCreateMainWorldContext(Frame&);
 
 private:
     virtual JSC::VM& globalVM() override;
index ac75286..139f05c 100644 (file)
@@ -425,18 +425,17 @@ void ReplayController::frameNavigated(DocumentLoader* loader)
     loader->frame()->script().globalObject(mainThreadNormalWorld())->setInputCursor(m_activeCursor.get());
 }
 
-void ReplayController::frameDetached(Frame* frame)
+void ReplayController::frameDetached(Frame& frame)
 {
     ASSERT(m_sessionState != SessionState::Inactive);
-    ASSERT(frame);
 
-    if (!frame->document())
+    if (!frame.document())
         return;
 
     // If the frame's cursor isn't capturing or replaying, we should do nothing.
     // This is the case for the "outbound" frame when starting capture, or when
     // we clear the input cursor to finish or prematurely unload a segment.
-    if (frame->document()->inputCursor().isCapturing()) {
+    if (frame.document()->inputCursor().isCapturing()) {
         ASSERT(m_segmentState == SegmentState::Appending);
         completeSegment();
     }
index ea1419d..5e0796d 100644 (file)
@@ -132,7 +132,7 @@ public:
 
     // InspectorReplayAgent notifications.
     void frameNavigated(DocumentLoader*);
-    void frameDetached(Frame*);
+    void frameDetached(Frame&);
     void willDispatchEvent(const Event&, Frame*);
 
     Page& page() const { return m_page; }