Web Inspector: pass parameters to inspector instrumentation by reference where possible
authorburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Jan 2015 21:30:33 +0000 (21:30 +0000)
committerburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Jan 2015 21:30:33 +0000 (21:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139981

Reviewed by Andreas Kling.

Clean up inspector instrumentation entry points throughout WebCore. In particular, make
parameters pass-by-reference if they are not nullable. Also standardize quirky parameter
orders and do other small cleanups in InspectorInstrumentation and at callsites.

Inspector agents still take the pertinent parameters by pointer even when they could be
passed by reference. This will be addressed in a follow-up change.

No new tests, no behavior changed.

* WebCore.exp.in:
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::evaluateInWorld):
* css/PropertySetCSSStyleDeclaration.cpp:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
(WebCore::SelectorChecker::matchesFocusPseudoClass):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::styleForElement):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::elementIsActive):
(WebCore::SelectorCompiler::elementIsActiveForStyleResolution):
(WebCore::SelectorCompiler::elementIsHovered):
(WebCore::SelectorCompiler::elementIsHoveredForStyleResolution):
* dom/CharacterData.cpp:
(WebCore::CharacterData::dispatchModifiedEvent): Remove unnecessary ENABLE guard.
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::insertBefore):
(WebCore::ContainerNode::replaceChild):
(WebCore::ContainerNode::removeBetween):
(WebCore::ContainerNode::appendChild):
(WebCore::dispatchChildRemovalEvents):
* dom/ContainerNodeAlgorithms.h:
(WebCore::ChildNodeInsertionNotifier::notify): Remove unnecessary ENABLE guard.
* dom/Document.cpp:
(WebCore::Document::scheduleStyleRecalc):
(WebCore::Document::recalcStyle):
(WebCore::Document::finishedParsing): This is safe because we checked the argument.
* dom/Element.cpp:
(WebCore::Element::addShadowRoot):
(WebCore::Element::removeShadowRoot): This is safe because we checked the argument.
(WebCore::Element::willModifyAttribute): Remove unnecessary ENABLE guard.
(WebCore::Element::didAddAttribute):
(WebCore::Element::didModifyAttribute):
(WebCore::Element::didRemoveAttribute):
* dom/EventTarget.cpp:
(WebCore::EventTarget::fireEventListeners): This is safe because the type test would fail if null.
* dom/NamedFlowCollection.cpp: Pass by reference since code already assumes non-null.
(WebCore::NamedFlowCollection::ensureFlowWithName):
(WebCore::NamedFlowCollection::discardNamedFlow):
* dom/PseudoElement.cpp:
(WebCore::PseudoElement::~PseudoElement):
* dom/StyledElement.cpp:
(WebCore::StyledElement::styleAttributeChanged):
(WebCore::StyledElement::inlineStyleChanged):
* inspector/InspectorConsoleInstrumentation.h:
(WebCore::InspectorInstrumentation::addMessageToConsole):
(WebCore::InspectorInstrumentation::consoleCount):
(WebCore::InspectorInstrumentation::startConsoleTiming):
(WebCore::InspectorInstrumentation::stopConsoleTiming):
(WebCore::InspectorInstrumentation::consoleTimeStamp):
(WebCore::InspectorInstrumentation::startProfiling):
(WebCore::InspectorInstrumentation::stopProfiling):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::didClearWindowObjectInWorld):
(WebCore::InspectorController::connectFrontend):
(WebCore::InspectorController::disconnectFrontend):
* inspector/InspectorController.h: Remove instrumentationForPage() in favor of using instrumentingAgentsForPage() directly.
* inspector/InspectorDatabaseInstrumentation.h:
(WebCore::InspectorInstrumentation::didOpenDatabase):
* inspector/InspectorInstrumentation.cpp: Add missing s_ prefix for global s_instrumentingAgentSets. Pass the instrumenting
agent by reference since it was already null-checked if we reached a slow path for instrumentation.
(WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
(WebCore::InspectorInstrumentation::isDebuggerPausedImpl):
(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::frameWindowDiscardedImpl):
(WebCore::InspectorInstrumentation::mediaQueryResultChangedImpl):
(WebCore::InspectorInstrumentation::didPushShadowRootImpl):
(WebCore::InspectorInstrumentation::willPopShadowRootImpl):
(WebCore::InspectorInstrumentation::didCreateNamedFlowImpl):
(WebCore::InspectorInstrumentation::willRemoveNamedFlowImpl):
(WebCore::InspectorInstrumentation::didChangeRegionOversetImpl):
(WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElementImpl):
(WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElementImpl):
(WebCore::InspectorInstrumentation::mouseDidMoveOverElementImpl):
(WebCore::InspectorInstrumentation::didScrollImpl):
(WebCore::InspectorInstrumentation::handleTouchEventImpl):
(WebCore::InspectorInstrumentation::handleMousePressImpl):
(WebCore::InspectorInstrumentation::forcePseudoStateImpl):
(WebCore::InspectorInstrumentation::characterDataModifiedImpl):
(WebCore::InspectorInstrumentation::willSendXMLHttpRequestImpl):
(WebCore::InspectorInstrumentation::didScheduleResourceRequestImpl):
(WebCore::InspectorInstrumentation::didInstallTimerImpl):
(WebCore::InspectorInstrumentation::didRemoveTimerImpl):
(WebCore::InspectorInstrumentation::willCallFunctionImpl):
(WebCore::InspectorInstrumentation::willDispatchXHRReadyStateChangeEventImpl):
(WebCore::InspectorInstrumentation::willDispatchEventImpl):
(WebCore::InspectorInstrumentation::willHandleEventImpl):
(WebCore::InspectorInstrumentation::didHandleEventImpl): Add proper cookie guard and pass by reference.
(WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
(WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
(WebCore::InspectorInstrumentation::didEvaluateScriptImpl):
(WebCore::InspectorInstrumentation::scriptsEnabledImpl):
(WebCore::InspectorInstrumentation::didCreateIsolatedContextImpl): Removed, as there are no callers from WebCore. Possible V8 artifact.
(WebCore::InspectorInstrumentation::willFireTimerImpl):
(WebCore::InspectorInstrumentation::didFireTimerImpl): Add proper cookie guard and pass by reference.
(WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
(WebCore::InspectorInstrumentation::willLayoutImpl):
(WebCore::InspectorInstrumentation::willDispatchXHRLoadEventImpl):
(WebCore::InspectorInstrumentation::willPaintImpl):
(WebCore::InspectorInstrumentation::didPaintImpl):
(WebCore::InspectorInstrumentation::willScrollLayerImpl):
(WebCore::InspectorInstrumentation::didScrollLayerImpl):
(WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
(WebCore::InspectorInstrumentation::didRecalculateStyleImpl): Add proper cookie guard and pass by reference.
(WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
(WebCore::InspectorInstrumentation::applyEmulatedMediaImpl): Pass string by reference.
(WebCore::InspectorInstrumentation::willSendRequestImpl):
(WebCore::InspectorInstrumentation::continueAfterPingLoaderImpl):
(WebCore::InspectorInstrumentation::markResourceAsCachedImpl):
(WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):
(WebCore::InspectorInstrumentation::willReceiveResourceDataImpl):
(WebCore::InspectorInstrumentation::willReceiveResourceResponseImpl):
(WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl): Add proper cookie guard and pass by reference.
(WebCore::InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl):
(WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl):
(WebCore::InspectorInstrumentation::continueWithPolicyDownloadImpl):
(WebCore::InspectorInstrumentation::continueWithPolicyIgnoreImpl):
(WebCore::InspectorInstrumentation::didReceiveDataImpl):
(WebCore::InspectorInstrumentation::didFinishLoadingImpl):
(WebCore::InspectorInstrumentation::didFailLoadingImpl):
(WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClientImpl):
(WebCore::InspectorInstrumentation::willLoadXHRImpl):
(WebCore::InspectorInstrumentation::didFailXHRLoadingImpl):
(WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
(WebCore::InspectorInstrumentation::didReceiveXHRResponseImpl):
(WebCore::InspectorInstrumentation::willLoadXHRSynchronouslyImpl):
(WebCore::InspectorInstrumentation::didLoadXHRSynchronouslyImpl):
(WebCore::InspectorInstrumentation::scriptImportedImpl):
(WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSPImpl):
(WebCore::InspectorInstrumentation::didReceiveScriptResponseImpl):
(WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl): Use Frame::isMainFrame().
(WebCore::InspectorInstrumentation::loadEventFiredImpl): Use Frame::isMainFrame().
(WebCore::InspectorInstrumentation::frameDetachedFromParentImpl):
(WebCore::InspectorInstrumentation::didCommitLoadImpl):
(WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl):
(WebCore::InspectorInstrumentation::loaderDetachedFromFrameImpl):
(WebCore::InspectorInstrumentation::willRunJavaScriptDialogImpl):
(WebCore::InspectorInstrumentation::willDestroyCachedResourceImpl): Use a range-based iterator.
(WebCore::InspectorInstrumentation::willWriteHTMLImpl):
(WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
(WebCore::InspectorInstrumentation::consoleCountImpl):
(WebCore::InspectorInstrumentation::startConsoleTimingImpl):
(WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
(WebCore::InspectorInstrumentation::consoleTimeStampImpl):
(WebCore::InspectorInstrumentation::startProfilingImpl):
(WebCore::InspectorInstrumentation::stopProfilingImpl):
(WebCore::InspectorInstrumentation::didOpenDatabaseImpl):
(WebCore::InspectorInstrumentation::didDispatchDOMStorageEventImpl):
(WebCore::InspectorInstrumentation::shouldPauseDedicatedWorkerOnStartImpl):
(WebCore::InspectorInstrumentation::didStartWorkerGlobalScopeImpl):
(WebCore::InspectorInstrumentation::willEvaluateWorkerScript):
(WebCore::InspectorInstrumentation::workerGlobalScopeTerminatedImpl):
(WebCore::InspectorInstrumentation::didCreateWebSocketImpl):
(WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl):
(WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl):
(WebCore::InspectorInstrumentation::didCloseWebSocketImpl):
(WebCore::InspectorInstrumentation::didReceiveWebSocketFrameImpl):
(WebCore::InspectorInstrumentation::didReceiveWebSocketFrameErrorImpl):
(WebCore::InspectorInstrumentation::didSendWebSocketFrameImpl):
(WebCore::InspectorInstrumentation::sessionCreatedImpl):
(WebCore::InspectorInstrumentation::sessionLoadedImpl):
(WebCore::InspectorInstrumentation::sessionModifiedImpl):
(WebCore::InspectorInstrumentation::segmentCreatedImpl):
(WebCore::InspectorInstrumentation::segmentCompletedImpl):
(WebCore::InspectorInstrumentation::segmentLoadedImpl):
(WebCore::InspectorInstrumentation::segmentUnloadedImpl):
(WebCore::InspectorInstrumentation::captureStartedImpl):
(WebCore::InspectorInstrumentation::captureStoppedImpl):
(WebCore::InspectorInstrumentation::playbackStartedImpl):
(WebCore::InspectorInstrumentation::playbackPausedImpl):
(WebCore::InspectorInstrumentation::playbackHitPositionImpl):
(WebCore::InspectorInstrumentation::playbackFinishedImpl):
(WebCore::InspectorInstrumentation::networkStateChangedImpl):
(WebCore::InspectorInstrumentation::updateApplicationCacheStatusImpl):
(WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded):
(WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent):
(WebCore::InspectorInstrumentation::didRequestAnimationFrameImpl):
(WebCore::InspectorInstrumentation::didCancelAnimationFrameImpl):
(WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
(WebCore::InspectorInstrumentation::registerInstrumentingAgents):
(WebCore::InspectorInstrumentation::unregisterInstrumentingAgents):
(WebCore::InspectorInstrumentation::retrieveTimelineAgent):
(WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Add by-reference version which contains the logic from instrumentationForPage().
(WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer):
(WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope):
(WebCore::InspectorInstrumentation::instrumentingAgentsForNonDocumentContext):
(WebCore::InspectorInstrumentation::layerTreeDidChangeImpl):
(WebCore::InspectorInstrumentation::renderLayerDestroyedImpl):
(WebCore::InspectorInstrumentation::pseudoElementDestroyedImpl):
(WebCore::InspectorInstrumentation::didCreateIsolatedContextImpl): Deleted.
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didClearWindowObjectInWorld):
(WebCore::InspectorInstrumentation::isDebuggerPaused):
(WebCore::InspectorInstrumentation::willInsertDOMNode):
(WebCore::InspectorInstrumentation::didInsertDOMNode):
(WebCore::InspectorInstrumentation::willRemoveDOMNode):
(WebCore::InspectorInstrumentation::didRemoveDOMNode):
(WebCore::InspectorInstrumentation::willModifyDOMAttr):
(WebCore::InspectorInstrumentation::didModifyDOMAttr):
(WebCore::InspectorInstrumentation::didRemoveDOMAttr):
(WebCore::InspectorInstrumentation::didInvalidateStyleAttr):
(WebCore::InspectorInstrumentation::frameWindowDiscarded):
(WebCore::InspectorInstrumentation::mediaQueryResultChanged):
(WebCore::InspectorInstrumentation::didPushShadowRoot):
(WebCore::InspectorInstrumentation::willPopShadowRoot):
(WebCore::InspectorInstrumentation::didCreateNamedFlow):
(WebCore::InspectorInstrumentation::willRemoveNamedFlow):
(WebCore::InspectorInstrumentation::didChangeRegionOverset):
(WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElement):
(WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElement):
(WebCore::InspectorInstrumentation::mouseDidMoveOverElement):
(WebCore::InspectorInstrumentation::handleTouchEvent):
(WebCore::InspectorInstrumentation::handleMousePress): Take Frame by reference instead of Page by pointer.
(WebCore::InspectorInstrumentation::forcePseudoState):
(WebCore::InspectorInstrumentation::characterDataModified):
(WebCore::InspectorInstrumentation::willSendXMLHttpRequest):
(WebCore::InspectorInstrumentation::didScheduleResourceRequest):
(WebCore::InspectorInstrumentation::didInstallTimer):
(WebCore::InspectorInstrumentation::didRemoveTimer):
(WebCore::InspectorInstrumentation::willCallFunction):
(WebCore::InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent):
(WebCore::InspectorInstrumentation::willDispatchEvent):
(WebCore::InspectorInstrumentation::willHandleEvent): Pass a const event reference.
(WebCore::InspectorInstrumentation::willDispatchEventOnWindow):
(WebCore::InspectorInstrumentation::willEvaluateScript):
(WebCore::InspectorInstrumentation::didEvaluateScript):
(WebCore::InspectorInstrumentation::scriptsEnabled):
(WebCore::InspectorInstrumentation::willFireTimer):
(WebCore::InspectorInstrumentation::didInvalidateLayout):
(WebCore::InspectorInstrumentation::willLayout):
(WebCore::InspectorInstrumentation::didScroll):
(WebCore::InspectorInstrumentation::willDispatchXHRLoadEvent):
(WebCore::InspectorInstrumentation::willPaint):
(WebCore::InspectorInstrumentation::didPaint):
(WebCore::InspectorInstrumentation::willScrollLayer):
(WebCore::InspectorInstrumentation::didScrollLayer):
(WebCore::InspectorInstrumentation::willRecalculateStyle):
(WebCore::InspectorInstrumentation::didScheduleStyleRecalculation):
(WebCore::InspectorInstrumentation::applyEmulatedMedia): Pass string by reference.
(WebCore::InspectorInstrumentation::willSendRequest):
(WebCore::InspectorInstrumentation::continueAfterPingLoader):
(WebCore::InspectorInstrumentation::markResourceAsCached):
(WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache):
(WebCore::InspectorInstrumentation::willReceiveResourceData):
(WebCore::InspectorInstrumentation::willReceiveResourceResponse):
(WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied):
(WebCore::InspectorInstrumentation::continueWithPolicyDownload):
(WebCore::InspectorInstrumentation::continueWithPolicyIgnore):
(WebCore::InspectorInstrumentation::didReceiveData):
(WebCore::InspectorInstrumentation::didFinishLoading):
(WebCore::InspectorInstrumentation::didFailLoading):
(WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient): No need to go through
ScriptExecutionContext interface, as it's always a Document.
(WebCore::InspectorInstrumentation::willLoadXHR):
(WebCore::InspectorInstrumentation::didFailXHRLoading):
(WebCore::InspectorInstrumentation::didFinishXHRLoading):
(WebCore::InspectorInstrumentation::didReceiveXHRResponse):
(WebCore::InspectorInstrumentation::willLoadXHRSynchronously):
(WebCore::InspectorInstrumentation::didLoadXHRSynchronously):
(WebCore::InspectorInstrumentation::scriptImported):
(WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSP):
(WebCore::InspectorInstrumentation::didReceiveScriptResponse):
(WebCore::InspectorInstrumentation::domContentLoadedEventFired):
(WebCore::InspectorInstrumentation::loadEventFired):
(WebCore::InspectorInstrumentation::frameDetachedFromParent):
(WebCore::InspectorInstrumentation::didCommitLoad):
(WebCore::InspectorInstrumentation::frameDocumentUpdated):
(WebCore::InspectorInstrumentation::loaderDetachedFromFrame):
(WebCore::InspectorInstrumentation::willRunJavaScriptDialog):
(WebCore::InspectorInstrumentation::willDestroyCachedResource):
(WebCore::InspectorInstrumentation::willWriteHTML):
(WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent):
(WebCore::InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart):
(WebCore::InspectorInstrumentation::didStartWorkerGlobalScope):
(WebCore::InspectorInstrumentation::workerGlobalScopeTerminated):
(WebCore::InspectorInstrumentation::didCreateWebSocket):
(WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest):
(WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse):
(WebCore::InspectorInstrumentation::didCloseWebSocket):
(WebCore::InspectorInstrumentation::didReceiveWebSocketFrame):
(WebCore::InspectorInstrumentation::didReceiveWebSocketFrameError):
(WebCore::InspectorInstrumentation::didSendWebSocketFrame):
(WebCore::InspectorInstrumentation::sessionCreated):
(WebCore::InspectorInstrumentation::sessionLoaded):
(WebCore::InspectorInstrumentation::sessionModified):
(WebCore::InspectorInstrumentation::segmentCreated):
(WebCore::InspectorInstrumentation::segmentCompleted):
(WebCore::InspectorInstrumentation::segmentLoaded):
(WebCore::InspectorInstrumentation::segmentUnloaded):
(WebCore::InspectorInstrumentation::captureStarted):
(WebCore::InspectorInstrumentation::captureStopped):
(WebCore::InspectorInstrumentation::playbackStarted):
(WebCore::InspectorInstrumentation::playbackPaused):
(WebCore::InspectorInstrumentation::playbackFinished):
(WebCore::InspectorInstrumentation::playbackHitPosition):
(WebCore::InspectorInstrumentation::networkStateChanged):
(WebCore::InspectorInstrumentation::updateApplicationCacheStatus):
(WebCore::InspectorInstrumentation::didRequestAnimationFrame):
(WebCore::InspectorInstrumentation::didCancelAnimationFrame):
(WebCore::InspectorInstrumentation::willFireAnimationFrame):
(WebCore::InspectorInstrumentation::layerTreeDidChange):
(WebCore::InspectorInstrumentation::renderLayerDestroyed):
(WebCore::InspectorInstrumentation::pseudoElementDestroyed):
(WebCore::InspectorInstrumentation::instrumentingAgentsForFrame):
(WebCore::InspectorInstrumentation::instrumentingAgentsForDocument):
(WebCore::InspectorInstrumentation::didCreateIsolatedContext): Deleted.
* inspector/InspectorInstrumentationCookie.cpp: Take a reference, use default RefPtr constructor.
(WebCore::InspectorInstrumentationCookie::InspectorInstrumentationCookie):
* inspector/InspectorInstrumentationCookie.h: Fix misplaced ENABLE guard.
* inspector/InstrumentingAgents.cpp:
(WebCore::instrumentationForPage): Deleted.
(WebCore::instrumentationForWorkerGlobalScope): Deleted.
* inspector/InstrumentingAgents.h:
* inspector/WorkerInspectorController.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):
(WebCore::DocumentLoader::continueAfterContentPolicy):
(WebCore::DocumentLoader::detachFromFrame):
* loader/DocumentThreadableLoader.cpp: Remove unnecessary ENABLE(INSPECTOR) guards, as these inlined calls
are boiled away by the compiler if !ENABLE(INSPECTOR).
(WebCore::DocumentThreadableLoader::didReceiveData):
(WebCore::DocumentThreadableLoader::didFinishLoading):
(WebCore::DocumentThreadableLoader::didFail):
(WebCore::DocumentThreadableLoader::preflightFailure):
(WebCore::DocumentThreadableLoader::loadRequest):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::detachFromParent):
(WebCore::FrameLoader::loadedResourceFromMemoryCache):
(WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
(WebCore::FrameLoader::dispatchDidCommitLoad):
* loader/ResourceLoadScheduler.cpp:
(WebCore::ResourceLoadScheduler::notifyDidScheduleResourceRequest):
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::willSendRequest): Remove unnecessary ENABLE guard.
* loader/appcache/ApplicationCacheGroup.cpp: Remove several unnecessary ENABLE guards.
(WebCore::ApplicationCacheGroup::didReceiveResponse):
(WebCore::ApplicationCacheGroup::didReceiveData):
(WebCore::ApplicationCacheGroup::didFinishLoading):
(WebCore::ApplicationCacheGroup::didFail):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::deleteIfPossible):
* page/Chrome.cpp:
(WebCore::Chrome::scroll):
(WebCore::Chrome::runBeforeUnloadConfirmPanel):
(WebCore::Chrome::runJavaScriptAlert):
(WebCore::Chrome::runJavaScriptConfirm):
(WebCore::Chrome::runJavaScriptPrompt):
(WebCore::Chrome::mouseDidMoveOverElement):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::dispatchLoadEvent):
(WebCore::DOMWindow::dispatchEvent):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleTouchEvent): Add a guard to make it safe to pass event target by-reference.
* page/FrameView.cpp:
(WebCore::FrameView::layout):
(WebCore::FrameView::mediaType):
(WebCore::FrameView::scheduleRelayout):
(WebCore::FrameView::scheduleRelayoutOfSubtree):
* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::addMessage):
(WebCore::PageConsoleClient::messageWithTypeAndLevel):
(WebCore::PageConsoleClient::count):
(WebCore::PageConsoleClient::profile):
(WebCore::PageConsoleClient::profileEnd):
(WebCore::PageConsoleClient::time):
(WebCore::PageConsoleClient::timeEnd):
(WebCore::PageConsoleClient::timeStamp):
* page/Settings.cpp:
(WebCore::Settings::setScriptEnabled):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerBecameNonComposited):
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):
(WebCore::RenderNamedFlowThread::unregisterNamedFlowContentElement):
(WebCore::RenderNamedFlowThread::dispatchRegionOversetChangeEventIfNeeded):
* replay/ReplayController.cpp:
(WebCore::ReplayController::switchSession):
(WebCore::ReplayController::createSegment):
(WebCore::ReplayController::completeSegment):
(WebCore::ReplayController::loadSegmentAtIndex):
(WebCore::ReplayController::unloadSegment):
(WebCore::ReplayController::startCapturing):
(WebCore::ReplayController::stopCapturing):
(WebCore::ReplayController::startPlayback):
(WebCore::ReplayController::pausePlayback):
(WebCore::ReplayController::cancelPlayback):
(WebCore::ReplayController::willDispatchInput):
* testing/Internals.cpp:
(WebCore::Internals::consoleMessageArgumentCounts):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::callReadyStateChangeListener):

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

46 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/js/ScriptController.cpp
Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/cssjit/SelectorCompiler.cpp
Source/WebCore/dom/CharacterData.cpp
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/ContainerNodeAlgorithms.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/EventTarget.cpp
Source/WebCore/dom/NamedFlowCollection.cpp
Source/WebCore/dom/PseudoElement.cpp
Source/WebCore/dom/StyledElement.cpp
Source/WebCore/inspector/InspectorConsoleInstrumentation.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorDatabaseInstrumentation.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorInstrumentationCookie.cpp
Source/WebCore/inspector/InspectorInstrumentationCookie.h
Source/WebCore/inspector/InstrumentingAgents.cpp
Source/WebCore/inspector/InstrumentingAgents.h
Source/WebCore/inspector/WorkerInspectorController.h
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/ResourceLoadScheduler.cpp
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/page/Chrome.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/PageConsoleClient.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderNamedFlowThread.cpp
Source/WebCore/replay/ReplayController.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/xml/XMLHttpRequest.cpp

index d441f13..6e9275e 100644 (file)
@@ -1,3 +1,422 @@
+2015-01-01  Brian J. Burg  <burg@cs.washington.edu>
+
+        Web Inspector: pass parameters to inspector instrumentation by reference where possible
+        https://bugs.webkit.org/show_bug.cgi?id=139981
+
+        Reviewed by Andreas Kling.
+
+        Clean up inspector instrumentation entry points throughout WebCore. In particular, make
+        parameters pass-by-reference if they are not nullable. Also standardize quirky parameter
+        orders and do other small cleanups in InspectorInstrumentation and at callsites.
+
+        Inspector agents still take the pertinent parameters by pointer even when they could be
+        passed by reference. This will be addressed in a follow-up change.
+
+        No new tests, no behavior changed.
+
+        * WebCore.exp.in:
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::evaluateInWorld):
+        * css/PropertySetCSSStyleDeclaration.cpp:
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::checkOne):
+        (WebCore::SelectorChecker::matchesFocusPseudoClass):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::styleForElement):
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::elementIsActive):
+        (WebCore::SelectorCompiler::elementIsActiveForStyleResolution):
+        (WebCore::SelectorCompiler::elementIsHovered):
+        (WebCore::SelectorCompiler::elementIsHoveredForStyleResolution):
+        * dom/CharacterData.cpp:
+        (WebCore::CharacterData::dispatchModifiedEvent): Remove unnecessary ENABLE guard.
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::insertBefore):
+        (WebCore::ContainerNode::replaceChild):
+        (WebCore::ContainerNode::removeBetween):
+        (WebCore::ContainerNode::appendChild):
+        (WebCore::dispatchChildRemovalEvents):
+        * dom/ContainerNodeAlgorithms.h:
+        (WebCore::ChildNodeInsertionNotifier::notify): Remove unnecessary ENABLE guard.
+        * dom/Document.cpp:
+        (WebCore::Document::scheduleStyleRecalc):
+        (WebCore::Document::recalcStyle):
+        (WebCore::Document::finishedParsing): This is safe because we checked the argument.
+        * dom/Element.cpp:
+        (WebCore::Element::addShadowRoot):
+        (WebCore::Element::removeShadowRoot): This is safe because we checked the argument.
+        (WebCore::Element::willModifyAttribute): Remove unnecessary ENABLE guard.
+        (WebCore::Element::didAddAttribute):
+        (WebCore::Element::didModifyAttribute):
+        (WebCore::Element::didRemoveAttribute):
+        * dom/EventTarget.cpp:
+        (WebCore::EventTarget::fireEventListeners): This is safe because the type test would fail if null.
+        * dom/NamedFlowCollection.cpp: Pass by reference since code already assumes non-null.
+        (WebCore::NamedFlowCollection::ensureFlowWithName):
+        (WebCore::NamedFlowCollection::discardNamedFlow):
+        * dom/PseudoElement.cpp:
+        (WebCore::PseudoElement::~PseudoElement):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::styleAttributeChanged):
+        (WebCore::StyledElement::inlineStyleChanged):
+        * inspector/InspectorConsoleInstrumentation.h:
+        (WebCore::InspectorInstrumentation::addMessageToConsole):
+        (WebCore::InspectorInstrumentation::consoleCount):
+        (WebCore::InspectorInstrumentation::startConsoleTiming):
+        (WebCore::InspectorInstrumentation::stopConsoleTiming):
+        (WebCore::InspectorInstrumentation::consoleTimeStamp):
+        (WebCore::InspectorInstrumentation::startProfiling):
+        (WebCore::InspectorInstrumentation::stopProfiling):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::didClearWindowObjectInWorld):
+        (WebCore::InspectorController::connectFrontend):
+        (WebCore::InspectorController::disconnectFrontend):
+        * inspector/InspectorController.h: Remove instrumentationForPage() in favor of using instrumentingAgentsForPage() directly.
+        * inspector/InspectorDatabaseInstrumentation.h:
+        (WebCore::InspectorInstrumentation::didOpenDatabase):
+        * inspector/InspectorInstrumentation.cpp: Add missing s_ prefix for global s_instrumentingAgentSets. Pass the instrumenting
+        agent by reference since it was already null-checked if we reached a slow path for instrumentation.
+        (WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
+        (WebCore::InspectorInstrumentation::isDebuggerPausedImpl):
+        (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::frameWindowDiscardedImpl):
+        (WebCore::InspectorInstrumentation::mediaQueryResultChangedImpl):
+        (WebCore::InspectorInstrumentation::didPushShadowRootImpl):
+        (WebCore::InspectorInstrumentation::willPopShadowRootImpl):
+        (WebCore::InspectorInstrumentation::didCreateNamedFlowImpl):
+        (WebCore::InspectorInstrumentation::willRemoveNamedFlowImpl):
+        (WebCore::InspectorInstrumentation::didChangeRegionOversetImpl):
+        (WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElementImpl):
+        (WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElementImpl):
+        (WebCore::InspectorInstrumentation::mouseDidMoveOverElementImpl):
+        (WebCore::InspectorInstrumentation::didScrollImpl):
+        (WebCore::InspectorInstrumentation::handleTouchEventImpl):
+        (WebCore::InspectorInstrumentation::handleMousePressImpl):
+        (WebCore::InspectorInstrumentation::forcePseudoStateImpl):
+        (WebCore::InspectorInstrumentation::characterDataModifiedImpl):
+        (WebCore::InspectorInstrumentation::willSendXMLHttpRequestImpl):
+        (WebCore::InspectorInstrumentation::didScheduleResourceRequestImpl):
+        (WebCore::InspectorInstrumentation::didInstallTimerImpl):
+        (WebCore::InspectorInstrumentation::didRemoveTimerImpl):
+        (WebCore::InspectorInstrumentation::willCallFunctionImpl):
+        (WebCore::InspectorInstrumentation::willDispatchXHRReadyStateChangeEventImpl):
+        (WebCore::InspectorInstrumentation::willDispatchEventImpl):
+        (WebCore::InspectorInstrumentation::willHandleEventImpl):
+        (WebCore::InspectorInstrumentation::didHandleEventImpl): Add proper cookie guard and pass by reference.
+        (WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
+        (WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
+        (WebCore::InspectorInstrumentation::didEvaluateScriptImpl):
+        (WebCore::InspectorInstrumentation::scriptsEnabledImpl):
+        (WebCore::InspectorInstrumentation::didCreateIsolatedContextImpl): Removed, as there are no callers from WebCore. Possible V8 artifact.
+        (WebCore::InspectorInstrumentation::willFireTimerImpl):
+        (WebCore::InspectorInstrumentation::didFireTimerImpl): Add proper cookie guard and pass by reference.
+        (WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
+        (WebCore::InspectorInstrumentation::willLayoutImpl):
+        (WebCore::InspectorInstrumentation::willDispatchXHRLoadEventImpl):
+        (WebCore::InspectorInstrumentation::willPaintImpl):
+        (WebCore::InspectorInstrumentation::didPaintImpl):
+        (WebCore::InspectorInstrumentation::willScrollLayerImpl):
+        (WebCore::InspectorInstrumentation::didScrollLayerImpl):
+        (WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
+        (WebCore::InspectorInstrumentation::didRecalculateStyleImpl): Add proper cookie guard and pass by reference.
+        (WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
+        (WebCore::InspectorInstrumentation::applyEmulatedMediaImpl): Pass string by reference.
+        (WebCore::InspectorInstrumentation::willSendRequestImpl):
+        (WebCore::InspectorInstrumentation::continueAfterPingLoaderImpl):
+        (WebCore::InspectorInstrumentation::markResourceAsCachedImpl):
+        (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):
+        (WebCore::InspectorInstrumentation::willReceiveResourceDataImpl):
+        (WebCore::InspectorInstrumentation::willReceiveResourceResponseImpl):
+        (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl): Add proper cookie guard and pass by reference.
+        (WebCore::InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl):
+        (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl):
+        (WebCore::InspectorInstrumentation::continueWithPolicyDownloadImpl):
+        (WebCore::InspectorInstrumentation::continueWithPolicyIgnoreImpl):
+        (WebCore::InspectorInstrumentation::didReceiveDataImpl):
+        (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
+        (WebCore::InspectorInstrumentation::didFailLoadingImpl):
+        (WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClientImpl):
+        (WebCore::InspectorInstrumentation::willLoadXHRImpl):
+        (WebCore::InspectorInstrumentation::didFailXHRLoadingImpl):
+        (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
+        (WebCore::InspectorInstrumentation::didReceiveXHRResponseImpl):
+        (WebCore::InspectorInstrumentation::willLoadXHRSynchronouslyImpl):
+        (WebCore::InspectorInstrumentation::didLoadXHRSynchronouslyImpl):
+        (WebCore::InspectorInstrumentation::scriptImportedImpl):
+        (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSPImpl):
+        (WebCore::InspectorInstrumentation::didReceiveScriptResponseImpl):
+        (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl): Use Frame::isMainFrame().
+        (WebCore::InspectorInstrumentation::loadEventFiredImpl): Use Frame::isMainFrame().
+        (WebCore::InspectorInstrumentation::frameDetachedFromParentImpl):
+        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
+        (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl):
+        (WebCore::InspectorInstrumentation::loaderDetachedFromFrameImpl):
+        (WebCore::InspectorInstrumentation::willRunJavaScriptDialogImpl):
+        (WebCore::InspectorInstrumentation::willDestroyCachedResourceImpl): Use a range-based iterator.
+        (WebCore::InspectorInstrumentation::willWriteHTMLImpl):
+        (WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
+        (WebCore::InspectorInstrumentation::consoleCountImpl):
+        (WebCore::InspectorInstrumentation::startConsoleTimingImpl):
+        (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
+        (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
+        (WebCore::InspectorInstrumentation::startProfilingImpl):
+        (WebCore::InspectorInstrumentation::stopProfilingImpl):
+        (WebCore::InspectorInstrumentation::didOpenDatabaseImpl):
+        (WebCore::InspectorInstrumentation::didDispatchDOMStorageEventImpl):
+        (WebCore::InspectorInstrumentation::shouldPauseDedicatedWorkerOnStartImpl):
+        (WebCore::InspectorInstrumentation::didStartWorkerGlobalScopeImpl):
+        (WebCore::InspectorInstrumentation::willEvaluateWorkerScript):
+        (WebCore::InspectorInstrumentation::workerGlobalScopeTerminatedImpl):
+        (WebCore::InspectorInstrumentation::didCreateWebSocketImpl):
+        (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl):
+        (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl):
+        (WebCore::InspectorInstrumentation::didCloseWebSocketImpl):
+        (WebCore::InspectorInstrumentation::didReceiveWebSocketFrameImpl):
+        (WebCore::InspectorInstrumentation::didReceiveWebSocketFrameErrorImpl):
+        (WebCore::InspectorInstrumentation::didSendWebSocketFrameImpl):
+        (WebCore::InspectorInstrumentation::sessionCreatedImpl):
+        (WebCore::InspectorInstrumentation::sessionLoadedImpl):
+        (WebCore::InspectorInstrumentation::sessionModifiedImpl):
+        (WebCore::InspectorInstrumentation::segmentCreatedImpl):
+        (WebCore::InspectorInstrumentation::segmentCompletedImpl):
+        (WebCore::InspectorInstrumentation::segmentLoadedImpl):
+        (WebCore::InspectorInstrumentation::segmentUnloadedImpl):
+        (WebCore::InspectorInstrumentation::captureStartedImpl):
+        (WebCore::InspectorInstrumentation::captureStoppedImpl):
+        (WebCore::InspectorInstrumentation::playbackStartedImpl):
+        (WebCore::InspectorInstrumentation::playbackPausedImpl):
+        (WebCore::InspectorInstrumentation::playbackHitPositionImpl):
+        (WebCore::InspectorInstrumentation::playbackFinishedImpl):
+        (WebCore::InspectorInstrumentation::networkStateChangedImpl):
+        (WebCore::InspectorInstrumentation::updateApplicationCacheStatusImpl):
+        (WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded):
+        (WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent):
+        (WebCore::InspectorInstrumentation::didRequestAnimationFrameImpl):
+        (WebCore::InspectorInstrumentation::didCancelAnimationFrameImpl):
+        (WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
+        (WebCore::InspectorInstrumentation::registerInstrumentingAgents):
+        (WebCore::InspectorInstrumentation::unregisterInstrumentingAgents):
+        (WebCore::InspectorInstrumentation::retrieveTimelineAgent):
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Add by-reference version which contains the logic from instrumentationForPage().
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer):
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope):
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForNonDocumentContext):
+        (WebCore::InspectorInstrumentation::layerTreeDidChangeImpl):
+        (WebCore::InspectorInstrumentation::renderLayerDestroyedImpl):
+        (WebCore::InspectorInstrumentation::pseudoElementDestroyedImpl):
+        (WebCore::InspectorInstrumentation::didCreateIsolatedContextImpl): Deleted.
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::didClearWindowObjectInWorld):
+        (WebCore::InspectorInstrumentation::isDebuggerPaused):
+        (WebCore::InspectorInstrumentation::willInsertDOMNode):
+        (WebCore::InspectorInstrumentation::didInsertDOMNode):
+        (WebCore::InspectorInstrumentation::willRemoveDOMNode):
+        (WebCore::InspectorInstrumentation::didRemoveDOMNode):
+        (WebCore::InspectorInstrumentation::willModifyDOMAttr):
+        (WebCore::InspectorInstrumentation::didModifyDOMAttr):
+        (WebCore::InspectorInstrumentation::didRemoveDOMAttr):
+        (WebCore::InspectorInstrumentation::didInvalidateStyleAttr):
+        (WebCore::InspectorInstrumentation::frameWindowDiscarded):
+        (WebCore::InspectorInstrumentation::mediaQueryResultChanged):
+        (WebCore::InspectorInstrumentation::didPushShadowRoot):
+        (WebCore::InspectorInstrumentation::willPopShadowRoot):
+        (WebCore::InspectorInstrumentation::didCreateNamedFlow):
+        (WebCore::InspectorInstrumentation::willRemoveNamedFlow):
+        (WebCore::InspectorInstrumentation::didChangeRegionOverset):
+        (WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElement):
+        (WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElement):
+        (WebCore::InspectorInstrumentation::mouseDidMoveOverElement):
+        (WebCore::InspectorInstrumentation::handleTouchEvent):
+        (WebCore::InspectorInstrumentation::handleMousePress): Take Frame by reference instead of Page by pointer.
+        (WebCore::InspectorInstrumentation::forcePseudoState):
+        (WebCore::InspectorInstrumentation::characterDataModified):
+        (WebCore::InspectorInstrumentation::willSendXMLHttpRequest):
+        (WebCore::InspectorInstrumentation::didScheduleResourceRequest):
+        (WebCore::InspectorInstrumentation::didInstallTimer):
+        (WebCore::InspectorInstrumentation::didRemoveTimer):
+        (WebCore::InspectorInstrumentation::willCallFunction):
+        (WebCore::InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent):
+        (WebCore::InspectorInstrumentation::willDispatchEvent):
+        (WebCore::InspectorInstrumentation::willHandleEvent): Pass a const event reference.
+        (WebCore::InspectorInstrumentation::willDispatchEventOnWindow):
+        (WebCore::InspectorInstrumentation::willEvaluateScript):
+        (WebCore::InspectorInstrumentation::didEvaluateScript):
+        (WebCore::InspectorInstrumentation::scriptsEnabled):
+        (WebCore::InspectorInstrumentation::willFireTimer):
+        (WebCore::InspectorInstrumentation::didInvalidateLayout):
+        (WebCore::InspectorInstrumentation::willLayout):
+        (WebCore::InspectorInstrumentation::didScroll):
+        (WebCore::InspectorInstrumentation::willDispatchXHRLoadEvent):
+        (WebCore::InspectorInstrumentation::willPaint):
+        (WebCore::InspectorInstrumentation::didPaint):
+        (WebCore::InspectorInstrumentation::willScrollLayer):
+        (WebCore::InspectorInstrumentation::didScrollLayer):
+        (WebCore::InspectorInstrumentation::willRecalculateStyle):
+        (WebCore::InspectorInstrumentation::didScheduleStyleRecalculation):
+        (WebCore::InspectorInstrumentation::applyEmulatedMedia): Pass string by reference.
+        (WebCore::InspectorInstrumentation::willSendRequest):
+        (WebCore::InspectorInstrumentation::continueAfterPingLoader):
+        (WebCore::InspectorInstrumentation::markResourceAsCached):
+        (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache):
+        (WebCore::InspectorInstrumentation::willReceiveResourceData):
+        (WebCore::InspectorInstrumentation::willReceiveResourceResponse):
+        (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied):
+        (WebCore::InspectorInstrumentation::continueWithPolicyDownload):
+        (WebCore::InspectorInstrumentation::continueWithPolicyIgnore):
+        (WebCore::InspectorInstrumentation::didReceiveData):
+        (WebCore::InspectorInstrumentation::didFinishLoading):
+        (WebCore::InspectorInstrumentation::didFailLoading):
+        (WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient): No need to go through
+        ScriptExecutionContext interface, as it's always a Document.
+        (WebCore::InspectorInstrumentation::willLoadXHR):
+        (WebCore::InspectorInstrumentation::didFailXHRLoading):
+        (WebCore::InspectorInstrumentation::didFinishXHRLoading):
+        (WebCore::InspectorInstrumentation::didReceiveXHRResponse):
+        (WebCore::InspectorInstrumentation::willLoadXHRSynchronously):
+        (WebCore::InspectorInstrumentation::didLoadXHRSynchronously):
+        (WebCore::InspectorInstrumentation::scriptImported):
+        (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSP):
+        (WebCore::InspectorInstrumentation::didReceiveScriptResponse):
+        (WebCore::InspectorInstrumentation::domContentLoadedEventFired):
+        (WebCore::InspectorInstrumentation::loadEventFired):
+        (WebCore::InspectorInstrumentation::frameDetachedFromParent):
+        (WebCore::InspectorInstrumentation::didCommitLoad):
+        (WebCore::InspectorInstrumentation::frameDocumentUpdated):
+        (WebCore::InspectorInstrumentation::loaderDetachedFromFrame):
+        (WebCore::InspectorInstrumentation::willRunJavaScriptDialog):
+        (WebCore::InspectorInstrumentation::willDestroyCachedResource):
+        (WebCore::InspectorInstrumentation::willWriteHTML):
+        (WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent):
+        (WebCore::InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart):
+        (WebCore::InspectorInstrumentation::didStartWorkerGlobalScope):
+        (WebCore::InspectorInstrumentation::workerGlobalScopeTerminated):
+        (WebCore::InspectorInstrumentation::didCreateWebSocket):
+        (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest):
+        (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse):
+        (WebCore::InspectorInstrumentation::didCloseWebSocket):
+        (WebCore::InspectorInstrumentation::didReceiveWebSocketFrame):
+        (WebCore::InspectorInstrumentation::didReceiveWebSocketFrameError):
+        (WebCore::InspectorInstrumentation::didSendWebSocketFrame):
+        (WebCore::InspectorInstrumentation::sessionCreated):
+        (WebCore::InspectorInstrumentation::sessionLoaded):
+        (WebCore::InspectorInstrumentation::sessionModified):
+        (WebCore::InspectorInstrumentation::segmentCreated):
+        (WebCore::InspectorInstrumentation::segmentCompleted):
+        (WebCore::InspectorInstrumentation::segmentLoaded):
+        (WebCore::InspectorInstrumentation::segmentUnloaded):
+        (WebCore::InspectorInstrumentation::captureStarted):
+        (WebCore::InspectorInstrumentation::captureStopped):
+        (WebCore::InspectorInstrumentation::playbackStarted):
+        (WebCore::InspectorInstrumentation::playbackPaused):
+        (WebCore::InspectorInstrumentation::playbackFinished):
+        (WebCore::InspectorInstrumentation::playbackHitPosition):
+        (WebCore::InspectorInstrumentation::networkStateChanged):
+        (WebCore::InspectorInstrumentation::updateApplicationCacheStatus):
+        (WebCore::InspectorInstrumentation::didRequestAnimationFrame):
+        (WebCore::InspectorInstrumentation::didCancelAnimationFrame):
+        (WebCore::InspectorInstrumentation::willFireAnimationFrame):
+        (WebCore::InspectorInstrumentation::layerTreeDidChange):
+        (WebCore::InspectorInstrumentation::renderLayerDestroyed):
+        (WebCore::InspectorInstrumentation::pseudoElementDestroyed):
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForFrame):
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForDocument):
+        (WebCore::InspectorInstrumentation::didCreateIsolatedContext): Deleted.
+        * inspector/InspectorInstrumentationCookie.cpp: Take a reference, use default RefPtr constructor.
+        (WebCore::InspectorInstrumentationCookie::InspectorInstrumentationCookie):
+        * inspector/InspectorInstrumentationCookie.h: Fix misplaced ENABLE guard.
+        * inspector/InstrumentingAgents.cpp:
+        (WebCore::instrumentationForPage): Deleted.
+        (WebCore::instrumentationForWorkerGlobalScope): Deleted.
+        * inspector/InstrumentingAgents.h:
+        * inspector/WorkerInspectorController.h:
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::responseReceived):
+        (WebCore::DocumentLoader::continueAfterContentPolicy):
+        (WebCore::DocumentLoader::detachFromFrame):
+        * loader/DocumentThreadableLoader.cpp: Remove unnecessary ENABLE(INSPECTOR) guards, as these inlined calls
+        are boiled away by the compiler if !ENABLE(INSPECTOR).
+        (WebCore::DocumentThreadableLoader::didReceiveData):
+        (WebCore::DocumentThreadableLoader::didFinishLoading):
+        (WebCore::DocumentThreadableLoader::didFail):
+        (WebCore::DocumentThreadableLoader::preflightFailure):
+        (WebCore::DocumentThreadableLoader::loadRequest):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::detachFromParent):
+        (WebCore::FrameLoader::loadedResourceFromMemoryCache):
+        (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
+        (WebCore::FrameLoader::dispatchDidCommitLoad):
+        * loader/ResourceLoadScheduler.cpp:
+        (WebCore::ResourceLoadScheduler::notifyDidScheduleResourceRequest):
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::willSendRequest): Remove unnecessary ENABLE guard.
+        * loader/appcache/ApplicationCacheGroup.cpp: Remove several unnecessary ENABLE guards.
+        (WebCore::ApplicationCacheGroup::didReceiveResponse):
+        (WebCore::ApplicationCacheGroup::didReceiveData):
+        (WebCore::ApplicationCacheGroup::didFinishLoading):
+        (WebCore::ApplicationCacheGroup::didFail):
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::deleteIfPossible):
+        * page/Chrome.cpp:
+        (WebCore::Chrome::scroll):
+        (WebCore::Chrome::runBeforeUnloadConfirmPanel):
+        (WebCore::Chrome::runJavaScriptAlert):
+        (WebCore::Chrome::runJavaScriptConfirm):
+        (WebCore::Chrome::runJavaScriptPrompt):
+        (WebCore::Chrome::mouseDidMoveOverElement):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::dispatchLoadEvent):
+        (WebCore::DOMWindow::dispatchEvent):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMousePressEvent):
+        (WebCore::EventHandler::handleTouchEvent): Add a guard to make it safe to pass event target by-reference.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::mediaType):
+        (WebCore::FrameView::scheduleRelayout):
+        (WebCore::FrameView::scheduleRelayoutOfSubtree):
+        * page/PageConsoleClient.cpp:
+        (WebCore::PageConsoleClient::addMessage):
+        (WebCore::PageConsoleClient::messageWithTypeAndLevel):
+        (WebCore::PageConsoleClient::count):
+        (WebCore::PageConsoleClient::profile):
+        (WebCore::PageConsoleClient::profileEnd):
+        (WebCore::PageConsoleClient::time):
+        (WebCore::PageConsoleClient::timeEnd):
+        (WebCore::PageConsoleClient::timeStamp):
+        * page/Settings.cpp:
+        (WebCore::Settings::setScriptEnabled):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollTo):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::layerBecameNonComposited):
+        * rendering/RenderNamedFlowThread.cpp:
+        (WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):
+        (WebCore::RenderNamedFlowThread::unregisterNamedFlowContentElement):
+        (WebCore::RenderNamedFlowThread::dispatchRegionOversetChangeEventIfNeeded):
+        * replay/ReplayController.cpp:
+        (WebCore::ReplayController::switchSession):
+        (WebCore::ReplayController::createSegment):
+        (WebCore::ReplayController::completeSegment):
+        (WebCore::ReplayController::loadSegmentAtIndex):
+        (WebCore::ReplayController::unloadSegment):
+        (WebCore::ReplayController::startCapturing):
+        (WebCore::ReplayController::stopCapturing):
+        (WebCore::ReplayController::startPlayback):
+        (WebCore::ReplayController::pausePlayback):
+        (WebCore::ReplayController::cancelPlayback):
+        (WebCore::ReplayController::willDispatchInput):
+        * testing/Internals.cpp:
+        (WebCore::Internals::consoleMessageArgumentCounts):
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::callReadyStateChangeListener):
+
 2015-01-05  Dan Bernstein  <mitz@apple.com>
 
         Tried to fix the iOS build.
index 75e6b52..3ae7e4b 100644 (file)
@@ -3195,7 +3195,6 @@ __ZN7WebCore19InspectorController5closeEv
 __ZN7WebCore21InspectorFrontendHost16disconnectClientEv
 __ZN7WebCore21InspectorFrontendHostC1EPNS_23InspectorFrontendClientEPNS_4PageE
 __ZN7WebCore21InspectorFrontendHostD1Ev
-__ZN7WebCore22instrumentationForPageEPNS_4PageE
 __ZN7WebCore24InspectorInstrumentation17s_frontendCounterE
 __ZN7WebCore24InspectorInstrumentation26instrumentingAgentsForPageEPNS_4PageE
 __ZN7WebCore28InspectorFrontendClientLocal11isUnderTestEv
index 702144c..0474336 100644 (file)
@@ -144,13 +144,13 @@ Deprecated::ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode
 
     Ref<Frame> protect(m_frame);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(&m_frame, sourceURL, sourceCode.startLine());
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine());
 
     JSValue evaluationException;
 
     JSValue returnValue = JSMainThreadExecState::evaluate(exec, jsSourceCode, shell, &evaluationException);
 
-    InspectorInstrumentation::didEvaluateScript(cookie, &m_frame);
+    InspectorInstrumentation::didEvaluateScript(cookie, m_frame);
 
     if (evaluationException) {
         reportException(exec, evaluationException, sourceCode.cachedScript());
index 571d844..c72851f 100644 (file)
@@ -88,7 +88,7 @@ public:
         s_currentDecl = 0;
         s_shouldNotifyInspector = false;
         if (localCopyStyleDecl->parentElement())
-            InspectorInstrumentation::didInvalidateStyleAttr(&localCopyStyleDecl->parentElement()->document(), localCopyStyleDecl->parentElement());
+            InspectorInstrumentation::didInvalidateStyleAttr(localCopyStyleDecl->parentElement()->document(), *localCopyStyleDecl->parentElement());
     }
 
     void enqueueMutationRecord()
index 08e51d8..4847e85 100644 (file)
@@ -888,7 +888,7 @@ bool SelectorChecker::checkOne(const CheckingContextWithStatus& context, PseudoI
                     else
                         element->setChildrenAffectedByHover();
                 }
-                if (element->hovered() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassHover))
+                if (element->hovered() || InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassHover))
                     return true;
             }
             break;
@@ -900,7 +900,7 @@ bool SelectorChecker::checkOne(const CheckingContextWithStatus& context, PseudoI
                     else
                         element->setChildrenAffectedByActive();
                 }
-                if (element->active() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassActive))
+                if (element->active() || InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassActive))
                     return true;
             }
             break;
@@ -1127,7 +1127,7 @@ static bool isFrameFocused(const Element* element)
 
 bool SelectorChecker::matchesFocusPseudoClass(const Element* element)
 {
-    if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(element), CSSSelector::PseudoClassFocus))
+    if (InspectorInstrumentation::forcePseudoState(const_cast<Element&>(*element), CSSSelector::PseudoClassFocus))
         return true;
     return element->focused() && isFrameFocused(element);
 }
index 39b82f9..7593fc4 100644 (file)
@@ -774,7 +774,7 @@ Ref<RenderStyle> StyleResolver::styleForElement(Element* element, RenderStyle* d
         state.style()->setIsLink(true);
         EInsideLink linkState = state.elementLinkState();
         if (linkState != NotInsideLink) {
-            bool forceVisited = InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassVisited);
+            bool forceVisited = InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassVisited);
             if (forceVisited)
                 linkState = InsideVisitedLink;
         }
index 24f55cd..8910d02 100644 (file)
@@ -2921,14 +2921,14 @@ static void setFirstChildState(Element* element)
 
 static bool elementIsActive(Element* element)
 {
-    return element->active() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassActive);
+    return element->active() || InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassActive);
 }
 
 static bool elementIsActiveForStyleResolution(Element* element, const SelectorChecker::CheckingContext* checkingContext)
 {
     if (checkingContext->resolvingMode == SelectorChecker::Mode::ResolvingStyle)
         element->setChildrenAffectedByActive();
-    return element->active() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassActive);
+    return element->active() || InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassActive);
 }
 
 void SelectorCodeGenerator::generateElementIsActive(Assembler::JumpList& failureCases, const SelectorFragment& fragment)
@@ -3100,14 +3100,14 @@ void SelectorCodeGenerator::generateElementIsFirstChild(Assembler::JumpList& fai
 
 static bool elementIsHovered(Element* element)
 {
-    return element->hovered() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassHover);
+    return element->hovered() || InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassHover);
 }
 
 static bool elementIsHoveredForStyleResolution(Element* element, const SelectorChecker::CheckingContext* checkingContext)
 {
     if (checkingContext->resolvingMode == SelectorChecker::Mode::ResolvingStyle)
         element->setChildrenAffectedByHover();
-    return element->hovered() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassHover);
+    return element->hovered() || InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassHover);
 }
 
 void SelectorCodeGenerator::generateElementIsHovered(Assembler::JumpList& failureCases, const SelectorFragment& fragment)
index 7170008..b493d8b 100644 (file)
@@ -227,9 +227,8 @@ void CharacterData::dispatchModifiedEvent(const String& oldData)
             dispatchScopedEvent(MutationEvent::create(eventNames().DOMCharacterDataModifiedEvent, true, 0, oldData, m_data));
         dispatchSubtreeModifiedEvent();
     }
-#if ENABLE(INSPECTOR)
-    InspectorInstrumentation::characterDataModified(&document(), this);
-#endif
+
+    InspectorInstrumentation::characterDataModified(document(), *this);
 }
 
 void CharacterData::checkCharDataOperation(unsigned offset, ExceptionCode& ec)
index e75087e..82b237b 100644 (file)
@@ -276,7 +276,7 @@ bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce
     if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), ec))
         return false;
 
-    InspectorInstrumentation::willInsertDOMNode(&document(), this);
+    InspectorInstrumentation::willInsertDOMNode(document(), *this);
 
     ChildListMutationScope mutation(*this);
     for (auto it = targets.begin(), end = targets.end(); it != end; ++it) {
@@ -432,7 +432,7 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce
     if (!checkReplaceChild(this, newChild.get(), oldChild, ec))
         return false;
 
-    InspectorInstrumentation::willInsertDOMNode(&document(), this);
+    InspectorInstrumentation::willInsertDOMNode(document(), *this);
 
     // Add the new child(ren)
     for (auto it = targets.begin(), end = targets.end(); it != end; ++it) {
@@ -577,7 +577,7 @@ bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec)
 
 void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node& oldChild)
 {
-    InspectorInstrumentation::didRemoveDOMNode(&oldChild.document(), &oldChild);
+    InspectorInstrumentation::didRemoveDOMNode(oldChild.document(), oldChild);
 
     NoEventDispatchAssertion assertNoEventDispatch;
 
@@ -699,7 +699,7 @@ bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec)
     if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), ec))
         return false;
 
-    InspectorInstrumentation::willInsertDOMNode(&document(), this);
+    InspectorInstrumentation::willInsertDOMNode(document(), *this);
 
     // Now actually add the child(ren)
     ChildListMutationScope mutation(*this);
@@ -817,14 +817,14 @@ static void dispatchChildInsertionEvents(Node& child)
 static void dispatchChildRemovalEvents(Node& child)
 {
     if (child.isInShadowTree()) {
-        InspectorInstrumentation::willRemoveDOMNode(&child.document(), &child);
+        InspectorInstrumentation::willRemoveDOMNode(child.document(), child);
         return;
     }
 
     ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
 
     willCreatePossiblyOrphanedTreeByRemoval(&child);
-    InspectorInstrumentation::willRemoveDOMNode(&child.document(), &child);
+    InspectorInstrumentation::willRemoveDOMNode(child.document(), child);
 
     RefPtr<Node> c = &child;
     Ref<Document> document(child.document());
index cc091b0..9714bbd 100644 (file)
@@ -217,9 +217,7 @@ inline void ChildNodeInsertionNotifier::notify(Node& node)
 {
     ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
 
-#if ENABLE(INSPECTOR)
-    InspectorInstrumentation::didInsertDOMNode(&node.document(), &node);
-#endif
+    InspectorInstrumentation::didInsertDOMNode(node.document(), node);
 
     Ref<Document> protectDocument(node.document());
     Ref<Node> protectNode(node);
index e6ee623..8f8cb8e 100644 (file)
@@ -1697,7 +1697,7 @@ void Document::scheduleStyleRecalc()
     
     m_styleRecalcTimer.startOneShot(0);
 
-    InspectorInstrumentation::didScheduleStyleRecalculation(this);
+    InspectorInstrumentation::didScheduleStyleRecalculation(*this);
 }
 
 void Document::unscheduleStyleRecalc()
@@ -1750,7 +1750,7 @@ void Document::recalcStyle(Style::Change change)
 
     m_styleSheetCollection.flushPendingUpdates();
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(*this);
 
     if (m_elementSheet && m_elementSheet->contents().usesRemUnits())
         m_styleSheetCollection.setUsesRemUnit(true);
@@ -4596,7 +4596,7 @@ void Document::finishedParsing()
 
         f->loader().finishedParsing();
 
-        InspectorInstrumentation::domContentLoadedEventFired(f.get());
+        InspectorInstrumentation::domContentLoadedEventFired(*f);
     }
 
     // Schedule dropping of the DocumentSharedObjectPool. We keep it alive for a while after parsing finishes
index 51e7e29..b8dc6e1 100644 (file)
@@ -1474,7 +1474,7 @@ void Element::addShadowRoot(Ref<ShadowRoot>&& newShadowRoot)
 
     setNeedsStyleRecalc(ReconstructRenderTree);
 
-    InspectorInstrumentation::didPushShadowRoot(this, &shadowRoot);
+    InspectorInstrumentation::didPushShadowRoot(*this, shadowRoot);
 }
 
 void Element::removeShadowRoot()
@@ -1482,7 +1482,7 @@ void Element::removeShadowRoot()
     RefPtr<ShadowRoot> oldRoot = shadowRoot();
     if (!oldRoot)
         return;
-    InspectorInstrumentation::willPopShadowRoot(this, oldRoot.get());
+    InspectorInstrumentation::willPopShadowRoot(*this, *oldRoot);
     document().removeFocusedNodeOfSubtree(oldRoot.get());
 
     ASSERT(!oldRoot->renderer());
@@ -2810,29 +2810,27 @@ void Element::willModifyAttribute(const QualifiedName& name, const AtomicString&
     if (std::unique_ptr<MutationObserverInterestGroup> recipients = MutationObserverInterestGroup::createForAttributesMutation(*this, name))
         recipients->enqueueMutationRecord(MutationRecord::createAttributes(*this, name, oldValue));
 
-#if ENABLE(INSPECTOR)
-    InspectorInstrumentation::willModifyDOMAttr(&document(), this, oldValue, newValue);
-#endif
+    InspectorInstrumentation::willModifyDOMAttr(document(), *this, oldValue, newValue);
 }
 
 void Element::didAddAttribute(const QualifiedName& name, const AtomicString& value)
 {
     attributeChanged(name, nullAtom, value);
-    InspectorInstrumentation::didModifyDOMAttr(&document(), this, name.localName(), value);
+    InspectorInstrumentation::didModifyDOMAttr(document(), *this, name.localName(), value);
     dispatchSubtreeModifiedEvent();
 }
 
 void Element::didModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
 {
     attributeChanged(name, oldValue, newValue);
-    InspectorInstrumentation::didModifyDOMAttr(&document(), this, name.localName(), newValue);
+    InspectorInstrumentation::didModifyDOMAttr(document(), *this, name.localName(), newValue);
     // Do not dispatch a DOMSubtreeModified event here; see bug 81141.
 }
 
 void Element::didRemoveAttribute(const QualifiedName& name, const AtomicString& oldValue)
 {
     attributeChanged(name, oldValue, nullAtom);
-    InspectorInstrumentation::didRemoveDOMAttr(&document(), this, name.localName());
+    InspectorInstrumentation::didRemoveDOMAttr(document(), *this, name.localName());
     dispatchSubtreeModifiedEvent();
 }
 
index f17d6d3..7f3895b 100644 (file)
@@ -234,7 +234,7 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList
     InspectorInstrumentationCookie willDispatchEventCookie;
     if (is<Document>(context)) {
         document = downcast<Document>(context);
-        willDispatchEventCookie = InspectorInstrumentation::willDispatchEvent(document, *event, size > 0);
+        willDispatchEventCookie = InspectorInstrumentation::willDispatchEvent(*document, *event, size > 0);
     }
 
     for (; i < size; ++i) {
@@ -249,7 +249,7 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList
         if (event->immediatePropagationStopped())
             break;
 
-        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willHandleEvent(context, event);
+        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willHandleEvent(context, *event);
         // To match Mozilla, the AT_TARGET phase fires both capturing and bubbling
         // event listeners, even though that violates some versions of the DOM spec.
         registeredListener.listener->handleEvent(context, event);
index 6bd7655..622797c 100644 (file)
@@ -79,7 +79,7 @@ Ref<WebKitNamedFlow> NamedFlowCollection::ensureFlowWithName(const String& flowN
     RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName);
     m_namedFlows.add(newFlow.get());
 
-    InspectorInstrumentation::didCreateNamedFlow(document(), newFlow.get());
+    InspectorInstrumentation::didCreateNamedFlow(document(), *newFlow);
 
     return newFlow.releaseNonNull();
 }
@@ -93,7 +93,7 @@ void NamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow)
     ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull);
     ASSERT(m_namedFlows.contains(namedFlow));
 
-    InspectorInstrumentation::willRemoveNamedFlow(document(), namedFlow);
+    InspectorInstrumentation::willRemoveNamedFlow(document(), *namedFlow);
 
     m_namedFlows.remove(namedFlow);
 }
index 650f713..932b71b 100644 (file)
@@ -67,7 +67,7 @@ PseudoElement::PseudoElement(Element& host, PseudoId pseudoId)
 PseudoElement::~PseudoElement()
 {
     ASSERT(!m_hostElement);
-    InspectorInstrumentation::pseudoElementDestroyed(document().page(), this);
+    InspectorInstrumentation::pseudoElementDestroyed(document().page(), *this);
 }
 
 RefPtr<RenderStyle> PseudoElement::customStyleForRenderer(RenderStyle& parentStyle)
index ecd02c1..49a6a9c 100644 (file)
@@ -204,7 +204,7 @@ void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, At
     elementData()->setStyleAttributeIsDirty(false);
 
     setNeedsStyleRecalc(InlineStyleChange);
-    InspectorInstrumentation::didInvalidateStyleAttr(&document(), this);
+    InspectorInstrumentation::didInvalidateStyleAttr(document(), *this);
 }
 
 void StyledElement::inlineStyleChanged()
@@ -212,7 +212,7 @@ void StyledElement::inlineStyleChanged()
     setNeedsStyleRecalc(InlineStyleChange);
     ASSERT(elementData());
     elementData()->setStyleAttributeIsDirty(true);
-    InspectorInstrumentation::didInvalidateStyleAttr(&document(), this);
+    InspectorInstrumentation::didInvalidateStyleAttr(document(), *this);
 }
     
 bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identifier, bool important)
index f540ce2..32a6247 100644 (file)
 
 namespace WebCore {
 
-inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<Inspector::ScriptCallStack> callStack, unsigned long requestIdentifier)
+inline void InspectorInstrumentation::addMessageToConsole(Page& page, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<Inspector::ScriptCallStack> callStack, unsigned long requestIdentifier)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, callStack, requestIdentifier);
+        addMessageToConsoleImpl(*instrumentingAgents, source, type, level, message, callStack, requestIdentifier);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(source);
@@ -55,11 +55,11 @@ inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSou
 #endif
 }
 
-inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, JSC::ExecState* state, PassRefPtr<Inspector::ScriptArguments> arguments, unsigned long requestIdentifier)
+inline void InspectorInstrumentation::addMessageToConsole(Page& page, MessageSource source, MessageType type, MessageLevel level, const String& message, JSC::ExecState* state, PassRefPtr<Inspector::ScriptArguments> arguments, unsigned long requestIdentifier)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, state, arguments, requestIdentifier);
+        addMessageToConsoleImpl(*instrumentingAgents, source, type, level, message, state, arguments, requestIdentifier);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(source);
@@ -72,11 +72,11 @@ inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSou
 #endif
 }
 
-inline void InspectorInstrumentation::addMessageToConsole(Page* page, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* state, unsigned long requestIdentifier)
+inline void InspectorInstrumentation::addMessageToConsole(Page& page, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* state, unsigned long requestIdentifier)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, scriptID, lineNumber, columnNumber, state, requestIdentifier);
+        addMessageToConsoleImpl(*instrumentingAgents, source, type, level, message, scriptID, lineNumber, columnNumber, state, requestIdentifier);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(source);
@@ -95,7 +95,7 @@ inline void InspectorInstrumentation::addMessageToConsole(WorkerGlobalScope* wor
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForWorkerGlobalScope(workerGlobalScope))
-        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, callStack, requestIdentifier);
+        addMessageToConsoleImpl(*instrumentingAgents, source, type, level, message, callStack, requestIdentifier);
 #else
     UNUSED_PARAM(workerGlobalScope);
     UNUSED_PARAM(source);
@@ -111,7 +111,7 @@ inline void InspectorInstrumentation::addMessageToConsole(WorkerGlobalScope* wor
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForWorkerGlobalScope(workerGlobalScope))
-        addMessageToConsoleImpl(instrumentingAgents, source, type, level, message, scriptID, lineNumber, columnNumber, state, requestIdentifier);
+        addMessageToConsoleImpl(*instrumentingAgents, source, type, level, message, scriptID, lineNumber, columnNumber, state, requestIdentifier);
 #else
     UNUSED_PARAM(workerGlobalScope);
     UNUSED_PARAM(source);
@@ -126,11 +126,11 @@ inline void InspectorInstrumentation::addMessageToConsole(WorkerGlobalScope* wor
 #endif
 }
 
-inline void InspectorInstrumentation::consoleCount(Page* page, JSC::ExecState* state, PassRefPtr<Inspector::ScriptArguments> arguments)
+inline void InspectorInstrumentation::consoleCount(Page& page, JSC::ExecState* state, PassRefPtr<Inspector::ScriptArguments> arguments)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        consoleCountImpl(instrumentingAgents, state, arguments);
+        consoleCountImpl(*instrumentingAgents, state, arguments);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(state);
@@ -138,22 +138,22 @@ inline void InspectorInstrumentation::consoleCount(Page* page, JSC::ExecState* s
 #endif
 }
 
-inline void InspectorInstrumentation::startConsoleTiming(Frame* frame, const String& title)
+inline void InspectorInstrumentation::startConsoleTiming(Frame& frame, const String& title)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        startConsoleTimingImpl(instrumentingAgents, frame, title);
+        startConsoleTimingImpl(*instrumentingAgents, frame, title);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(title);
 #endif
 }
 
-inline void InspectorInstrumentation::stopConsoleTiming(Frame* frame, const String& title, PassRefPtr<Inspector::ScriptCallStack> stack)
+inline void InspectorInstrumentation::stopConsoleTiming(Frame& frame, const String& title, PassRefPtr<Inspector::ScriptCallStack> stack)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        stopConsoleTimingImpl(instrumentingAgents, frame, title, stack);
+        stopConsoleTimingImpl(*instrumentingAgents, frame, title, stack);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(title);
@@ -161,23 +161,23 @@ inline void InspectorInstrumentation::stopConsoleTiming(Frame* frame, const Stri
 #endif
 }
 
-inline void InspectorInstrumentation::consoleTimeStamp(Frame* frame, PassRefPtr<Inspector::ScriptArguments> arguments)
+inline void InspectorInstrumentation::consoleTimeStamp(Frame& frame, PassRefPtr<Inspector::ScriptArguments> arguments)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        consoleTimeStampImpl(instrumentingAgents, frame, arguments);
+        consoleTimeStampImpl(*instrumentingAgents, frame, arguments);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(arguments);
 #endif
 }
 
-inline void InspectorInstrumentation::startProfiling(Page* page, JSC::ExecState* exec, const String &title)
+inline void InspectorInstrumentation::startProfiling(Page& page, JSC::ExecState* exec, const String &title)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        startProfilingImpl(instrumentingAgents, exec, title);
+        startProfilingImpl(*instrumentingAgents, exec, title);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(exec);
@@ -185,11 +185,11 @@ inline void InspectorInstrumentation::startProfiling(Page* page, JSC::ExecState*
 #endif
 }
 
-inline PassRefPtr<JSC::Profile> InspectorInstrumentation::stopProfiling(Page* page, JSC::ExecState* exec, const String &title)
+inline PassRefPtr<JSC::Profile> InspectorInstrumentation::stopProfiling(Page& page, JSC::ExecState* exec, const String &title)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        return stopProfilingImpl(instrumentingAgents, exec, title);
+        return stopProfilingImpl(*instrumentingAgents, exec, title);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(exec);
index 86cec04..2ed8adf 100644 (file)
@@ -224,17 +224,17 @@ bool InspectorController::hasInspectorFrontendClient() const
     return m_inspectorFrontendClient;
 }
 
-void InspectorController::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld& world)
+void InspectorController::didClearWindowObjectInWorld(Frame& frame, DOMWrapperWorld& world)
 {
     if (&world != &mainThreadNormalWorld())
         return;
 
-    if (frame->isMainFrame())
+    if (frame.isMainFrame())
         m_injectedScriptManager->discardInjectedScripts();
 
     // If the page is supposed to serve as InspectorFrontend notify inspector frontend
     // client that it's cleared so that the client can expose inspector bindings.
-    if (m_inspectorFrontendClient && frame->isMainFrame())
+    if (m_inspectorFrontendClient && frame.isMainFrame())
         m_inspectorFrontendClient->windowObjectCleared();
 }
 
@@ -252,7 +252,7 @@ void InspectorController::connectFrontend(InspectorFrontendChannel* frontendChan
 
     m_agents.didCreateFrontendAndBackend(frontendChannel, m_inspectorBackendDispatcher.get());
 
-    InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.get());
+    InspectorInstrumentation::registerInstrumentingAgents(*m_instrumentingAgents);
     InspectorInstrumentation::frontendCreated();
 
 #if ENABLE(REMOTE_INSPECTOR)
@@ -277,7 +277,7 @@ void InspectorController::disconnectFrontend(InspectorDisconnectReason reason)
     // Release overlay page resources.
     m_overlay->freePage();
     InspectorInstrumentation::frontendDeleted();
-    InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get());
+    InspectorInstrumentation::unregisterInstrumentingAgents(*m_instrumentingAgents);
 
 #if ENABLE(REMOTE_INSPECTOR)
     if (!m_hasRemoteFrontend)
index 96f41f5..7c78ee4 100644 (file)
@@ -59,6 +59,7 @@ class InspectorClient;
 class InspectorDOMAgent;
 class InspectorDOMDebuggerAgent;
 class InspectorFrontendClient;
+class InspectorInstrumentation;
 class InspectorPageAgent;
 class InspectorResourceAgent;
 class InspectorTimelineAgent;
@@ -85,7 +86,7 @@ public:
 
     WEBCORE_EXPORT void setInspectorFrontendClient(InspectorFrontendClient*);
     bool hasInspectorFrontendClient() const;
-    void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld&);
+    void didClearWindowObjectInWorld(Frame&, DOMWrapperWorld&);
 
     WEBCORE_EXPORT void dispatchMessageFromFrontend(const String& message);
 
@@ -133,7 +134,7 @@ public:
     virtual PassRefPtr<WTF::Stopwatch> executionStopwatch() override;
 
 private:
-    friend InstrumentingAgents* instrumentationForPage(Page*);
+    friend class InspectorInstrumentation;
 
     RefPtr<InstrumentingAgents> m_instrumentingAgents;
     std::unique_ptr<WebInjectedScriptManager> m_injectedScriptManager;
index b0ad7b3..d6cb623 100644 (file)
@@ -42,7 +42,7 @@ inline void InspectorInstrumentation::didOpenDatabase(ScriptExecutionContext* co
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didOpenDatabaseImpl(instrumentingAgents, database, domain, name, version);
+        didOpenDatabaseImpl(*instrumentingAgents, database, domain, name, version);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(database);
index 7952366..ea5ce5b 100644 (file)
@@ -43,6 +43,7 @@
 #include "Event.h"
 #include "EventDispatcher.h"
 #include "InspectorApplicationCacheAgent.h"
+#include "InspectorController.h"
 #include "InspectorCSSAgent.h"
 #include "InspectorDOMAgent.h"
 #include "InspectorDOMDebuggerAgent.h"
@@ -64,6 +65,7 @@
 #include "StyleRule.h"
 #include "WebConsoleAgent.h"
 #include "WorkerGlobalScope.h"
+#include "WorkerInspectorController.h"
 #include "WorkerRuntimeAgent.h"
 #include "WorkerThread.h"
 #include "XMLHttpRequest.h"
@@ -92,7 +94,7 @@ static const char* const clearTimerEventName = "clearTimer";
 static const char* const timerFiredEventName = "timerFired";
 
 namespace {
-static HashSet<InstrumentingAgents*>* instrumentingAgentsSet = nullptr;
+static HashSet<InstrumentingAgents*>* s_instrumentingAgentsSet = nullptr;
 }
 
 int InspectorInstrumentation::s_frontendCounter = 0;
@@ -105,207 +107,207 @@ static Frame* frameForScriptExecutionContext(ScriptExecutionContext* context)
     return frame;
 }
 
-void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, DOMWrapperWorld& world)
+void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, DOMWrapperWorld& world)
 {
-    InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent();
+    InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent();
     if (pageAgent)
-        pageAgent->didClearWindowObjectInWorld(frame, world);
-    if (PageDebuggerAgent* debuggerAgent = instrumentingAgents->pageDebuggerAgent()) {
-        if (pageAgent && &world == &mainThreadNormalWorld() && frame == pageAgent->mainFrame())
+        pageAgent->didClearWindowObjectInWorld(&frame, world);
+    if (PageDebuggerAgent* debuggerAgent = instrumentingAgents.pageDebuggerAgent()) {
+        if (pageAgent && &world == &mainThreadNormalWorld() && &frame == pageAgent->mainFrame())
             debuggerAgent->didClearMainFrameWindowObject();
     }
-    if (PageRuntimeAgent* pageRuntimeAgent = instrumentingAgents->pageRuntimeAgent()) {
+    if (PageRuntimeAgent* pageRuntimeAgent = instrumentingAgents.pageRuntimeAgent()) {
         if (&world == &mainThreadNormalWorld())
-            pageRuntimeAgent->didCreateMainWorldContext(frame);
+            pageRuntimeAgent->didCreateMainWorldContext(&frame);
     }
 }
 
-bool InspectorInstrumentation::isDebuggerPausedImpl(InstrumentingAgents* instrumentingAgents)
+bool InspectorInstrumentation::isDebuggerPausedImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent())
+    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents.inspectorDebuggerAgent())
         return debuggerAgent->isPaused();
     return false;
 }
 
-void InspectorInstrumentation::willInsertDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* parent)
+void InspectorInstrumentation::willInsertDOMNodeImpl(InstrumentingAgents& instrumentingAgents, Node& parent)
 {
-    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
-        domDebuggerAgent->willInsertDOMNode(parent);
+    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
+        domDebuggerAgent->willInsertDOMNode(&parent);
 }
 
-void InspectorInstrumentation::didInsertDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node)
+void InspectorInstrumentation::didInsertDOMNodeImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->didInsertDOMNode(node);
-    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
-        domDebuggerAgent->didInsertDOMNode(node);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        domAgent->didInsertDOMNode(&node);
+    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
+        domDebuggerAgent->didInsertDOMNode(&node);
 }
 
-void InspectorInstrumentation::willRemoveDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node)
+void InspectorInstrumentation::willRemoveDOMNodeImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
-    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
-        domDebuggerAgent->willRemoveDOMNode(node);
+    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
+        domDebuggerAgent->willRemoveDOMNode(&node);
 }
 
-void InspectorInstrumentation::didRemoveDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node)
+void InspectorInstrumentation::didRemoveDOMNodeImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
-    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
-        domDebuggerAgent->didRemoveDOMNode(node);
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->didRemoveDOMNode(node);
+    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
+        domDebuggerAgent->didRemoveDOMNode(&node);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        domAgent->didRemoveDOMNode(&node);
 }
 
-void InspectorInstrumentation::willModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element, const AtomicString& oldValue, const AtomicString& newValue)
+void InspectorInstrumentation::willModifyDOMAttrImpl(InstrumentingAgents& instrumentingAgents, Element& element, const AtomicString& oldValue, const AtomicString& newValue)
 {
-    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
-        domDebuggerAgent->willModifyDOMAttr(element);
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->willModifyDOMAttr(element, oldValue, newValue);
+    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
+        domDebuggerAgent->willModifyDOMAttr(&element);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        domAgent->willModifyDOMAttr(&element, oldValue, newValue);
 }
 
-void InspectorInstrumentation::didModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element, const AtomicString& name, const AtomicString& value)
+void InspectorInstrumentation::didModifyDOMAttrImpl(InstrumentingAgents& instrumentingAgents, Element& element, const AtomicString& name, const AtomicString& value)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->didModifyDOMAttr(element, name, value);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        domAgent->didModifyDOMAttr(&element, name, value);
 }
 
-void InspectorInstrumentation::didRemoveDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element, const AtomicString& name)
+void InspectorInstrumentation::didRemoveDOMAttrImpl(InstrumentingAgents& instrumentingAgents, Element& element, const AtomicString& name)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->didRemoveDOMAttr(element, name);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        domAgent->didRemoveDOMAttr(&element, name);
 }
 
-void InspectorInstrumentation::didInvalidateStyleAttrImpl(InstrumentingAgents* instrumentingAgents, Node* node)
+void InspectorInstrumentation::didInvalidateStyleAttrImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->didInvalidateStyleAttr(node);
-    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
-        domDebuggerAgent->didInvalidateStyleAttr(node);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        domAgent->didInvalidateStyleAttr(&node);
+    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
+        domDebuggerAgent->didInvalidateStyleAttr(&node);
 }
 
-void InspectorInstrumentation::frameWindowDiscardedImpl(InstrumentingAgents* instrumentingAgents, DOMWindow* window)
+void InspectorInstrumentation::frameWindowDiscardedImpl(InstrumentingAgents& instrumentingAgents, DOMWindow* window)
 {
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->frameWindowDiscarded(window);
 }
 
-void InspectorInstrumentation::mediaQueryResultChangedImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::mediaQueryResultChangedImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
+    if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
         cssAgent->mediaQueryResultChanged();
 }
 
-void InspectorInstrumentation::didPushShadowRootImpl(InstrumentingAgents* instrumentingAgents, Element* host, ShadowRoot* root)
+void InspectorInstrumentation::didPushShadowRootImpl(InstrumentingAgents& instrumentingAgents, Element& host, ShadowRoot& root)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->didPushShadowRoot(host, root);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        domAgent->didPushShadowRoot(&host, &root);
 }
 
-void InspectorInstrumentation::willPopShadowRootImpl(InstrumentingAgents* instrumentingAgents, Element* host, ShadowRoot* root)
+void InspectorInstrumentation::willPopShadowRootImpl(InstrumentingAgents& instrumentingAgents, Element& host, ShadowRoot& root)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->willPopShadowRoot(host, root);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        domAgent->willPopShadowRoot(&host, &root);
 }
 
-void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
+void InspectorInstrumentation::didCreateNamedFlowImpl(InstrumentingAgents& instrumentingAgents, Document* document, WebKitNamedFlow& namedFlow)
 {
-    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
-        cssAgent->didCreateNamedFlow(document, namedFlow);
+    if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
+        cssAgent->didCreateNamedFlow(document, &namedFlow);
 }
 
-void InspectorInstrumentation::willRemoveNamedFlowImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
+void InspectorInstrumentation::willRemoveNamedFlowImpl(InstrumentingAgents& instrumentingAgents, Document* document, WebKitNamedFlow& namedFlow)
 {
-    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
-        cssAgent->willRemoveNamedFlow(document, namedFlow);
+    if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
+        cssAgent->willRemoveNamedFlow(document, &namedFlow);
 }
 
-void InspectorInstrumentation::didChangeRegionOversetImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow)
+void InspectorInstrumentation::didChangeRegionOversetImpl(InstrumentingAgents& instrumentingAgents, Document& document, WebKitNamedFlow& namedFlow)
 {
-    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
-        cssAgent->didChangeRegionOverset(document, namedFlow);
+    if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
+        cssAgent->didChangeRegionOverset(&document, &namedFlow);
 }
 
-void InspectorInstrumentation::didRegisterNamedFlowContentElementImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow, Node* contentElement, Node* nextContentElement)
+void InspectorInstrumentation::didRegisterNamedFlowContentElementImpl(InstrumentingAgents& instrumentingAgents, Document& document, WebKitNamedFlow& namedFlow, Node& contentElement, Node* nextContentElement)
 {
-    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
-        cssAgent->didRegisterNamedFlowContentElement(document, namedFlow, contentElement, nextContentElement);
+    if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
+        cssAgent->didRegisterNamedFlowContentElement(&document, &namedFlow, &contentElement, nextContentElement);
 }
 
-void InspectorInstrumentation::didUnregisterNamedFlowContentElementImpl(InstrumentingAgents* instrumentingAgents, Document* document, WebKitNamedFlow* namedFlow, Node* contentElement)
+void InspectorInstrumentation::didUnregisterNamedFlowContentElementImpl(InstrumentingAgents& instrumentingAgents, Document& document, WebKitNamedFlow& namedFlow, Node& contentElement)
 {
-    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
-        cssAgent->didUnregisterNamedFlowContentElement(document, namedFlow, contentElement);
+    if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
+        cssAgent->didUnregisterNamedFlowContentElement(&document, &namedFlow, &contentElement);
 }
 
-void InspectorInstrumentation::mouseDidMoveOverElementImpl(InstrumentingAgents* instrumentingAgents, const HitTestResult& result, unsigned modifierFlags)
+void InspectorInstrumentation::mouseDidMoveOverElementImpl(InstrumentingAgents& instrumentingAgents, const HitTestResult& result, unsigned modifierFlags)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
         domAgent->mouseDidMoveOverElement(result, modifierFlags);
 }
 
-void InspectorInstrumentation::didScrollImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::didScrollImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+    if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
         pageAgent->didScroll();
 }
 
-bool InspectorInstrumentation::handleTouchEventImpl(InstrumentingAgents* instrumentingAgents, Node* node)
+bool InspectorInstrumentation::handleTouchEventImpl(InstrumentingAgents& instrumentingAgents, Node& node)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        return domAgent->handleTouchEvent(node);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        return domAgent->handleTouchEvent(&node);
     return false;
 }
 
-bool InspectorInstrumentation::handleMousePressImpl(InstrumentingAgents* instrumentingAgents)
+bool InspectorInstrumentation::handleMousePressImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
         return domAgent->handleMousePress();
     return false;
 }
 
-bool InspectorInstrumentation::forcePseudoStateImpl(InstrumentingAgents* instrumentingAgents, Element* element, CSSSelector::PseudoClassType pseudoState)
+bool InspectorInstrumentation::forcePseudoStateImpl(InstrumentingAgents& instrumentingAgents, Element& element, CSSSelector::PseudoClassType pseudoState)
 {
-    if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
-        return cssAgent->forcePseudoState(element, pseudoState);
+    if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
+        return cssAgent->forcePseudoState(&element, pseudoState);
     return false;
 }
 
-void InspectorInstrumentation::characterDataModifiedImpl(InstrumentingAgents* instrumentingAgents, CharacterData* characterData)
+void InspectorInstrumentation::characterDataModifiedImpl(InstrumentingAgents& instrumentingAgents, CharacterData& characterData)
 {
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-        domAgent->characterDataModified(characterData);
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
+        domAgent->characterDataModified(&characterData);
 }
 
-void InspectorInstrumentation::willSendXMLHttpRequestImpl(InstrumentingAgents* instrumentingAgents, const String& url)
+void InspectorInstrumentation::willSendXMLHttpRequestImpl(InstrumentingAgents& instrumentingAgents, const String& url)
 {
-    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
+    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
         domDebuggerAgent->willSendXMLHttpRequest(url);
 }
 
-void InspectorInstrumentation::didScheduleResourceRequestImpl(InstrumentingAgents* instrumentingAgents, const String& url, Frame* frame)
+void InspectorInstrumentation::didScheduleResourceRequestImpl(InstrumentingAgents& instrumentingAgents, const String& url, Frame* frame)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didScheduleResourceRequest(url, frame);
 }
 
-void InspectorInstrumentation::didInstallTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, int timeout, bool singleShot, ScriptExecutionContext* context)
+void InspectorInstrumentation::didInstallTimerImpl(InstrumentingAgents& instrumentingAgents, int timerId, int timeout, bool singleShot, ScriptExecutionContext* context)
 {
     pauseOnNativeEventIfNeeded(instrumentingAgents, false, setTimerEventName, true);
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didInstallTimer(timerId, timeout, singleShot, frameForScriptExecutionContext(context));
 }
 
-void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, ScriptExecutionContext* context)
+void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents& instrumentingAgents, int timerId, ScriptExecutionContext* context)
 {
     pauseOnNativeEventIfNeeded(instrumentingAgents, false, clearTimerEventName, true);
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didRemoveTimer(timerId, frameForScriptExecutionContext(context));
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents* instrumentingAgents, const String& scriptName, int scriptLine, ScriptExecutionContext* context)
+InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents& instrumentingAgents, const String& scriptName, int scriptLine, ScriptExecutionContext* context)
 {
     int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
         timelineAgent->willCallFunction(scriptName, scriptLine, frameForScriptExecutionContext(context));
         timelineAgentId = timelineAgent->id();
     }
@@ -318,12 +320,12 @@ void InspectorInstrumentation::didCallFunctionImpl(const InspectorInstrumentatio
         timelineAgent->didCallFunction(frameForScriptExecutionContext(context));
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents* instrumentingAgents, XMLHttpRequest* request, ScriptExecutionContext* context)
+InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents& instrumentingAgents, XMLHttpRequest& request, ScriptExecutionContext* context)
 {
     int timelineAgentId = 0;
-    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
-    if (timelineAgent && request->hasEventListeners(eventNames().readystatechangeEvent)) {
-        timelineAgent->willDispatchXHRReadyStateChangeEvent(request->url().string(), request->readyState(), frameForScriptExecutionContext(context));
+    InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
+    if (timelineAgent && request.hasEventListeners(eventNames().readystatechangeEvent)) {
+        timelineAgent->willDispatchXHRReadyStateChangeEvent(request.url().string(), request.readyState(), frameForScriptExecutionContext(context));
         timelineAgentId = timelineAgent->id();
     }
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
@@ -335,30 +337,31 @@ void InspectorInstrumentation::didDispatchXHRReadyStateChangeEventImpl(const Ins
         timelineAgent->didDispatchXHRReadyStateChangeEvent();
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InstrumentingAgents* instrumentingAgents, const Event& event, bool hasEventListeners, Document* document)
+InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InstrumentingAgents& instrumentingAgents, Document& document, const Event& event, bool hasEventListeners)
 {
     int timelineAgentId = 0;
-    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
+    InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
     if (timelineAgent && hasEventListeners) {
-        timelineAgent->willDispatchEvent(event, document->frame());
+        timelineAgent->willDispatchEvent(event, document.frame());
         timelineAgentId = timelineAgent->id();
     }
 #if ENABLE(WEB_REPLAY)
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
-        replayAgent->willDispatchEvent(event, document->frame());
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
+        replayAgent->willDispatchEvent(event, document.frame());
 #endif
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents* instrumentingAgents, Event* event)
+InspectorInstrumentationCookie InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents& instrumentingAgents, const Event& event)
 {
-    pauseOnNativeEventIfNeeded(instrumentingAgents, true, event->type(), false);
+    pauseOnNativeEventIfNeeded(instrumentingAgents, true, event.type(), false);
     return InspectorInstrumentationCookie(instrumentingAgents, 0);
 }
 
 void InspectorInstrumentation::didHandleEventImpl(const InspectorInstrumentationCookie& cookie)
 {
-    cancelPauseOnNativeEvent(cookie.instrumentingAgents());
+    if (cookie.isValid())
+        cancelPauseOnNativeEvent(*cookie.instrumentingAgents());
 }
 
 void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie)
@@ -367,17 +370,17 @@ void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentati
         timelineAgent->didDispatchEvent();
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InstrumentingAgents* instrumentingAgents, const Event& event, DOMWindow* window)
+InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InstrumentingAgents& instrumentingAgents, const Event& event, DOMWindow& window)
 {
     int timelineAgentId = 0;
-    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
-    if (timelineAgent && window->hasEventListeners(event.type())) {
-        timelineAgent->willDispatchEvent(event, window ? window->frame() : nullptr);
+    InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
+    if (timelineAgent && window.hasEventListeners(event.type())) {
+        timelineAgent->willDispatchEvent(event, window.frame());
         timelineAgentId = timelineAgent->id();
     }
 #if ENABLE(WEB_REPLAY)
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
-        replayAgent->willDispatchEvent(event, window ? window->frame() : nullptr);
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
+        replayAgent->willDispatchEvent(event, window.frame());
 #endif
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
@@ -388,40 +391,34 @@ void InspectorInstrumentation::didDispatchEventOnWindowImpl(const InspectorInstr
         timelineAgent->didDispatchEvent();
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents* instrumentingAgents, const String& url, int lineNumber, Frame* frame)
+InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& url, int lineNumber)
 {
     int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
-        timelineAgent->willEvaluateScript(url, lineNumber, frame);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
+        timelineAgent->willEvaluateScript(url, lineNumber, &frame);
         timelineAgentId = timelineAgent->id();
     }
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didEvaluateScriptImpl(const InspectorInstrumentationCookie& cookie, Frame* frame)
+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)
+void InspectorInstrumentation::scriptsEnabledImpl(InstrumentingAgents& instrumentingAgents, bool isEnabled)
 {
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+    if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
         pageAgent->scriptsEnabled(isEnabled);
 }
 
-void InspectorInstrumentation::didCreateIsolatedContextImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, JSC::ExecState* scriptState, SecurityOrigin* origin)
-{
-    if (PageRuntimeAgent* runtimeAgent = instrumentingAgents->pageRuntimeAgent())
-        runtimeAgent->didCreateIsolatedContext(frame, scriptState, origin);
-}
-
-InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InstrumentingAgents* instrumentingAgents, int timerId, ScriptExecutionContext* context)
+InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InstrumentingAgents& instrumentingAgents, int timerId, ScriptExecutionContext* context)
 {
     pauseOnNativeEventIfNeeded(instrumentingAgents, false, timerFiredEventName, false);
 
     int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
         timelineAgent->willFireTimer(timerId, frameForScriptExecutionContext(context));
         timelineAgentId = timelineAgent->id();
     }
@@ -430,23 +427,24 @@ InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(Instr
 
 void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCookie& cookie)
 {
-    cancelPauseOnNativeEvent(cookie.instrumentingAgents());
+    if (cookie.isValid())
+        cancelPauseOnNativeEvent(*cookie.instrumentingAgents());
 
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
         timelineAgent->didFireTimer();
 }
 
-void InspectorInstrumentation::didInvalidateLayoutImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+void InspectorInstrumentation::didInvalidateLayoutImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->didInvalidateLayout(frame);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
+        timelineAgent->didInvalidateLayout(&frame);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
     int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
-        timelineAgent->willLayout(frame);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
+        timelineAgent->willLayout(&frame);
         timelineAgentId = timelineAgent->id();
     }
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
@@ -461,12 +459,12 @@ void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCooki
         pageAgent->didLayout();
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEventImpl(InstrumentingAgents* instrumentingAgents, XMLHttpRequest* request, ScriptExecutionContext* context)
+InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEventImpl(InstrumentingAgents& instrumentingAgents, XMLHttpRequest& request, ScriptExecutionContext* context)
 {
     int timelineAgentId = 0;
-    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
-    if (timelineAgent && request->hasEventListeners(eventNames().loadEvent)) {
-        timelineAgent->willDispatchXHRLoadEvent(request->url(), frameForScriptExecutionContext(context));
+    InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
+    if (timelineAgent && request.hasEventListeners(eventNames().loadEvent)) {
+        timelineAgent->willDispatchXHRLoadEvent(request.url(), frameForScriptExecutionContext(context));
         timelineAgentId = timelineAgent->id();
     }
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
@@ -478,101 +476,105 @@ void InspectorInstrumentation::didDispatchXHRLoadEventImpl(const InspectorInstru
         timelineAgent->didDispatchXHRLoadEvent();
 }
 
-void InspectorInstrumentation::willPaintImpl(InstrumentingAgents* instrumentingAgents, RenderObject* renderer)
+void InspectorInstrumentation::willPaintImpl(InstrumentingAgents& instrumentingAgents, RenderObject* renderer)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->willPaint(&renderer->frame());
 }
 
-void InspectorInstrumentation::didPaintImpl(InstrumentingAgents* instrumentingAgents, RenderObject* renderer, const LayoutRect& rect)
+void InspectorInstrumentation::didPaintImpl(InstrumentingAgents& instrumentingAgents, RenderObject* renderer, const LayoutRect& rect)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didPaint(renderer, rect);
 
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+    if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
         pageAgent->didPaint(renderer, rect);
 }
 
-void InspectorInstrumentation::willScrollLayerImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+void InspectorInstrumentation::willScrollLayerImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->willScroll(frame);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
+        timelineAgent->willScroll(&frame);
 }
 
-void InspectorInstrumentation::didScrollLayerImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::didScrollLayerImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didScroll();
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyleImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyleImpl(InstrumentingAgents& instrumentingAgents, Document& document)
 {
     int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
-        timelineAgent->willRecalculateStyle(frame);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
+        timelineAgent->willRecalculateStyle(document.frame());
         timelineAgentId = timelineAgent->id();
     }
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->willRecalculateStyle();
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
 void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrumentationCookie& cookie)
 {
+    if (!cookie.isValid())
+        return;
+    
+    InstrumentingAgents& instrumentingAgents = *cookie.instrumentingAgents();
+
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
         timelineAgent->didRecalculateStyle();
-    InstrumentingAgents* instrumentingAgents = cookie.instrumentingAgents();
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didRecalculateStyle();
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+    if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
         pageAgent->didRecalculateStyle();
 }
 
-void InspectorInstrumentation::didScheduleStyleRecalculationImpl(InstrumentingAgents* instrumentingAgents, Document* document)
+void InspectorInstrumentation::didScheduleStyleRecalculationImpl(InstrumentingAgents& instrumentingAgents, Document& document)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->didScheduleStyleRecalculation(document->frame());
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
-        resourceAgent->didScheduleStyleRecalculation(document);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
+        timelineAgent->didScheduleStyleRecalculation(document.frame());
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
+        resourceAgent->didScheduleStyleRecalculation(&document);
 }
 
-void InspectorInstrumentation::applyEmulatedMediaImpl(InstrumentingAgents* instrumentingAgents, String* media)
+void InspectorInstrumentation::applyEmulatedMediaImpl(InstrumentingAgents& instrumentingAgents, String& media)
 {
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
-        pageAgent->applyEmulatedMedia(media);
+    if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
+        pageAgent->applyEmulatedMedia(&media);
 }
 
-void InspectorInstrumentation::willSendRequestImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
+void InspectorInstrumentation::willSendRequestImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->willSendResourceRequest(identifier, request, loader->frame());
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->willSendRequest(identifier, loader, request, redirectResponse);
 }
 
-void InspectorInstrumentation::continueAfterPingLoaderImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
+void InspectorInstrumentation::continueAfterPingLoaderImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& response)
 {
     willSendRequestImpl(instrumentingAgents, identifier, loader, request, response);
 }
 
-void InspectorInstrumentation::markResourceAsCachedImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
+void InspectorInstrumentation::markResourceAsCachedImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->markResourceAsCached(identifier);
 }
 
-void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InstrumentingAgents* instrumentingAgents, DocumentLoader* loader, CachedResource* cachedResource)
+void InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl(InstrumentingAgents& instrumentingAgents, DocumentLoader* loader, CachedResource* cachedResource)
 {
-    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
+    if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
         return;
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didLoadResourceFromMemoryCache(loader, cachedResource);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, Frame* frame, int length)
+InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceDataImpl(InstrumentingAgents& instrumentingAgents, Frame* frame, unsigned long identifier, int length)
 {
     int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
         timelineAgent->willReceiveResourceData(identifier, frame, length);
         timelineAgentId = timelineAgent->id();
     }
@@ -585,10 +587,10 @@ void InspectorInstrumentation::didReceiveResourceDataImpl(const InspectorInstrum
         timelineAgent->didReceiveResourceData();
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const ResourceResponse& response, Frame* frame)
+InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResponseImpl(InstrumentingAgents& instrumentingAgents, Frame* frame, unsigned long identifier, const ResourceResponse& response)
 {
     int timelineAgentId = 0;
-    InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent();
+    InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
     if (timelineAgent) {
         timelineAgent->willReceiveResourceResponse(identifier, response, frame);
         timelineAgentId = timelineAgent->id();
@@ -598,215 +600,220 @@ InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResourceResp
 
 void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
 {
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
-        timelineAgent->didReceiveResourceResponse();
+    if (!cookie.isValid())
+        return;
+
     if (!loader)
         return;
-    InstrumentingAgents* instrumentingAgents = cookie.instrumentingAgents();
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+
+    InstrumentingAgents& instrumentingAgents = *cookie.instrumentingAgents();
+
+    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+        timelineAgent->didReceiveResourceResponse();
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didReceiveResponse(identifier, loader, response, resourceLoader);
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    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)
+void InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl(Frame* frame, DocumentLoader& loader, unsigned long identifier, const ResourceResponse& r)
 {
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(frame, identifier, r);
-    InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r, nullptr);
+    InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, &loader, r, nullptr);
 }
 
-void InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
+void InspectorInstrumentation::continueAfterXFrameOptionsDeniedImpl(Frame* frame, DocumentLoader& loader, unsigned long identifier, const ResourceResponse& r)
 {
     didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
 }
 
-void InspectorInstrumentation::continueWithPolicyDownloadImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
+void InspectorInstrumentation::continueWithPolicyDownloadImpl(Frame* frame, DocumentLoader& loader, unsigned long identifier, const ResourceResponse& r)
 {
     didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
 }
 
-void InspectorInstrumentation::continueWithPolicyIgnoreImpl(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
+void InspectorInstrumentation::continueWithPolicyIgnoreImpl(Frame* frame, DocumentLoader& loader, unsigned long identifier, const ResourceResponse& r)
 {
     didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
 }
 
-void InspectorInstrumentation::didReceiveDataImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
+void InspectorInstrumentation::didReceiveDataImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didReceiveData(identifier, data, dataLength, encodedDataLength);
 }
 
-void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime)
+void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didFinishLoadingResource(identifier, false, finishTime, loader->frame());
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didFinishLoading(identifier, loader, finishTime);
 }
 
-void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
+void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didFinishLoadingResource(identifier, true, 0, loader->frame());
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didFailLoading(identifier, loader, error);
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
 }
 
-void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, ThreadableLoaderClient* client)
+void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, ThreadableLoaderClient* client)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->documentThreadableLoaderStartedLoadingForClient(identifier, client);
 }
 
-void InspectorInstrumentation::willLoadXHRImpl(InstrumentingAgents* instrumentingAgents, ThreadableLoaderClient* client, const String& method, const URL& url, bool async, PassRefPtr<FormData> formData, const HTTPHeaderMap& headers, bool includeCredentials)
+void InspectorInstrumentation::willLoadXHRImpl(InstrumentingAgents& instrumentingAgents, ThreadableLoaderClient* client, const String& method, const URL& url, bool async, PassRefPtr<FormData> formData, const HTTPHeaderMap& headers, bool includeCredentials)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->willLoadXHR(client, method, url, async, formData, headers, includeCredentials);
 }
 
-void InspectorInstrumentation::didFailXHRLoadingImpl(InstrumentingAgents* instrumentingAgents, ThreadableLoaderClient* client)
+void InspectorInstrumentation::didFailXHRLoadingImpl(InstrumentingAgents& instrumentingAgents, ThreadableLoaderClient* client)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didFailXHRLoading(client);
 }
 
-void InspectorInstrumentation::didFinishXHRLoadingImpl(InstrumentingAgents* instrumentingAgents, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
+void InspectorInstrumentation::didFinishXHRLoadingImpl(InstrumentingAgents& instrumentingAgents, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
 {
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->didFinishXHRLoading(identifier, url, sendURL, sendLineNumber, sendColumnNumber);
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didFinishXHRLoading(client, identifier, sourceString);
 }
 
-void InspectorInstrumentation::didReceiveXHRResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
+void InspectorInstrumentation::didReceiveXHRResponseImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didReceiveXHRResponse(identifier);
 }
 
-void InspectorInstrumentation::willLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::willLoadXHRSynchronouslyImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->willLoadXHRSynchronously();
 }
 
-void InspectorInstrumentation::didLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::didLoadXHRSynchronouslyImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didLoadXHRSynchronously();
 }
 
-void InspectorInstrumentation::scriptImportedImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const String& sourceString)
+void InspectorInstrumentation::scriptImportedImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const String& sourceString)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->setInitialScriptContent(identifier, sourceString);
 }
 
-void InspectorInstrumentation::scriptExecutionBlockedByCSPImpl(InstrumentingAgents* instrumentingAgents, const String& directiveText)
+void InspectorInstrumentation::scriptExecutionBlockedByCSPImpl(InstrumentingAgents& instrumentingAgents, const String& directiveText)
 {
-    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent())
+    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents.inspectorDebuggerAgent())
         debuggerAgent->scriptExecutionBlockedByCSP(directiveText);
 }
 
-void InspectorInstrumentation::didReceiveScriptResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
+void InspectorInstrumentation::didReceiveScriptResponseImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didReceiveScriptResponse(identifier);
 }
 
-void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->didMarkDOMContentEvent(frame);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
+        timelineAgent->didMarkDOMContentEvent(&frame);
 
-    if (&frame->page()->mainFrame() != frame)
+    if (!frame.isMainFrame())
         return;
 
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
         domAgent->mainFrameDOMContentLoaded();
 
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+    if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
         pageAgent->domContentEventFired();
 }
 
-void InspectorInstrumentation::loadEventFiredImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+void InspectorInstrumentation::loadEventFiredImpl(InstrumentingAgents& instrumentingAgents, Frame* frame)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didMarkLoadEvent(frame);
 
-    if (&frame->page()->mainFrame() != frame)
+    if (!frame->isMainFrame())
         return;
 
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+    if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
         pageAgent->loadEventFired();
 }
 
-void InspectorInstrumentation::frameDetachedFromParentImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+void InspectorInstrumentation::frameDetachedFromParentImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
-        pageAgent->frameDetached(frame);
+    if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
+        pageAgent->frameDetached(&frame);
 
 #if ENABLE(WEB_REPLAY)
-    if (frame->isMainFrame()) {
-        if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
-            replayAgent->frameDetached(frame);
+    if (frame.isMainFrame()) {
+        if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
+            replayAgent->frameDetached(&frame);
     }
 #endif
 }
 
-void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents* instrumentingAgents, Page* page, DocumentLoader* loader)
+void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents& instrumentingAgents, Page* page, DocumentLoader* loader)
 {
-    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
+    if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
         return;
 
     if (loader->frame()->isMainFrame()) {
-        if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+        if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
             consoleAgent->reset();
 
-        if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+        if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
             resourceAgent->mainFrameNavigated(loader);
 
-        if (InspectorCSSAgent* cssAgent = instrumentingAgents->inspectorCSSAgent())
+        if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent())
             cssAgent->reset();
 
 #if ENABLE(SQL_DATABASE)
-        if (InspectorDatabaseAgent* databaseAgent = instrumentingAgents->inspectorDatabaseAgent())
+        if (InspectorDatabaseAgent* databaseAgent = instrumentingAgents.inspectorDatabaseAgent())
             databaseAgent->clearResources();
 #endif
 
-        if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+        if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
             domAgent->setDocument(page->mainFrame().document());
 
-        if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
+        if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents.inspectorLayerTreeAgent())
             layerTreeAgent->reset();
     }
 
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
         domAgent->didCommitLoad(loader->frame()->document());
 
-    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+    if (InspectorPageAgent* pageAgent = instrumentingAgents.inspectorPageAgent())
         pageAgent->frameNavigated(loader);
 
 #if ENABLE(WEB_REPLAY)
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->frameNavigated(loader);
 #endif
 }
 
-void InspectorInstrumentation::frameDocumentUpdatedImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+void InspectorInstrumentation::frameDocumentUpdatedImpl(InstrumentingAgents& instrumentingAgents, Frame* frame)
 {
-    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
+    if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
         return;
-    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+    if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
         domAgent->frameDocumentUpdated(frame);
 }
 
-void InspectorInstrumentation::loaderDetachedFromFrameImpl(InstrumentingAgents* instrumentingAgents, DocumentLoader* loader)
+void InspectorInstrumentation::loaderDetachedFromFrameImpl(InstrumentingAgents& instrumentingAgents, DocumentLoader& loader)
 {
-    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())
-        inspectorPageAgent->loaderDetachedFromFrame(loader);
+    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
+        inspectorPageAgent->loaderDetachedFromFrame(&loader);
 }
 
 void InspectorInstrumentation::frameStartedLoadingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
@@ -833,9 +840,9 @@ void InspectorInstrumentation::frameClearedScheduledNavigationImpl(Instrumenting
         inspectorPageAgent->frameClearedScheduledNavigation(frame);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialogImpl(InstrumentingAgents* instrumentingAgents, const String& message)
+InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialogImpl(InstrumentingAgents& instrumentingAgents, const String& message)
 {
-    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents->inspectorPageAgent())
+    if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
         inspectorPageAgent->willRunJavaScriptDialog(message);
     return InspectorInstrumentationCookie(instrumentingAgents, 0);
 }
@@ -846,22 +853,21 @@ void InspectorInstrumentation::didRunJavaScriptDialogImpl(const InspectorInstrum
         inspectorPageAgent->didRunJavaScriptDialog();
 }
 
-void InspectorInstrumentation::willDestroyCachedResourceImpl(CachedResource* cachedResource)
+void InspectorInstrumentation::willDestroyCachedResourceImpl(CachedResource& cachedResource)
 {
-    if (!instrumentingAgentsSet)
+    if (!s_instrumentingAgentsSet)
         return;
-    HashSet<InstrumentingAgents*>::iterator end = instrumentingAgentsSet->end();
-    for (HashSet<InstrumentingAgents*>::iterator it = instrumentingAgentsSet->begin(); it != end; ++it) {
-        InstrumentingAgents* instrumentingAgents = *it;
-        if (InspectorResourceAgent* inspectorResourceAgent = instrumentingAgents->inspectorResourceAgent())
-            inspectorResourceAgent->willDestroyCachedResource(cachedResource);
+
+    for (auto* instrumentingAgent : *s_instrumentingAgentsSet) {
+        if (InspectorResourceAgent* inspectorResourceAgent = instrumentingAgent->inspectorResourceAgent())
+            inspectorResourceAgent->willDestroyCachedResource(&cachedResource);
     }
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InstrumentingAgents* instrumentingAgents, unsigned startLine, Frame* frame)
+InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTMLImpl(InstrumentingAgents& instrumentingAgents, unsigned startLine, Frame* frame)
 {
     int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
         timelineAgent->willWriteHTML(startLine, frame);
         timelineAgentId = timelineAgent->id();
     }
@@ -881,109 +887,109 @@ static bool isConsoleAssertMessage(MessageSource source, MessageType type)
 }
 
 // FIXME: Drop this once we no longer generate stacks outside of Inspector.
-void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier)
+void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents& instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier)
 {
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->addMessageToConsole(source, type, level, message, callStack, requestIdentifier);
     // FIXME: This should just pass the message on to the debugger agent. JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes.
-    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
+    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents.inspectorDebuggerAgent()) {
         if (isConsoleAssertMessage(source, type))
             debuggerAgent->handleConsoleAssert(message);
     }
 }
 
-void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments, unsigned long requestIdentifier)
+void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents& instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments, unsigned long requestIdentifier)
 {
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->addMessageToConsole(source, type, level, message, state, arguments, requestIdentifier);
     // FIXME: This should just pass the message on to the debugger agent. JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes.
-    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
+    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents.inspectorDebuggerAgent()) {
         if (isConsoleAssertMessage(source, type))
             debuggerAgent->handleConsoleAssert(message);
     }
 }
 
-void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents* instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* state, unsigned long requestIdentifier)
+void InspectorInstrumentation::addMessageToConsoleImpl(InstrumentingAgents& instrumentingAgents, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* state, unsigned long requestIdentifier)
 {
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->addMessageToConsole(source, type, level, message, scriptID, lineNumber, columnNumber, state, requestIdentifier);
     // FIXME: This should just pass the message on to the debugger agent. JavaScriptCore InspectorDebuggerAgent should know Console MessageTypes.
-    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
+    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents.inspectorDebuggerAgent()) {
         if (isConsoleAssertMessage(source, type))
             debuggerAgent->handleConsoleAssert(message);
     }
 }
 
-void InspectorInstrumentation::consoleCountImpl(InstrumentingAgents* instrumentingAgents, JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
+void InspectorInstrumentation::consoleCountImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
 {
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->count(state, arguments);
 }
 
-void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, const String& title)
+void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& title)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->time(frame, title);
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
+        timelineAgent->time(&frame, title);
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->startTiming(title);
 }
 
-void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, const String& title, PassRefPtr<ScriptCallStack> stack)
+void InspectorInstrumentation::stopConsoleTimingImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& title, PassRefPtr<ScriptCallStack> stack)
 {
-    if (WebConsoleAgent* consoleAgent = instrumentingAgents->webConsoleAgent())
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
         consoleAgent->stopTiming(title, stack);
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->timeEnd(frame, title);
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
+        timelineAgent->timeEnd(&frame, title);
 }
 
-void InspectorInstrumentation::consoleTimeStampImpl(InstrumentingAgents* instrumentingAgents, Frame* frame, PassRefPtr<ScriptArguments> arguments)
+void InspectorInstrumentation::consoleTimeStampImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, PassRefPtr<ScriptArguments> arguments)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
         String message;
         arguments->getFirstArgumentAsString(message);
-        timelineAgent->didTimeStamp(frame, message);
+        timelineAgent->didTimeStamp(&frame, message);
      }
 }
 
-void InspectorInstrumentation::startProfilingImpl(InstrumentingAgents* instrumentingAgents, JSC::ExecState* exec, const String& title)
+void InspectorInstrumentation::startProfilingImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* exec, const String& title)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->persistentInspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.persistentInspectorTimelineAgent())
         timelineAgent->startFromConsole(exec, title);
 }
 
-PassRefPtr<JSC::Profile> InspectorInstrumentation::stopProfilingImpl(InstrumentingAgents* instrumentingAgents, JSC::ExecState* exec, const String& title)
+PassRefPtr<JSC::Profile> InspectorInstrumentation::stopProfilingImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* exec, const String& title)
 {
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->persistentInspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.persistentInspectorTimelineAgent())
         return timelineAgent->stopFromConsole(exec, title);
     return nullptr;
 }
 
 #if ENABLE(SQL_DATABASE)
-void InspectorInstrumentation::didOpenDatabaseImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
+void InspectorInstrumentation::didOpenDatabaseImpl(InstrumentingAgents& instrumentingAgents, PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
 {
-    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
+    if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
         return;
-    if (InspectorDatabaseAgent* dbAgent = instrumentingAgents->inspectorDatabaseAgent())
+    if (InspectorDatabaseAgent* dbAgent = instrumentingAgents.inspectorDatabaseAgent())
         dbAgent->didOpenDatabase(database, domain, name, version);
 }
 #endif
 
-void InspectorInstrumentation::didDispatchDOMStorageEventImpl(InstrumentingAgents* instrumentingAgents, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
+void InspectorInstrumentation::didDispatchDOMStorageEventImpl(InstrumentingAgents& instrumentingAgents, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
 {
-    if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
+    if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents.inspectorDOMStorageAgent())
         domStorageAgent->didDispatchDOMStorageEvent(key, oldValue, newValue, storageType, securityOrigin, page);
 }
 
-bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents* instrumentingAgents)
+bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorWorkerAgent* workerAgent = instrumentingAgents->inspectorWorkerAgent())
+    if (InspectorWorkerAgent* workerAgent = instrumentingAgents.inspectorWorkerAgent())
         return workerAgent->shouldPauseDedicatedWorkerOnStart();
     return false;
 }
 
-void InspectorInstrumentation::didStartWorkerGlobalScopeImpl(InstrumentingAgents* instrumentingAgents, WorkerGlobalScopeProxy* workerGlobalScopeProxy, const URL& url)
+void InspectorInstrumentation::didStartWorkerGlobalScopeImpl(InstrumentingAgents& instrumentingAgents, WorkerGlobalScopeProxy* workerGlobalScopeProxy, const URL& url)
 {
-    if (InspectorWorkerAgent* workerAgent = instrumentingAgents->inspectorWorkerAgent())
+    if (InspectorWorkerAgent* workerAgent = instrumentingAgents.inspectorWorkerAgent())
         workerAgent->didStartWorkerGlobalScope(workerGlobalScopeProxy, url);
 }
 
@@ -991,160 +997,162 @@ void InspectorInstrumentation::willEvaluateWorkerScript(WorkerGlobalScope* worke
 {
     if (workerThreadStartMode != PauseWorkerGlobalScopeOnStart)
         return;
-    InstrumentingAgents* instrumentingAgents = instrumentationForWorkerGlobalScope(workerGlobalScope);
+
+    InstrumentingAgents* instrumentingAgents = instrumentingAgentsForWorkerGlobalScope(workerGlobalScope);
     if (!instrumentingAgents)
         return;
+
     if (WorkerRuntimeAgent* runtimeAgent = instrumentingAgents->workerRuntimeAgent())
         runtimeAgent->pauseWorkerGlobalScope(workerGlobalScope);
 }
 
-void InspectorInstrumentation::workerGlobalScopeTerminatedImpl(InstrumentingAgents* instrumentingAgents, WorkerGlobalScopeProxy* proxy)
+void InspectorInstrumentation::workerGlobalScopeTerminatedImpl(InstrumentingAgents& instrumentingAgents, WorkerGlobalScopeProxy* proxy)
 {
-    if (InspectorWorkerAgent* workerAgent = instrumentingAgents->inspectorWorkerAgent())
+    if (InspectorWorkerAgent* workerAgent = instrumentingAgents.inspectorWorkerAgent())
         workerAgent->workerGlobalScopeTerminated(proxy);
 }
 
 #if ENABLE(WEB_SOCKETS)
-void InspectorInstrumentation::didCreateWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const URL& requestURL, const URL&, const String& protocol, Document* document)
+void InspectorInstrumentation::didCreateWebSocketImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const URL& requestURL, const URL&, const String& protocol, Document* document)
 {
-    if (!instrumentingAgents->inspectorEnvironment().developerExtrasEnabled())
+    if (!instrumentingAgents.inspectorEnvironment().developerExtrasEnabled())
         return;
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didCreateWebSocket(identifier, requestURL);
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didCreateWebSocket(identifier, requestURL, protocol, document->frame());
 }
 
-void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const ResourceRequest& request, Document* document)
+void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const ResourceRequest& request, Document* document)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->willSendWebSocketHandshakeRequest(identifier, request);
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->willSendWebSocketHandshakeRequest(identifier, document->frame());
 }
 
-void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const ResourceResponse& response, Document* document)
+void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const ResourceResponse& response, Document* document)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didReceiveWebSocketHandshakeResponse(identifier, response);
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didReceiveWebSocketHandshakeResponse(identifier, document->frame());
 }
 
-void InspectorInstrumentation::didCloseWebSocketImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, Document* document)
+void InspectorInstrumentation::didCloseWebSocketImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, Document* document)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didCloseWebSocket(identifier);
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didDestroyWebSocket(identifier, document->frame());
 }
 
-void InspectorInstrumentation::didReceiveWebSocketFrameImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketFrame& frame)
+void InspectorInstrumentation::didReceiveWebSocketFrameImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const WebSocketFrame& frame)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didReceiveWebSocketFrame(identifier, frame);
 }
-void InspectorInstrumentation::didReceiveWebSocketFrameErrorImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const String& errorMessage)
+void InspectorInstrumentation::didReceiveWebSocketFrameErrorImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const String& errorMessage)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didReceiveWebSocketFrameError(identifier, errorMessage);
 }
-void InspectorInstrumentation::didSendWebSocketFrameImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const WebSocketFrame& frame)
+void InspectorInstrumentation::didSendWebSocketFrameImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, const WebSocketFrame& frame)
 {
-    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents.inspectorResourceAgent())
         resourceAgent->didSendWebSocketFrame(identifier, frame);
 }
 #endif
 
 #if ENABLE(WEB_REPLAY)
-void InspectorInstrumentation::sessionCreatedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySession> session)
+void InspectorInstrumentation::sessionCreatedImpl(InstrumentingAgents& instrumentingAgents, PassRefPtr<ReplaySession> session)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->sessionCreated(session);
 }
 
-void InspectorInstrumentation::sessionLoadedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySession> session)
+void InspectorInstrumentation::sessionLoadedImpl(InstrumentingAgents& instrumentingAgents, PassRefPtr<ReplaySession> session)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->sessionLoaded(session);
 }
 
-void InspectorInstrumentation::sessionModifiedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySession> session)
+void InspectorInstrumentation::sessionModifiedImpl(InstrumentingAgents& instrumentingAgents, PassRefPtr<ReplaySession> session)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->sessionModified(session);
 }
 
-void InspectorInstrumentation::segmentCreatedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySessionSegment> segment)
+void InspectorInstrumentation::segmentCreatedImpl(InstrumentingAgents& instrumentingAgents, PassRefPtr<ReplaySessionSegment> segment)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->segmentCreated(segment);
 }
 
-void InspectorInstrumentation::segmentCompletedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySessionSegment> segment)
+void InspectorInstrumentation::segmentCompletedImpl(InstrumentingAgents& instrumentingAgents, PassRefPtr<ReplaySessionSegment> segment)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->segmentCompleted(segment);
 }
 
-void InspectorInstrumentation::segmentLoadedImpl(InstrumentingAgents* instrumentingAgents, PassRefPtr<ReplaySessionSegment> segment)
+void InspectorInstrumentation::segmentLoadedImpl(InstrumentingAgents& instrumentingAgents, PassRefPtr<ReplaySessionSegment> segment)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->segmentLoaded(segment);
 }
 
-void InspectorInstrumentation::segmentUnloadedImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::segmentUnloadedImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->segmentUnloaded();
 }
 
-void InspectorInstrumentation::captureStartedImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::captureStartedImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->captureStarted();
 }
 
-void InspectorInstrumentation::captureStoppedImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::captureStoppedImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->captureStopped();
 }
 
-void InspectorInstrumentation::playbackStartedImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::playbackStartedImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->playbackStarted();
 }
 
-void InspectorInstrumentation::playbackPausedImpl(InstrumentingAgents* instrumentingAgents, const ReplayPosition& position)
+void InspectorInstrumentation::playbackPausedImpl(InstrumentingAgents& instrumentingAgents, const ReplayPosition& position)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->playbackPaused(position);
 }
 
-void InspectorInstrumentation::playbackHitPositionImpl(InstrumentingAgents* instrumentingAgents, const ReplayPosition& position)
+void InspectorInstrumentation::playbackHitPositionImpl(InstrumentingAgents& instrumentingAgents, const ReplayPosition& position)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->playbackHitPosition(position);
 }
 
-void InspectorInstrumentation::playbackFinishedImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::playbackFinishedImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorReplayAgent* replayAgent = instrumentingAgents->inspectorReplayAgent())
+    if (InspectorReplayAgent* replayAgent = instrumentingAgents.inspectorReplayAgent())
         replayAgent->playbackFinished();
 }
 #endif
 
-void InspectorInstrumentation::networkStateChangedImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::networkStateChangedImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorApplicationCacheAgent* applicationCacheAgent = instrumentingAgents->inspectorApplicationCacheAgent())
+    if (InspectorApplicationCacheAgent* applicationCacheAgent = instrumentingAgents.inspectorApplicationCacheAgent())
         applicationCacheAgent->networkStateChanged();
 }
 
-void InspectorInstrumentation::updateApplicationCacheStatusImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+void InspectorInstrumentation::updateApplicationCacheStatusImpl(InstrumentingAgents& instrumentingAgents, Frame* frame)
 {
-    if (InspectorApplicationCacheAgent* applicationCacheAgent = instrumentingAgents->inspectorApplicationCacheAgent())
+    if (InspectorApplicationCacheAgent* applicationCacheAgent = instrumentingAgents.inspectorApplicationCacheAgent())
         applicationCacheAgent->updateApplicationCacheStatus(frame);
 }
 
@@ -1172,40 +1180,40 @@ bool InspectorInstrumentation::replayAgentEnabled(ScriptExecutionContext* script
 #endif
 }
 
-void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, bool isDOMEvent, const String& eventName, bool synchronous)
+void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents& instrumentingAgents, bool isDOMEvent, const String& eventName, bool synchronous)
 {
-    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
+    if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent())
         domDebuggerAgent->pauseOnNativeEventIfNeeded(isDOMEvent, eventName, synchronous);
 }
 
-void InspectorInstrumentation::cancelPauseOnNativeEvent(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::cancelPauseOnNativeEvent(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent())
+    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents.inspectorDebuggerAgent())
         debuggerAgent->cancelPauseOnNextStatement();
 }
 
-void InspectorInstrumentation::didRequestAnimationFrameImpl(InstrumentingAgents* instrumentingAgents, int callbackId, Frame* frame)
+void InspectorInstrumentation::didRequestAnimationFrameImpl(InstrumentingAgents& instrumentingAgents, int callbackId, Frame* frame)
 {
     pauseOnNativeEventIfNeeded(instrumentingAgents, false, requestAnimationFrameEventName, true);
 
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didRequestAnimationFrame(callbackId, frame);
 }
 
-void InspectorInstrumentation::didCancelAnimationFrameImpl(InstrumentingAgents* instrumentingAgents, int callbackId, Frame* frame)
+void InspectorInstrumentation::didCancelAnimationFrameImpl(InstrumentingAgents& instrumentingAgents, int callbackId, Frame* frame)
 {
     pauseOnNativeEventIfNeeded(instrumentingAgents, false, cancelAnimationFrameEventName, true);
 
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
         timelineAgent->didCancelAnimationFrame(callbackId, frame);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrameImpl(InstrumentingAgents* instrumentingAgents, int callbackId, Frame* frame)
+InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrameImpl(InstrumentingAgents& instrumentingAgents, int callbackId, Frame* frame)
 {
     pauseOnNativeEventIfNeeded(instrumentingAgents, false, animationFrameFiredEventName, false);
 
     int timelineAgentId = 0;
-    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
         timelineAgent->willFireAnimationFrame(callbackId, frame);
         timelineAgentId = timelineAgent->id();
     }
@@ -1218,28 +1226,31 @@ void InspectorInstrumentation::didFireAnimationFrameImpl(const InspectorInstrume
         timelineAgent->didFireAnimationFrame();
 }
 
-void InspectorInstrumentation::registerInstrumentingAgents(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::registerInstrumentingAgents(InstrumentingAgents& instrumentingAgents)
 {
-    if (!instrumentingAgentsSet)
-        instrumentingAgentsSet = new HashSet<InstrumentingAgents*>();
-    instrumentingAgentsSet->add(instrumentingAgents);
+    if (!s_instrumentingAgentsSet)
+        s_instrumentingAgentsSet = new HashSet<InstrumentingAgents*>();
+
+    s_instrumentingAgentsSet->add(&instrumentingAgents);
 }
 
-void InspectorInstrumentation::unregisterInstrumentingAgents(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::unregisterInstrumentingAgents(InstrumentingAgents& instrumentingAgents)
 {
-    if (!instrumentingAgentsSet)
+    if (!s_instrumentingAgentsSet)
         return;
-    instrumentingAgentsSet->remove(instrumentingAgents);
-    if (instrumentingAgentsSet->isEmpty()) {
-        delete instrumentingAgentsSet;
-        instrumentingAgentsSet = nullptr;
+
+    s_instrumentingAgentsSet->remove(&instrumentingAgents);
+    if (s_instrumentingAgentsSet->isEmpty()) {
+        delete s_instrumentingAgentsSet;
+        s_instrumentingAgentsSet = nullptr;
     }
 }
 
 InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
 {
-    if (!cookie.instrumentingAgents())
+    if (!cookie.isValid())
         return nullptr;
+
     InspectorTimelineAgent* timelineAgent = cookie.instrumentingAgents()->inspectorTimelineAgent();
     if (timelineAgent && cookie.hasMatchingTimelineAgentId(timelineAgent->id()))
         return timelineAgent;
@@ -1248,47 +1259,49 @@ InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const In
 
 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page* page)
 {
-    if (!page)
-        return nullptr;
-    return instrumentationForPage(page);
+    return page ? instrumentingAgentsForPage(*page) : nullptr;
+}
+
+InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage(Page& page)
+{
+    ASSERT(isMainThread());
+    return page.inspectorController().m_instrumentingAgents.get();
 }
 
 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForRenderer(RenderObject* renderer)
 {
-    return instrumentingAgentsForFrame(&renderer->frame());
+    return instrumentingAgentsForFrame(renderer->frame());
 }
 
 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope* workerGlobalScope)
 {
-    if (!workerGlobalScope)
-        return nullptr;
-    return instrumentationForWorkerGlobalScope(workerGlobalScope);
+    return workerGlobalScope ? workerGlobalScope->workerInspectorController().m_instrumentingAgents.get() : nullptr;
 }
 
 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForNonDocumentContext(ScriptExecutionContext* context)
 {
     ASSERT(context);
     if (is<WorkerGlobalScope>(*context))
-        return instrumentationForWorkerGlobalScope(downcast<WorkerGlobalScope>(context));
+        return instrumentingAgentsForWorkerGlobalScope(downcast<WorkerGlobalScope>(context));
     return nullptr;
 }
 
-void InspectorInstrumentation::layerTreeDidChangeImpl(InstrumentingAgents* instrumentingAgents)
+void InspectorInstrumentation::layerTreeDidChangeImpl(InstrumentingAgents& instrumentingAgents)
 {
-    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
+    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents.inspectorLayerTreeAgent())
         layerTreeAgent->layerTreeDidChange();
 }
 
-void InspectorInstrumentation::renderLayerDestroyedImpl(InstrumentingAgents* instrumentingAgents, const RenderLayer* renderLayer)
+void InspectorInstrumentation::renderLayerDestroyedImpl(InstrumentingAgents& instrumentingAgents, const RenderLayer& renderLayer)
 {
-    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
-        layerTreeAgent->renderLayerDestroyed(renderLayer);
+    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents.inspectorLayerTreeAgent())
+        layerTreeAgent->renderLayerDestroyed(&renderLayer);
 }
 
-void InspectorInstrumentation::pseudoElementDestroyedImpl(InstrumentingAgents* instrumentingAgents, PseudoElement* pseudoElement)
+void InspectorInstrumentation::pseudoElementDestroyedImpl(InstrumentingAgents& instrumentingAgents, PseudoElement& pseudoElement)
 {
-    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
-        layerTreeAgent->pseudoElementDestroyed(pseudoElement);
+    if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents.inspectorLayerTreeAgent())
+        layerTreeAgent->pseudoElementDestroyed(&pseudoElement);
 }
 
 } // namespace WebCore
index 8003c54..d7caa59 100644 (file)
@@ -109,32 +109,32 @@ struct ReplayPosition;
 
 class InspectorInstrumentation {
 public:
-    static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld&);
+    static void didClearWindowObjectInWorld(Frame&, DOMWrapperWorld&);
     static bool isDebuggerPaused(Frame*);
 
-    static void willInsertDOMNode(Document*, Node* parent);
-    static void didInsertDOMNode(Document*, Node*);
-    static void willRemoveDOMNode(Document*, Node*);
-    static void didRemoveDOMNode(Document*, Node*);
-    static void willModifyDOMAttr(Document*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
-    static void didModifyDOMAttr(Document*, Element*, const AtomicString& name, const AtomicString& value);
-    static void didRemoveDOMAttr(Document*, Element*, const AtomicString& name);
-    static void characterDataModified(Document*, CharacterData*);
-    static void didInvalidateStyleAttr(Document*, Node*);
+    static void willInsertDOMNode(Document&, Node& parent);
+    static void didInsertDOMNode(Document&, Node&);
+    static void willRemoveDOMNode(Document&, Node&);
+    static void didRemoveDOMNode(Document&, Node&);
+    static void willModifyDOMAttr(Document&, Element&, const AtomicString& oldValue, const AtomicString& newValue);
+    static void didModifyDOMAttr(Document&, Element&, const AtomicString& name, const AtomicString& value);
+    static void didRemoveDOMAttr(Document&, Element&, const AtomicString& name);
+    static void characterDataModified(Document&, CharacterData&);
+    static void didInvalidateStyleAttr(Document&, Node&);
     static void frameWindowDiscarded(Frame*, DOMWindow*);
-    static void mediaQueryResultChanged(Document*);
-    static void didPushShadowRoot(Element* host, ShadowRoot*);
-    static void willPopShadowRoot(Element* host, ShadowRoot*);
-    static void didCreateNamedFlow(Document*, WebKitNamedFlow*);
-    static void willRemoveNamedFlow(Document*, WebKitNamedFlow*);
-    static void didChangeRegionOverset(Document*, WebKitNamedFlow*);
-    static void didRegisterNamedFlowContentElement(Document*, WebKitNamedFlow*, Node* contentElement, Node* nextContentElement = nullptr);
-    static void didUnregisterNamedFlowContentElement(Document*, WebKitNamedFlow*, Node* contentElement);
-
-    static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
-    static bool handleMousePress(Page*);
-    static bool handleTouchEvent(Page*, Node*);
-    static bool forcePseudoState(Element*, CSSSelector::PseudoClassType);
+    static void mediaQueryResultChanged(Document&);
+    static void didPushShadowRoot(Element& host, ShadowRoot&);
+    static void willPopShadowRoot(Element& host, ShadowRoot&);
+    static void didCreateNamedFlow(Document*, WebKitNamedFlow&);
+    static void willRemoveNamedFlow(Document*, WebKitNamedFlow&);
+    static void didChangeRegionOverset(Document&, WebKitNamedFlow&);
+    static void didRegisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr);
+    static void didUnregisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement);
+
+    static void mouseDidMoveOverElement(Page&, const HitTestResult&, unsigned modifierFlags);
+    static bool handleMousePress(Frame&);
+    static bool handleTouchEvent(Frame&, Node&);
+    static bool forcePseudoState(Element&, CSSSelector::PseudoClassType);
 
     static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
     static void didScheduleResourceRequest(Document*, const String& url);
@@ -143,50 +143,49 @@ public:
 
     static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine);
     static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
-    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext*, XMLHttpRequest*);
+    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext*, XMLHttpRequest&);
     static void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&);
-    static InspectorInstrumentationCookie willDispatchEvent(Document*, const Event&, bool hasEventListeners);
+    static InspectorInstrumentationCookie willDispatchEvent(Document&, const Event&, bool hasEventListeners);
     static void didDispatchEvent(const InspectorInstrumentationCookie&);
-    static InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, Event*);
+    static InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, const Event&);
     static void didHandleEvent(const InspectorInstrumentationCookie&);
-    static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event& event, DOMWindow* window);
+    static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event&, DOMWindow&);
     static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
-    static InspectorInstrumentationCookie willEvaluateScript(Frame*, const String& url, int lineNumber);
-    static void didEvaluateScript(const InspectorInstrumentationCookie&, Frame*);
-    static void scriptsEnabled(Page*, bool isEnabled);
-    static void didCreateIsolatedContext(Frame*, JSC::ExecState*, SecurityOrigin*);
+    static InspectorInstrumentationCookie willEvaluateScript(Frame&, const String& url, int lineNumber);
+    static void didEvaluateScript(const InspectorInstrumentationCookie&, Frame&);
+    static void scriptsEnabled(Page&, bool isEnabled);
     static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext*, int timerId);
     static void didFireTimer(const InspectorInstrumentationCookie&);
-    static void didInvalidateLayout(Frame*);
-    static InspectorInstrumentationCookie willLayout(Frame*);
+    static void didInvalidateLayout(Frame&);
+    static InspectorInstrumentationCookie willLayout(Frame&);
     static void didLayout(const InspectorInstrumentationCookie&, RenderObject*);
-    static void didScroll(Page*);
-    static InspectorInstrumentationCookie willDispatchXHRLoadEvent(ScriptExecutionContext*, XMLHttpRequest*);
+    static void didScroll(Page&);
+    static InspectorInstrumentationCookie willDispatchXHRLoadEvent(ScriptExecutionContext*, XMLHttpRequest&);
     static void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&);
-    static void willScrollLayer(Frame*);
-    static void didScrollLayer(Frame*);
+    static void willScrollLayer(Frame&);
+    static void didScrollLayer(Frame&);
     static void willPaint(RenderObject*);
     static void didPaint(RenderObject*, const LayoutRect&);
-    static InspectorInstrumentationCookie willRecalculateStyle(Document*);
+    static InspectorInstrumentationCookie willRecalculateStyle(Document&);
     static void didRecalculateStyle(const InspectorInstrumentationCookie&);
-    static void didScheduleStyleRecalculation(Document*);
+    static void didScheduleStyleRecalculation(Document&);
 
-    static void applyEmulatedMedia(Frame*, String*);
+    static void applyEmulatedMedia(Frame&, String&);
     static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
     static void continueAfterPingLoader(Frame&, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
-    static void markResourceAsCached(Page*, unsigned long identifier);
-    static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, CachedResource*);
+    static void markResourceAsCached(Page&, unsigned long identifier);
+    static void didLoadResourceFromMemoryCache(Page&, DocumentLoader*, CachedResource*);
     static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier, int length);
     static void didReceiveResourceData(const InspectorInstrumentationCookie&);
     static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&);
     static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
-    static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
-    static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
-    static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
+    static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader&, unsigned long identifier, const ResourceResponse&);
+    static void continueWithPolicyDownload(Frame*, DocumentLoader&, unsigned long identifier, const ResourceResponse&);
+    static void continueWithPolicyIgnore(Frame*, DocumentLoader&, unsigned long identifier, const ResourceResponse&);
     static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
     static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime);
     static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
-    static void documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext*, unsigned long identifier, ThreadableLoaderClient*);
+    static void documentThreadableLoaderStartedLoadingForClient(Document&, unsigned long identifier, ThreadableLoaderClient*);
     static void willLoadXHR(ScriptExecutionContext*, ThreadableLoaderClient*, const String&, const URL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
     static void didFailXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*);
     static void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
@@ -196,44 +195,44 @@ public:
     static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString);
     static void scriptExecutionBlockedByCSP(ScriptExecutionContext*, const String& directiveText);
     static void didReceiveScriptResponse(ScriptExecutionContext*, unsigned long identifier);
-    static void domContentLoadedEventFired(Frame*);
+    static void domContentLoadedEventFired(Frame&);
     static void loadEventFired(Frame*);
-    static void frameDetachedFromParent(Frame*);
-    static void didCommitLoad(Frame*, DocumentLoader*);
+    static void frameDetachedFromParent(Frame&);
+    static void didCommitLoad(Frame&, DocumentLoader*);
     static void frameDocumentUpdated(Frame*);
-    static void loaderDetachedFromFrame(Frame*, DocumentLoader*);
+    static void loaderDetachedFromFrame(Frame&, DocumentLoader&);
     static void frameStartedLoading(Frame&);
     static void frameStoppedLoading(Frame&);
     static void frameScheduledNavigation(Frame&, double delay);
     static void frameClearedScheduledNavigation(Frame&);
-    static InspectorInstrumentationCookie willRunJavaScriptDialog(Page*, const String& message);
+    static InspectorInstrumentationCookie willRunJavaScriptDialog(Page&, const String& message);
     static void didRunJavaScriptDialog(const InspectorInstrumentationCookie&);
-    static void willDestroyCachedResource(CachedResource*);
+    static void willDestroyCachedResource(CachedResource&);
 
     static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned startLine);
     static void didWriteHTML(const InspectorInstrumentationCookie&, unsigned endLine);
 
     // FIXME: Remove once we no longer generate stacks outside of Inspector.
-    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>, unsigned long requestIdentifier = 0);
-    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>, unsigned long requestIdentifier = 0);
-    static void addMessageToConsole(Page*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0);
+    static void addMessageToConsole(Page&, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>, unsigned long requestIdentifier = 0);
+    static void addMessageToConsole(Page&, MessageSource, MessageType, MessageLevel, const String& message, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>, unsigned long requestIdentifier = 0);
+    static void addMessageToConsole(Page&, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0);
 
     // FIXME: Convert to ScriptArguments to match non-worker context.
     static void addMessageToConsole(WorkerGlobalScope*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>, unsigned long requestIdentifier = 0);
     static void addMessageToConsole(WorkerGlobalScope*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0);
 
-    static void consoleCount(Page*, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    static void startConsoleTiming(Frame*, const String& title);
-    static void stopConsoleTiming(Frame*, const String& title, PassRefPtr<Inspector::ScriptCallStack>);
-    static void consoleTimeStamp(Frame*, PassRefPtr<Inspector::ScriptArguments>);
+    static void consoleCount(Page&, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    static void startConsoleTiming(Frame&, const String& title);
+    static void stopConsoleTiming(Frame&, const String& title, PassRefPtr<Inspector::ScriptCallStack>);
+    static void consoleTimeStamp(Frame&, PassRefPtr<Inspector::ScriptArguments>);
 
     static void didRequestAnimationFrame(Document*, int callbackId);
     static void didCancelAnimationFrame(Document*, int callbackId);
     static InspectorInstrumentationCookie willFireAnimationFrame(Document*, int callbackId);
     static void didFireAnimationFrame(const InspectorInstrumentationCookie&);
 
-    static void startProfiling(Page*, JSC::ExecState*, const String& title);
-    static PassRefPtr<JSC::Profile> stopProfiling(Page*, JSC::ExecState*, const String& title);
+    static void startProfiling(Page&, JSC::ExecState*, const String& title);
+    static PassRefPtr<JSC::Profile> stopProfiling(Page&, JSC::ExecState*, const String& title);
 
 #if ENABLE(SQL_DATABASE)
     static void didOpenDatabase(ScriptExecutionContext*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
@@ -247,22 +246,22 @@ public:
     static void willEvaluateWorkerScript(WorkerGlobalScope*, int workerThreadStartMode);
 
 #if ENABLE(WEB_REPLAY)
-    static void sessionCreated(Page*, PassRefPtr<ReplaySession>);
-    static void sessionLoaded(Page*, PassRefPtr<ReplaySession>);
-    static void sessionModified(Page*, PassRefPtr<ReplaySession>);
+    static void sessionCreated(Page&, PassRefPtr<ReplaySession>);
+    static void sessionLoaded(Page&, PassRefPtr<ReplaySession>);
+    static void sessionModified(Page&, PassRefPtr<ReplaySession>);
 
-    static void segmentCreated(Page*, PassRefPtr<ReplaySessionSegment>);
-    static void segmentCompleted(Page*, PassRefPtr<ReplaySessionSegment>);
-    static void segmentLoaded(Page*, PassRefPtr<ReplaySessionSegment>);
-    static void segmentUnloaded(Page*);
+    static void segmentCreated(Page&, PassRefPtr<ReplaySessionSegment>);
+    static void segmentCompleted(Page&, PassRefPtr<ReplaySessionSegment>);
+    static void segmentLoaded(Page&, PassRefPtr<ReplaySessionSegment>);
+    static void segmentUnloaded(Page&);
 
-    static void captureStarted(Page*);
-    static void captureStopped(Page*);
+    static void captureStarted(Page&);
+    static void captureStopped(Page&);
 
-    static void playbackStarted(Page*);
-    static void playbackPaused(Page*, const ReplayPosition&);
-    static void playbackHitPosition(Page*, const ReplayPosition&);
-    static void playbackFinished(Page*);
+    static void playbackStarted(Page&);
+    static void playbackPaused(Page&, const ReplayPosition&);
+    static void playbackHitPosition(Page&, const ReplayPosition&);
+    static void playbackFinished(Page&);
 #endif
 
 #if ENABLE(WEB_SOCKETS)
@@ -283,6 +282,10 @@ public:
     static void networkStateChanged(Page*);
     static void updateApplicationCacheStatus(Frame*);
 
+    static void layerTreeDidChange(Page*);
+    static void renderLayerDestroyed(Page*, const RenderLayer&);
+    static void pseudoElementDestroyed(Page*, PseudoElement&);
+
 #if ENABLE(INSPECTOR)
     static void frontendCreated() { s_frontendCounter += 1; }
     static void frontendDeleted() { s_frontendCounter -= 1; }
@@ -298,207 +301,207 @@ public:
     static bool replayAgentEnabled(ScriptExecutionContext*) { return false; }
 #endif
 
-    static void registerInstrumentingAgents(InstrumentingAgents*);
-    static void unregisterInstrumentingAgents(InstrumentingAgents*);
+    WEBCORE_EXPORT static InstrumentingAgents* instrumentingAgentsForPage(Page*);
 
-    static void layerTreeDidChange(Page*);
-    static void renderLayerDestroyed(Page*, const RenderLayer*);
-    static void pseudoElementDestroyed(Page*, PseudoElement*);
+    static void registerInstrumentingAgents(InstrumentingAgents&);
+    static void unregisterInstrumentingAgents(InstrumentingAgents&);
 
 private:
 #if ENABLE(INSPECTOR)
-    static void didClearWindowObjectInWorldImpl(InstrumentingAgents*, Frame*, DOMWrapperWorld&);
-    static bool isDebuggerPausedImpl(InstrumentingAgents*);
-
-    static void willInsertDOMNodeImpl(InstrumentingAgents*, Node* parent);
-    static void didInsertDOMNodeImpl(InstrumentingAgents*, Node*);
-    static void willRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
-    static void didRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
-    static void willModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
-    static void didModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name, const AtomicString& value);
-    static void didRemoveDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name);
-    static void characterDataModifiedImpl(InstrumentingAgents*, CharacterData*);
-    static void didInvalidateStyleAttrImpl(InstrumentingAgents*, Node*);
-    static void frameWindowDiscardedImpl(InstrumentingAgents*, DOMWindow*);
-    static void mediaQueryResultChangedImpl(InstrumentingAgents*);
-    static void didPushShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
-    static void willPopShadowRootImpl(InstrumentingAgents*, Element* host, ShadowRoot*);
-    static void didCreateNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
-    static void willRemoveNamedFlowImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
-    static void didChangeRegionOversetImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
-    static void didRegisterNamedFlowContentElementImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*, Node* contentElement, Node* nextContentElement = nullptr);
-    static void didUnregisterNamedFlowContentElementImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*, Node* contentElement);
-
-    static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags);
-    static bool handleTouchEventImpl(InstrumentingAgents*, Node*);
-    static bool handleMousePressImpl(InstrumentingAgents*);
-    static bool forcePseudoStateImpl(InstrumentingAgents*, Element*, CSSSelector::PseudoClassType);
-
-    static void willSendXMLHttpRequestImpl(InstrumentingAgents*, const String& url);
-    static void didScheduleResourceRequestImpl(InstrumentingAgents*, const String& url, Frame*);
-    static void didInstallTimerImpl(InstrumentingAgents*, int timerId, int timeout, bool singleShot, ScriptExecutionContext*);
-    static void didRemoveTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
-
-    static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents*, const String& scriptName, int scriptLine, ScriptExecutionContext*);
+    static void didClearWindowObjectInWorldImpl(InstrumentingAgents&, Frame&, DOMWrapperWorld&);
+    static bool isDebuggerPausedImpl(InstrumentingAgents&);
+
+    static void willInsertDOMNodeImpl(InstrumentingAgents&, Node& parent);
+    static void didInsertDOMNodeImpl(InstrumentingAgents&, Node&);
+    static void willRemoveDOMNodeImpl(InstrumentingAgents&, Node&);
+    static void didRemoveDOMNodeImpl(InstrumentingAgents&, Node&);
+    static void willModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& oldValue, const AtomicString& newValue);
+    static void didModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& name, const AtomicString& value);
+    static void didRemoveDOMAttrImpl(InstrumentingAgents&, Element&, const AtomicString& name);
+    static void characterDataModifiedImpl(InstrumentingAgents&, CharacterData&);
+    static void didInvalidateStyleAttrImpl(InstrumentingAgents&, Node&);
+    static void frameWindowDiscardedImpl(InstrumentingAgents&, DOMWindow*);
+    static void mediaQueryResultChangedImpl(InstrumentingAgents&);
+    static void didPushShadowRootImpl(InstrumentingAgents&, Element& host, ShadowRoot&);
+    static void willPopShadowRootImpl(InstrumentingAgents&, Element& host, ShadowRoot&);
+    static void didCreateNamedFlowImpl(InstrumentingAgents&, Document*, WebKitNamedFlow&);
+    static void willRemoveNamedFlowImpl(InstrumentingAgents&, Document*, WebKitNamedFlow&);
+    static void didChangeRegionOversetImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&);
+    static void didRegisterNamedFlowContentElementImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr);
+    static void didUnregisterNamedFlowContentElementImpl(InstrumentingAgents&, Document&, WebKitNamedFlow&, Node& contentElement);
+
+    static void mouseDidMoveOverElementImpl(InstrumentingAgents&, const HitTestResult&, unsigned modifierFlags);
+    static bool handleTouchEventImpl(InstrumentingAgents&, Node&);
+    static bool handleMousePressImpl(InstrumentingAgents&);
+    static bool forcePseudoStateImpl(InstrumentingAgents&, Element&, CSSSelector::PseudoClassType);
+
+    static void willSendXMLHttpRequestImpl(InstrumentingAgents&, const String& url);
+    static void didScheduleResourceRequestImpl(InstrumentingAgents&, const String& url, Frame*);
+    static void didInstallTimerImpl(InstrumentingAgents&, int timerId, int timeout, bool singleShot, ScriptExecutionContext*);
+    static void didRemoveTimerImpl(InstrumentingAgents&, int timerId, ScriptExecutionContext*);
+
+    static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, ScriptExecutionContext*);
     static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
-    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
+    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents&, XMLHttpRequest&, ScriptExecutionContext*);
     static void didDispatchXHRReadyStateChangeEventImpl(const InspectorInstrumentationCookie&);
-    static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents*, const Event&, bool hasEventListeners, Document*);
-    static InspectorInstrumentationCookie willHandleEventImpl(InstrumentingAgents*, Event*);
+    static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents&, Document&, const Event&, bool hasEventListeners);
+    static InspectorInstrumentationCookie willHandleEventImpl(InstrumentingAgents&, const Event&);
     static void didHandleEventImpl(const InspectorInstrumentationCookie&);
     static void didDispatchEventImpl(const InspectorInstrumentationCookie&);
-    static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents*, const Event&, DOMWindow*);
+    static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents&, const Event&, DOMWindow&);
     static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
-    static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents*, const String& url, int lineNumber, Frame*);
-    static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&, Frame*);
-    static void scriptsEnabledImpl(InstrumentingAgents*, bool isEnabled);
-    static void didCreateIsolatedContextImpl(InstrumentingAgents*, Frame*, JSC::ExecState*, SecurityOrigin*);
-    static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents*, int timerId, ScriptExecutionContext*);
+    static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber);
+    static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&, Frame&);
+    static void scriptsEnabledImpl(InstrumentingAgents&, bool isEnabled);
+    static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents&, int timerId, ScriptExecutionContext*);
     static void didFireTimerImpl(const InspectorInstrumentationCookie&);
-    static void didInvalidateLayoutImpl(InstrumentingAgents*, Frame*);
-    static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents*, Frame*);
+    static void didInvalidateLayoutImpl(InstrumentingAgents&, Frame&);
+    static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents&, Frame&);
     static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject*);
-    static void didScrollImpl(InstrumentingAgents*);
-    static InspectorInstrumentationCookie willDispatchXHRLoadEventImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
+    static void didScrollImpl(InstrumentingAgents&);
+    static InspectorInstrumentationCookie willDispatchXHRLoadEventImpl(InstrumentingAgents&, XMLHttpRequest&, ScriptExecutionContext*);
     static void didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie&);
-    static void willScrollLayerImpl(InstrumentingAgents*, Frame*);
-    static void didScrollLayerImpl(InstrumentingAgents*);
-    static void willPaintImpl(InstrumentingAgents*, RenderObject*);
-    static void didPaintImpl(InstrumentingAgents*, RenderObject*, const LayoutRect&);
-    static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*);
+    static void willScrollLayerImpl(InstrumentingAgents&, Frame&);
+    static void didScrollLayerImpl(InstrumentingAgents&);
+    static void willPaintImpl(InstrumentingAgents&, RenderObject*);
+    static void didPaintImpl(InstrumentingAgents&, RenderObject*, const LayoutRect&);
+    static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents&, Document&);
     static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
-    static void didScheduleStyleRecalculationImpl(InstrumentingAgents*, Document*);
-
-    static void applyEmulatedMediaImpl(InstrumentingAgents*, String*);
-    static void willSendRequestImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
-    static void continueAfterPingLoaderImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
-    static void markResourceAsCachedImpl(InstrumentingAgents*, unsigned long identifier);
-    static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents*, DocumentLoader*, CachedResource*);
-    static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents*, unsigned long identifier, Frame*, int length);
+    static void didScheduleStyleRecalculationImpl(InstrumentingAgents&, Document&);
+
+    static void applyEmulatedMediaImpl(InstrumentingAgents&, String&);
+    static void willSendRequestImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
+    static void continueAfterPingLoaderImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse&);
+    static void markResourceAsCachedImpl(InstrumentingAgents&, unsigned long identifier);
+    static void didLoadResourceFromMemoryCacheImpl(InstrumentingAgents&, DocumentLoader*, CachedResource*);
+    static InspectorInstrumentationCookie willReceiveResourceDataImpl(InstrumentingAgents&, Frame*, unsigned long identifier, int length);
     static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&);
-    static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Frame*);
+    static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InstrumentingAgents&, Frame*, unsigned long identifier, const ResourceResponse&);
     static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
-    static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
-    static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
-    static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
-    static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
-    static void didReceiveDataImpl(InstrumentingAgents*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
-    static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, double finishTime);
-    static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, const ResourceError&);
-    static void documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents*, unsigned long identifier, ThreadableLoaderClient*);
-    static void willLoadXHRImpl(InstrumentingAgents*, ThreadableLoaderClient*, const String&, const URL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
-    static void didFailXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*);
-    static void didFinishXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
-    static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier);
-    static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*);
-    static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*);
-    static void scriptImportedImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString);
-    static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents*, const String& directiveText);
-    static void didReceiveScriptResponseImpl(InstrumentingAgents*, unsigned long identifier);
-    static void domContentLoadedEventFiredImpl(InstrumentingAgents*, Frame*);
-    static void loadEventFiredImpl(InstrumentingAgents*, Frame*);
-    static void frameDetachedFromParentImpl(InstrumentingAgents*, Frame*);
-    static void didCommitLoadImpl(InstrumentingAgents*, Page*, DocumentLoader*);
-    static void frameDocumentUpdatedImpl(InstrumentingAgents*, Frame*);
-    static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*);
+    static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader&, unsigned long identifier, const ResourceResponse&);
+    static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader&, unsigned long identifier, const ResourceResponse&);
+    static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader&, unsigned long identifier, const ResourceResponse&);
+    static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader&, unsigned long identifier, const ResourceResponse&);
+    static void didReceiveDataImpl(InstrumentingAgents&, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
+    static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, double finishTime);
+    static void didFailLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceError&);
+    static void documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents&, unsigned long identifier, ThreadableLoaderClient*);
+    static void willLoadXHRImpl(InstrumentingAgents&, ThreadableLoaderClient*, const String&, const URL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
+    static void didFailXHRLoadingImpl(InstrumentingAgents&, ThreadableLoaderClient*);
+    static void didFinishXHRLoadingImpl(InstrumentingAgents&, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
+    static void didReceiveXHRResponseImpl(InstrumentingAgents&, unsigned long identifier);
+    static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&);
+    static void didLoadXHRSynchronouslyImpl(InstrumentingAgents&);
+    static void scriptImportedImpl(InstrumentingAgents&, unsigned long identifier, const String& sourceString);
+    static void scriptExecutionBlockedByCSPImpl(InstrumentingAgents&, const String& directiveText);
+    static void didReceiveScriptResponseImpl(InstrumentingAgents&, unsigned long identifier);
+    static void domContentLoadedEventFiredImpl(InstrumentingAgents&, Frame&);
+    static void loadEventFiredImpl(InstrumentingAgents&, Frame*);
+    static void frameDetachedFromParentImpl(InstrumentingAgents&, Frame&);
+    static void didCommitLoadImpl(InstrumentingAgents&, Page*, DocumentLoader*);
+    static void frameDocumentUpdatedImpl(InstrumentingAgents&, Frame*);
+    static void loaderDetachedFromFrameImpl(InstrumentingAgents&, DocumentLoader&);
     static void frameStartedLoadingImpl(InstrumentingAgents&, Frame&);
     static void frameStoppedLoadingImpl(InstrumentingAgents&, Frame&);
     static void frameScheduledNavigationImpl(InstrumentingAgents&, Frame&, double delay);
     static void frameClearedScheduledNavigationImpl(InstrumentingAgents&, Frame&);
-    static InspectorInstrumentationCookie willRunJavaScriptDialogImpl(InstrumentingAgents*, const String& message);
+    static InspectorInstrumentationCookie willRunJavaScriptDialogImpl(InstrumentingAgents&, const String& message);
     static void didRunJavaScriptDialogImpl(const InspectorInstrumentationCookie&);
-    static void willDestroyCachedResourceImpl(CachedResource*);
+    static void willDestroyCachedResourceImpl(CachedResource&);
 
-    static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents*, unsigned startLine, Frame*);
+    static InspectorInstrumentationCookie willWriteHTMLImpl(InstrumentingAgents&, unsigned startLine, Frame*);
     static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned endLine);
 
-    static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>, unsigned long requestIdentifier);
-    static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState*, unsigned long requestIdentifier);
+    static void addMessageToConsoleImpl(InstrumentingAgents&, MessageSource, MessageType, MessageLevel, const String& message, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>, unsigned long requestIdentifier);
+    static void addMessageToConsoleImpl(InstrumentingAgents&, MessageSource, MessageType, MessageLevel, const String& message, const String& scriptID, unsigned lineNumber, unsigned columnNumber, JSC::ExecState*, unsigned long requestIdentifier);
 
     // FIXME: Remove once we no longer generate stacks outside of Inspector.
-    static void addMessageToConsoleImpl(InstrumentingAgents*, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>, unsigned long requestIdentifier);
+    static void addMessageToConsoleImpl(InstrumentingAgents&, MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<Inspector::ScriptCallStack>, unsigned long requestIdentifier);
 
-    static void consoleCountImpl(InstrumentingAgents*, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
-    static void startConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title);
-    static void stopConsoleTimingImpl(InstrumentingAgents*, Frame*, const String& title, PassRefPtr<Inspector::ScriptCallStack>);
-    static void consoleTimeStampImpl(InstrumentingAgents*, Frame*, PassRefPtr<Inspector::ScriptArguments>);
+    static void consoleCountImpl(InstrumentingAgents&, JSC::ExecState*, PassRefPtr<Inspector::ScriptArguments>);
+    static void startConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title);
+    static void stopConsoleTimingImpl(InstrumentingAgents&, Frame&, const String& title, PassRefPtr<Inspector::ScriptCallStack>);
+    static void consoleTimeStampImpl(InstrumentingAgents&, Frame&, PassRefPtr<Inspector::ScriptArguments>);
 
-    static void didRequestAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
-    static void didCancelAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
-    static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents*, int callbackId, Frame*);
+    static void didRequestAnimationFrameImpl(InstrumentingAgents&, int callbackId, Frame*);
+    static void didCancelAnimationFrameImpl(InstrumentingAgents&, int callbackId, Frame*);
+    static InspectorInstrumentationCookie willFireAnimationFrameImpl(InstrumentingAgents&, int callbackId, Frame*);
     static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&);
 
-    static void startProfilingImpl(InstrumentingAgents*, JSC::ExecState*, const String& title);
-    static PassRefPtr<JSC::Profile> stopProfilingImpl(InstrumentingAgents*, JSC::ExecState*, const String& title);
+    static void startProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title);
+    static PassRefPtr<JSC::Profile> stopProfilingImpl(InstrumentingAgents&, JSC::ExecState*, const String& title);
 
 #if ENABLE(SQL_DATABASE)
-    static void didOpenDatabaseImpl(InstrumentingAgents*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
+    static void didOpenDatabaseImpl(InstrumentingAgents&, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
 #endif
 
-    static void didDispatchDOMStorageEventImpl(InstrumentingAgents*, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
+    static void didDispatchDOMStorageEventImpl(InstrumentingAgents&, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
 
-    static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents*);
-    static void didStartWorkerGlobalScopeImpl(InstrumentingAgents*, WorkerGlobalScopeProxy*, const URL&);
-    static void workerGlobalScopeTerminatedImpl(InstrumentingAgents*, WorkerGlobalScopeProxy*);
+    static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents&);
+    static void didStartWorkerGlobalScopeImpl(InstrumentingAgents&, WorkerGlobalScopeProxy*, const URL&);
+    static void workerGlobalScopeTerminatedImpl(InstrumentingAgents&, WorkerGlobalScopeProxy*);
 
 #if ENABLE(WEB_REPLAY)
-    static void sessionCreatedImpl(InstrumentingAgents*, PassRefPtr<ReplaySession>);
-    static void sessionLoadedImpl(InstrumentingAgents*, PassRefPtr<ReplaySession>);
-    static void sessionModifiedImpl(InstrumentingAgents*, PassRefPtr<ReplaySession>);
+    static void sessionCreatedImpl(InstrumentingAgents&, PassRefPtr<ReplaySession>);
+    static void sessionLoadedImpl(InstrumentingAgents&, PassRefPtr<ReplaySession>);
+    static void sessionModifiedImpl(InstrumentingAgents&, PassRefPtr<ReplaySession>);
 
-    static void segmentCreatedImpl(InstrumentingAgents*, PassRefPtr<ReplaySessionSegment>);
-    static void segmentCompletedImpl(InstrumentingAgents*, PassRefPtr<ReplaySessionSegment>);
-    static void segmentLoadedImpl(InstrumentingAgents*, PassRefPtr<ReplaySessionSegment>);
-    static void segmentUnloadedImpl(InstrumentingAgents*);
+    static void segmentCreatedImpl(InstrumentingAgents&, PassRefPtr<ReplaySessionSegment>);
+    static void segmentCompletedImpl(InstrumentingAgents&, PassRefPtr<ReplaySessionSegment>);
+    static void segmentLoadedImpl(InstrumentingAgents&, PassRefPtr<ReplaySessionSegment>);
+    static void segmentUnloadedImpl(InstrumentingAgents&);
 
-    static void captureStartedImpl(InstrumentingAgents*);
-    static void captureStoppedImpl(InstrumentingAgents*);
+    static void captureStartedImpl(InstrumentingAgents&);
+    static void captureStoppedImpl(InstrumentingAgents&);
 
-    static void playbackStartedImpl(InstrumentingAgents*);
-    static void playbackPausedImpl(InstrumentingAgents*, const ReplayPosition&);
-    static void playbackHitPositionImpl(InstrumentingAgents*, const ReplayPosition&);
-    static void playbackFinishedImpl(InstrumentingAgents*);
+    static void playbackStartedImpl(InstrumentingAgents&);
+    static void playbackPausedImpl(InstrumentingAgents&, const ReplayPosition&);
+    static void playbackHitPositionImpl(InstrumentingAgents&, const ReplayPosition&);
+    static void playbackFinishedImpl(InstrumentingAgents&);
 #endif
 
 #if ENABLE(WEB_SOCKETS)
-    static void didCreateWebSocketImpl(InstrumentingAgents*, unsigned long identifier, const URL& requestURL, const URL& documentURL, const String& protocol, Document*);
-    static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents*, unsigned long identifier, const ResourceRequest&, Document*);
-    static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Document*);
-    static void didCloseWebSocketImpl(InstrumentingAgents*, unsigned long identifier, Document*);
-    static void didReceiveWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
-    static void didSendWebSocketFrameImpl(InstrumentingAgents*, unsigned long identifier, const WebSocketFrame&);
-    static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents*, unsigned long identifier, const String&);
+    static void didCreateWebSocketImpl(InstrumentingAgents&, unsigned long identifier, const URL& requestURL, const URL& documentURL, const String& protocol, Document*);
+    static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents&, unsigned long identifier, const ResourceRequest&, Document*);
+    static void didReceiveWebSocketHandshakeResponseImpl(InstrumentingAgents&, unsigned long identifier, const ResourceResponse&, Document*);
+    static void didCloseWebSocketImpl(InstrumentingAgents&, unsigned long identifier, Document*);
+    static void didReceiveWebSocketFrameImpl(InstrumentingAgents&, unsigned long identifier, const WebSocketFrame&);
+    static void didSendWebSocketFrameImpl(InstrumentingAgents&, unsigned long identifier, const WebSocketFrame&);
+    static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents&, unsigned long identifier, const String&);
 #endif
 
-    static void networkStateChangedImpl(InstrumentingAgents*);
-    static void updateApplicationCacheStatusImpl(InstrumentingAgents*, Frame*);
+    static void networkStateChangedImpl(InstrumentingAgents&);
+    static void updateApplicationCacheStatusImpl(InstrumentingAgents&, Frame*);
 
-    WEBCORE_EXPORT static InstrumentingAgents* instrumentingAgentsForPage(Page*);
+    static void layerTreeDidChangeImpl(InstrumentingAgents&);
+    static void renderLayerDestroyedImpl(InstrumentingAgents&, const RenderLayer&);
+    static void pseudoElementDestroyedImpl(InstrumentingAgents&, PseudoElement&);
+
+    static InstrumentingAgents* instrumentingAgentsForPage(Page&);
+    static InstrumentingAgents* instrumentingAgentsForFrame(Frame&);
     static InstrumentingAgents* instrumentingAgentsForFrame(Frame*);
     static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*);
+    static InstrumentingAgents* instrumentingAgentsForDocument(Document&);
     static InstrumentingAgents* instrumentingAgentsForDocument(Document*);
     static InstrumentingAgents* instrumentingAgentsForRenderer(RenderObject*);
 
     static InstrumentingAgents* instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope*);
     static InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ScriptExecutionContext*);
 
-    static void pauseOnNativeEventIfNeeded(InstrumentingAgents*, bool isDOMEvent, const String& eventName, bool synchronous);
-    static void cancelPauseOnNativeEvent(InstrumentingAgents*);
     static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
 
-    static void layerTreeDidChangeImpl(InstrumentingAgents*);
-    static void renderLayerDestroyedImpl(InstrumentingAgents*, const RenderLayer*);
-    static void pseudoElementDestroyedImpl(InstrumentingAgents*, PseudoElement*);
+    static void pauseOnNativeEventIfNeeded(InstrumentingAgents&, bool isDOMEvent, const String& eventName, bool synchronous);
+    static void cancelPauseOnNativeEvent(InstrumentingAgents&);
 
     WEBCORE_EXPORT static int s_frontendCounter;
 #endif
 };
 
-inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld& world)
+inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame& frame, DOMWrapperWorld& world)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didClearWindowObjectInWorldImpl(instrumentingAgents, frame, world);
+        didClearWindowObjectInWorldImpl(*instrumentingAgents, frame, world);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(world);
@@ -510,67 +513,67 @@ inline bool InspectorInstrumentation::isDebuggerPaused(Frame* frame)
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(false);
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return isDebuggerPausedImpl(instrumentingAgents);
+        return isDebuggerPausedImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(frame);
 #endif
     return false;
 }
 
-inline void InspectorInstrumentation::willInsertDOMNode(Document* document, Node* parent)
+inline void InspectorInstrumentation::willInsertDOMNode(Document& document, Node& parent)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        willInsertDOMNodeImpl(instrumentingAgents, parent);
+        willInsertDOMNodeImpl(*instrumentingAgents, parent);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(parent);
 #endif
 }
 
-inline void InspectorInstrumentation::didInsertDOMNode(Document* document, Node* node)
+inline void InspectorInstrumentation::didInsertDOMNode(Document& document, Node& node)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didInsertDOMNodeImpl(instrumentingAgents, node);
+        didInsertDOMNodeImpl(*instrumentingAgents, node);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(node);
 #endif
 }
 
-inline void InspectorInstrumentation::willRemoveDOMNode(Document* document, Node* node)
+inline void InspectorInstrumentation::willRemoveDOMNode(Document& document, Node& node)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        willRemoveDOMNodeImpl(instrumentingAgents, node);
+        willRemoveDOMNodeImpl(*instrumentingAgents, node);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(node);
 #endif
 }
 
-inline void InspectorInstrumentation::didRemoveDOMNode(Document* document, Node* node)
+inline void InspectorInstrumentation::didRemoveDOMNode(Document& document, Node& node)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didRemoveDOMNodeImpl(instrumentingAgents, node);
+        didRemoveDOMNodeImpl(*instrumentingAgents, node);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(node);
 #endif
 }
 
-inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element, const AtomicString& oldValue, const AtomicString& newValue)
+inline void InspectorInstrumentation::willModifyDOMAttr(Document& document, Element& element, const AtomicString& oldValue, const AtomicString& newValue)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        willModifyDOMAttrImpl(instrumentingAgents, element, oldValue, newValue);
+        willModifyDOMAttrImpl(*instrumentingAgents, element, oldValue, newValue);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(element);
@@ -579,12 +582,12 @@ inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Elem
 #endif
 }
 
-inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element, const AtomicString& name, const AtomicString& value)
+inline void InspectorInstrumentation::didModifyDOMAttr(Document& document, Element& element, const AtomicString& name, const AtomicString& value)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didModifyDOMAttrImpl(instrumentingAgents, element, name, value);
+        didModifyDOMAttrImpl(*instrumentingAgents, element, name, value);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(element);
@@ -593,12 +596,12 @@ inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Eleme
 #endif
 }
 
-inline void InspectorInstrumentation::didRemoveDOMAttr(Document* document, Element* element, const AtomicString& name)
+inline void InspectorInstrumentation::didRemoveDOMAttr(Document& document, Element& element, const AtomicString& name)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didRemoveDOMAttrImpl(instrumentingAgents, element, name);
+        didRemoveDOMAttrImpl(*instrumentingAgents, element, name);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(element);
@@ -606,12 +609,12 @@ inline void InspectorInstrumentation::didRemoveDOMAttr(Document* document, Eleme
 #endif
 }
 
-inline void InspectorInstrumentation::didInvalidateStyleAttr(Document* document, Node* node)
+inline void InspectorInstrumentation::didInvalidateStyleAttr(Document& document, Node& node)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didInvalidateStyleAttrImpl(instrumentingAgents, node);
+        didInvalidateStyleAttrImpl(*instrumentingAgents, node);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(node);
@@ -622,90 +625,90 @@ inline void InspectorInstrumentation::frameWindowDiscarded(Frame* frame, DOMWind
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        frameWindowDiscardedImpl(instrumentingAgents, domWindow);
+        frameWindowDiscardedImpl(*instrumentingAgents, domWindow);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(domWindow);
 #endif
 }
 
-inline void InspectorInstrumentation::mediaQueryResultChanged(Document* document)
+inline void InspectorInstrumentation::mediaQueryResultChanged(Document& document)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        mediaQueryResultChangedImpl(instrumentingAgents);
+        mediaQueryResultChangedImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(document);
 #endif
 }
 
-inline void InspectorInstrumentation::didPushShadowRoot(Element* host, ShadowRoot* root)
+inline void InspectorInstrumentation::didPushShadowRoot(Element& host, ShadowRoot& root)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(&host->document()))
-        didPushShadowRootImpl(instrumentingAgents, host, root);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host.document()))
+        didPushShadowRootImpl(*instrumentingAgents, host, root);
 #else
     UNUSED_PARAM(host);
     UNUSED_PARAM(root);
 #endif
 }
 
-inline void InspectorInstrumentation::willPopShadowRoot(Element* host, ShadowRoot* root)
+inline void InspectorInstrumentation::willPopShadowRoot(Element& host, ShadowRoot& root)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(&host->document()))
-        willPopShadowRootImpl(instrumentingAgents, host, root);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(host.document()))
+        willPopShadowRootImpl(*instrumentingAgents, host, root);
 #else
     UNUSED_PARAM(host);
     UNUSED_PARAM(root);
 #endif
 }
 
-inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+inline void InspectorInstrumentation::didCreateNamedFlow(Document* document, WebKitNamedFlow& namedFlow)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didCreateNamedFlowImpl(instrumentingAgents, document, namedFlow);
+        didCreateNamedFlowImpl(*instrumentingAgents, document, namedFlow);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(namedFlow);
 #endif
 }
 
-inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow* namedFlow)
+inline void InspectorInstrumentation::willRemoveNamedFlow(Document* document, WebKitNamedFlow& namedFlow)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        willRemoveNamedFlowImpl(instrumentingAgents, document, namedFlow);
+        willRemoveNamedFlowImpl(*instrumentingAgents, document, namedFlow);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(namedFlow);
 #endif
 }
 
-inline void InspectorInstrumentation::didChangeRegionOverset(Document* document, WebKitNamedFlow* namedFlow)
+inline void InspectorInstrumentation::didChangeRegionOverset(Document& document, WebKitNamedFlow& namedFlow)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didChangeRegionOversetImpl(instrumentingAgents, document, namedFlow);
+        didChangeRegionOversetImpl(*instrumentingAgents, document, namedFlow);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(namedFlow);
 #endif
 }
 
-inline void InspectorInstrumentation::didRegisterNamedFlowContentElement(Document* document, WebKitNamedFlow* namedFlow, Node* contentElement, Node* nextContentElement)
+inline void InspectorInstrumentation::didRegisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement, Node* nextContentElement)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didRegisterNamedFlowContentElementImpl(instrumentingAgents, document, namedFlow, contentElement, nextContentElement);
+        didRegisterNamedFlowContentElementImpl(*instrumentingAgents, document, namedFlow, contentElement, nextContentElement);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(namedFlow);
@@ -714,12 +717,12 @@ inline void InspectorInstrumentation::didRegisterNamedFlowContentElement(Documen
 #endif
 }
 
-inline void InspectorInstrumentation::didUnregisterNamedFlowContentElement(Document* document, WebKitNamedFlow* namedFlow, Node* contentElement)
+inline void InspectorInstrumentation::didUnregisterNamedFlowContentElement(Document& document, WebKitNamedFlow& namedFlow, Node& contentElement)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didUnregisterNamedFlowContentElementImpl(instrumentingAgents, document, namedFlow, contentElement);
+        didUnregisterNamedFlowContentElementImpl(*instrumentingAgents, document, namedFlow, contentElement);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(namedFlow);
@@ -727,12 +730,12 @@ inline void InspectorInstrumentation::didUnregisterNamedFlowContentElement(Docum
 #endif
 }
 
-inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const HitTestResult& result, unsigned modifierFlags)
+inline void InspectorInstrumentation::mouseDidMoveOverElement(Page& page, const HitTestResult& result, unsigned modifierFlags)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        mouseDidMoveOverElementImpl(instrumentingAgents, result, modifierFlags);
+        mouseDidMoveOverElementImpl(*instrumentingAgents, result, modifierFlags);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(result);
@@ -740,37 +743,37 @@ inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const
 #endif
 }
 
-inline bool InspectorInstrumentation::handleTouchEvent(Page* page, Node* node)
+inline bool InspectorInstrumentation::handleTouchEvent(Frame& frame, Node& node)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(false);
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        return handleTouchEventImpl(instrumentingAgents, node);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        return handleTouchEventImpl(*instrumentingAgents, node);
 #else
-    UNUSED_PARAM(page);
+    UNUSED_PARAM(frame);
     UNUSED_PARAM(node);
 #endif
     return false;
 }
 
-inline bool InspectorInstrumentation::handleMousePress(Page* page)
+inline bool InspectorInstrumentation::handleMousePress(Frame& frame)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(false);
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        return handleMousePressImpl(instrumentingAgents);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        return handleMousePressImpl(*instrumentingAgents);
 #else
-    UNUSED_PARAM(page);
+    UNUSED_PARAM(frame);
 #endif
     return false;
 }
 
-inline bool InspectorInstrumentation::forcePseudoState(Element* element, CSSSelector::PseudoClassType pseudoState)
+inline bool InspectorInstrumentation::forcePseudoState(Element& element, CSSSelector::PseudoClassType pseudoState)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(false);
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(&element->document()))
-        return forcePseudoStateImpl(instrumentingAgents, element, pseudoState);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(element.document()))
+        return forcePseudoStateImpl(*instrumentingAgents, element, pseudoState);
 #else
     UNUSED_PARAM(element);
     UNUSED_PARAM(pseudoState);
@@ -778,12 +781,12 @@ inline bool InspectorInstrumentation::forcePseudoState(Element* element, CSSSele
     return false;
 }
 
-inline void InspectorInstrumentation::characterDataModified(Document* document, CharacterData* characterData)
+inline void InspectorInstrumentation::characterDataModified(Document& document, CharacterData& characterData)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        characterDataModifiedImpl(instrumentingAgents, characterData);
+        characterDataModifiedImpl(*instrumentingAgents, characterData);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(characterData);
@@ -795,7 +798,7 @@ inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionCont
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        willSendXMLHttpRequestImpl(instrumentingAgents, url);
+        willSendXMLHttpRequestImpl(*instrumentingAgents, url);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(url);
@@ -807,7 +810,7 @@ inline void InspectorInstrumentation::didScheduleResourceRequest(Document* docum
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didScheduleResourceRequestImpl(instrumentingAgents, url, document->frame());
+        didScheduleResourceRequestImpl(*instrumentingAgents, url, document->frame());
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(url);
@@ -819,7 +822,7 @@ inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext* co
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didInstallTimerImpl(instrumentingAgents, timerId, timeout, singleShot, context);
+        didInstallTimerImpl(*instrumentingAgents, timerId, timeout, singleShot, context);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(timerId);
@@ -833,7 +836,7 @@ inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext* con
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didRemoveTimerImpl(instrumentingAgents, timerId, context);
+        didRemoveTimerImpl(*instrumentingAgents, timerId, context);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(timerId);
@@ -845,7 +848,7 @@ inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willCallFunctionImpl(instrumentingAgents, scriptName, scriptLine, context);
+        return willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, context);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(scriptName);
@@ -867,12 +870,12 @@ inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumenta
 #endif
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext* context, XMLHttpRequest& request)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willDispatchXHRReadyStateChangeEventImpl(instrumentingAgents, request, context);
+        return willDispatchXHRReadyStateChangeEventImpl(*instrumentingAgents, request, context);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(request);
@@ -891,12 +894,12 @@ inline void InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(const
 #endif
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document* document, const Event& event, bool hasEventListeners)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document& document, const Event& event, bool hasEventListeners)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        return willDispatchEventImpl(instrumentingAgents, event, hasEventListeners, document);
+        return willDispatchEventImpl(*instrumentingAgents, document, event, hasEventListeners);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(event);
@@ -916,12 +919,12 @@ inline void InspectorInstrumentation::didDispatchEvent(const InspectorInstrument
 #endif
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willHandleEvent(ScriptExecutionContext* context, Event* event)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willHandleEvent(ScriptExecutionContext* context, const Event& event)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willHandleEventImpl(instrumentingAgents, event);
+        return willHandleEventImpl(*instrumentingAgents, event);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(event);
@@ -940,12 +943,12 @@ inline void InspectorInstrumentation::didHandleEvent(const InspectorInstrumentat
 #endif
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow* window)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindow(Frame* frame, const Event& event, DOMWindow& window)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willDispatchEventOnWindowImpl(instrumentingAgents, event, window);
+        return willDispatchEventOnWindowImpl(*instrumentingAgents, event, window);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(event);
@@ -965,12 +968,12 @@ inline void InspectorInstrumentation::didDispatchEventOnWindow(const InspectorIn
 #endif
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame* frame, const String& url, int lineNumber)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willEvaluateScriptImpl(instrumentingAgents, url, lineNumber, frame);
+        return willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(url);
@@ -979,7 +982,7 @@ inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScri
     return InspectorInstrumentationCookie();
 }
 
-inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie, Frame* frame)
+inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumentationCookie& cookie, Frame& frame)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
@@ -991,37 +994,24 @@ inline void InspectorInstrumentation::didEvaluateScript(const InspectorInstrumen
 #endif
 }
 
-inline void InspectorInstrumentation::scriptsEnabled(Page* page, bool isEnabled)
+inline void InspectorInstrumentation::scriptsEnabled(Page& page, bool isEnabled)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        return scriptsEnabledImpl(instrumentingAgents, isEnabled);
+        return scriptsEnabledImpl(*instrumentingAgents, isEnabled);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(isEnabled);
 #endif
 }
 
-inline void InspectorInstrumentation::didCreateIsolatedContext(Frame* frame, JSC::ExecState* scriptState, SecurityOrigin* origin)
-{
-#if ENABLE(INSPECTOR)
-    FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return didCreateIsolatedContextImpl(instrumentingAgents, frame, scriptState, origin);
-#else
-    UNUSED_PARAM(frame);
-    UNUSED_PARAM(scriptState);
-    UNUSED_PARAM(origin);
-#endif
-}
-
 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireTimer(ScriptExecutionContext* context, int timerId)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willFireTimerImpl(instrumentingAgents, timerId, context);
+        return willFireTimerImpl(*instrumentingAgents, timerId, context);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(timerId);
@@ -1040,23 +1030,23 @@ inline void InspectorInstrumentation::didFireTimer(const InspectorInstrumentatio
 #endif
 }
 
-inline void InspectorInstrumentation::didInvalidateLayout(Frame* frame)
+inline void InspectorInstrumentation::didInvalidateLayout(Frame& frame)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didInvalidateLayoutImpl(instrumentingAgents, frame);
+        didInvalidateLayoutImpl(*instrumentingAgents, frame);
 #else
     UNUSED_PARAM(frame);
 #endif
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame& frame)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willLayoutImpl(instrumentingAgents, frame);
+        return willLayoutImpl(*instrumentingAgents, frame);
 #else
     UNUSED_PARAM(frame);
 #endif
@@ -1075,23 +1065,23 @@ inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCo
 #endif
 }
 
-inline void InspectorInstrumentation::didScroll(Page* page)
+inline void InspectorInstrumentation::didScroll(Page& page)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        didScrollImpl(instrumentingAgents);
+        didScrollImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(page);
 #endif
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest& request)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willDispatchXHRLoadEventImpl(instrumentingAgents, request, context);
+        return willDispatchXHRLoadEventImpl(*instrumentingAgents, request, context);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(request);
@@ -1115,7 +1105,7 @@ inline void InspectorInstrumentation::willPaint(RenderObject* renderer)
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer))
-        return willPaintImpl(instrumentingAgents, renderer);
+        return willPaintImpl(*instrumentingAgents, renderer);
 #else
     UNUSED_PARAM(renderer);
 #endif
@@ -1126,41 +1116,41 @@ inline void InspectorInstrumentation::didPaint(RenderObject* renderer, const Lay
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer))
-        didPaintImpl(instrumentingAgents, renderer, rect);
+        didPaintImpl(*instrumentingAgents, renderer, rect);
 #else
     UNUSED_PARAM(renderer);
     UNUSED_PARAM(rect);
 #endif
 }
 
-inline void InspectorInstrumentation::willScrollLayer(Frame* frame)
+inline void InspectorInstrumentation::willScrollLayer(Frame& frame)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        willScrollLayerImpl(instrumentingAgents, frame);
+        willScrollLayerImpl(*instrumentingAgents, frame);
 #else
     UNUSED_PARAM(frame);
 #endif
 }
 
-inline void InspectorInstrumentation::didScrollLayer(Frame* frame)
+inline void InspectorInstrumentation::didScrollLayer(Frame& frame)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didScrollLayerImpl(instrumentingAgents);
+        didScrollLayerImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(frame);
 #endif
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document* document)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willRecalculateStyle(Document& document)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        return willRecalculateStyleImpl(instrumentingAgents, document->frame());
+        return willRecalculateStyleImpl(*instrumentingAgents, document);
 #else
     UNUSED_PARAM(document);
 #endif
@@ -1178,23 +1168,23 @@ inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrum
 #endif
 }
 
-inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document* document)
+inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document& document)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didScheduleStyleRecalculationImpl(instrumentingAgents, document);
+        didScheduleStyleRecalculationImpl(*instrumentingAgents, document);
 #else
     UNUSED_PARAM(document);
 #endif
 }
 
-inline void InspectorInstrumentation::applyEmulatedMedia(Frame* frame, String* media)
+inline void InspectorInstrumentation::applyEmulatedMedia(Frame& frame, String& media)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        applyEmulatedMediaImpl(instrumentingAgents, media);
+        applyEmulatedMediaImpl(*instrumentingAgents, media);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(media);
@@ -1205,7 +1195,7 @@ inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned lon
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        willSendRequestImpl(instrumentingAgents, identifier, loader, request, redirectResponse);
+        willSendRequestImpl(*instrumentingAgents, identifier, loader, request, redirectResponse);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(identifier);
@@ -1219,7 +1209,7 @@ inline void InspectorInstrumentation::continueAfterPingLoader(Frame& frame, unsi
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
-        InspectorInstrumentation::continueAfterPingLoaderImpl(instrumentingAgents, identifier, loader, request, response);
+        InspectorInstrumentation::continueAfterPingLoaderImpl(*instrumentingAgents, identifier, loader, request, response);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(identifier);
@@ -1229,22 +1219,22 @@ inline void InspectorInstrumentation::continueAfterPingLoader(Frame& frame, unsi
 #endif
 }
 
-inline void InspectorInstrumentation::markResourceAsCached(Page* page, unsigned long identifier)
+inline void InspectorInstrumentation::markResourceAsCached(Page& page, unsigned long identifier)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        markResourceAsCachedImpl(instrumentingAgents, identifier);
+        markResourceAsCachedImpl(*instrumentingAgents, identifier);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(identifier);
 #endif
 }
 
-inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page* page, DocumentLoader* loader, CachedResource* resource)
+inline void InspectorInstrumentation::didLoadResourceFromMemoryCache(Page& page, DocumentLoader* loader, CachedResource* resource)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        didLoadResourceFromMemoryCacheImpl(instrumentingAgents, loader, resource);
+        didLoadResourceFromMemoryCacheImpl(*instrumentingAgents, loader, resource);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(loader);
@@ -1257,7 +1247,7 @@ inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResou
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willReceiveResourceDataImpl(instrumentingAgents, identifier, frame, length);
+        return willReceiveResourceDataImpl(*instrumentingAgents, frame, identifier, length);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(identifier);
@@ -1281,7 +1271,7 @@ inline InspectorInstrumentationCookie InspectorInstrumentation::willReceiveResou
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willReceiveResourceResponseImpl(instrumentingAgents, identifier, response, frame);
+        return willReceiveResourceResponseImpl(*instrumentingAgents, frame, identifier, response);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(identifier);
@@ -1305,7 +1295,7 @@ inline void InspectorInstrumentation::didReceiveResourceResponse(const Inspector
 #endif
 }
 
-inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
+inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* frame, DocumentLoader& loader, unsigned long identifier, const ResourceResponse& r)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
@@ -1318,7 +1308,7 @@ inline void InspectorInstrumentation::continueAfterXFrameOptionsDenied(Frame* fr
 #endif
 }
 
-inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
+inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, DocumentLoader& loader, unsigned long identifier, const ResourceResponse& r)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
@@ -1331,7 +1321,7 @@ inline void InspectorInstrumentation::continueWithPolicyDownload(Frame* frame, D
 #endif
 }
 
-inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
+inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, DocumentLoader& loader, unsigned long identifier, const ResourceResponse& r)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
@@ -1348,7 +1338,7 @@ inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didReceiveDataImpl(instrumentingAgents, identifier, data, dataLength, encodedDataLength);
+        didReceiveDataImpl(*instrumentingAgents, identifier, data, dataLength, encodedDataLength);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(identifier);
@@ -1362,7 +1352,7 @@ inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoa
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didFinishLoadingImpl(instrumentingAgents, identifier, loader, finishTime);
+        didFinishLoadingImpl(*instrumentingAgents, identifier, loader, finishTime);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(loader);
@@ -1375,7 +1365,7 @@ inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoade
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didFailLoadingImpl(instrumentingAgents, identifier, loader, error);
+        didFailLoadingImpl(*instrumentingAgents, identifier, loader, error);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(loader);
@@ -1384,13 +1374,13 @@ inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoade
 #endif
 }
 
-inline void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext* context, unsigned long identifier, ThreadableLoaderClient* client)
+inline void InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(Document& document, unsigned long identifier, ThreadableLoaderClient* client)
 {
 #if ENABLE(INSPECTOR)
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        documentThreadableLoaderStartedLoadingForClientImpl(instrumentingAgents, identifier, client);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
+        documentThreadableLoaderStartedLoadingForClientImpl(*instrumentingAgents, identifier, client);
 #else
-    UNUSED_PARAM(context);
+    UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
     UNUSED_PARAM(client);
 #endif
@@ -1400,7 +1390,7 @@ inline void InspectorInstrumentation::willLoadXHR(ScriptExecutionContext* contex
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        willLoadXHRImpl(instrumentingAgents, client, method, url, async, formData, headers, includeCredentials);
+        willLoadXHRImpl(*instrumentingAgents, client, method, url, async, formData, headers, includeCredentials);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(client);
@@ -1417,7 +1407,7 @@ inline void InspectorInstrumentation::didFailXHRLoading(ScriptExecutionContext*
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didFailXHRLoadingImpl(instrumentingAgents, client);
+        didFailXHRLoadingImpl(*instrumentingAgents, client);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(client);
@@ -1429,7 +1419,7 @@ inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didFinishXHRLoadingImpl(instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber, sendColumnNumber);
+        didFinishXHRLoadingImpl(*instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber, sendColumnNumber);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(client);
@@ -1446,7 +1436,7 @@ inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionConte
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didReceiveXHRResponseImpl(instrumentingAgents, identifier);
+        didReceiveXHRResponseImpl(*instrumentingAgents, identifier);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(identifier);
@@ -1457,7 +1447,7 @@ inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionCo
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        willLoadXHRSynchronouslyImpl(instrumentingAgents);
+        willLoadXHRSynchronouslyImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(context);
 #endif
@@ -1467,7 +1457,7 @@ inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionCon
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didLoadXHRSynchronouslyImpl(instrumentingAgents);
+        didLoadXHRSynchronouslyImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(context);
 #endif
@@ -1477,7 +1467,7 @@ inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* con
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        scriptImportedImpl(instrumentingAgents, identifier, sourceString);
+        scriptImportedImpl(*instrumentingAgents, identifier, sourceString);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(identifier);
@@ -1489,7 +1479,7 @@ inline void InspectorInstrumentation::scriptExecutionBlockedByCSP(ScriptExecutio
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        scriptExecutionBlockedByCSPImpl(instrumentingAgents, directiveText);
+        scriptExecutionBlockedByCSPImpl(*instrumentingAgents, directiveText);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(directiveText);
@@ -1500,18 +1490,18 @@ inline void InspectorInstrumentation::didReceiveScriptResponse(ScriptExecutionCo
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didReceiveScriptResponseImpl(instrumentingAgents, identifier);
+        didReceiveScriptResponseImpl(*instrumentingAgents, identifier);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(identifier);
 #endif
 }
 
-inline void InspectorInstrumentation::domContentLoadedEventFired(Frame* frame)
+inline void InspectorInstrumentation::domContentLoadedEventFired(Frame& frame)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        domContentLoadedEventFiredImpl(instrumentingAgents, frame);
+        domContentLoadedEventFiredImpl(*instrumentingAgents, frame);
 #else
     UNUSED_PARAM(frame);
 #endif
@@ -1521,27 +1511,27 @@ inline void InspectorInstrumentation::loadEventFired(Frame* frame)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        loadEventFiredImpl(instrumentingAgents, frame);
+        loadEventFiredImpl(*instrumentingAgents, frame);
 #else
     UNUSED_PARAM(frame);
 #endif
 }
 
-inline void InspectorInstrumentation::frameDetachedFromParent(Frame* frame)
+inline void InspectorInstrumentation::frameDetachedFromParent(Frame& frame)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        frameDetachedFromParentImpl(instrumentingAgents, frame);
+        frameDetachedFromParentImpl(*instrumentingAgents, frame);
 #else
     UNUSED_PARAM(frame);
 #endif
 }
 
-inline void InspectorInstrumentation::didCommitLoad(Frame* frame, DocumentLoader* loader)
+inline void InspectorInstrumentation::didCommitLoad(Frame& frame, DocumentLoader* loader)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didCommitLoadImpl(instrumentingAgents, frame->page(), loader);
+        didCommitLoadImpl(*instrumentingAgents, frame.page(), loader);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(loader);
@@ -1553,17 +1543,17 @@ inline void InspectorInstrumentation::frameDocumentUpdated(Frame* frame)
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        frameDocumentUpdatedImpl(instrumentingAgents, frame);
+        frameDocumentUpdatedImpl(*instrumentingAgents, frame);
 #else
     UNUSED_PARAM(frame);
 #endif
 }
 
-inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame* frame, DocumentLoader* loader)
+inline void InspectorInstrumentation::loaderDetachedFromFrame(Frame& frame, DocumentLoader& loader)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        loaderDetachedFromFrameImpl(instrumentingAgents, loader);
+        loaderDetachedFromFrameImpl(*instrumentingAgents, loader);
 #else
     UNUSED_PARAM(frame);
     UNUSED_PARAM(loader);
@@ -1611,12 +1601,12 @@ inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& fra
 #endif
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialog(Page* page, const String& message)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willRunJavaScriptDialog(Page& page, const String& message)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        return willRunJavaScriptDialogImpl(instrumentingAgents, message);
+        return willRunJavaScriptDialogImpl(*instrumentingAgents, message);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(message);
@@ -1635,7 +1625,7 @@ inline void InspectorInstrumentation::didRunJavaScriptDialog(const InspectorInst
 #endif
 }
 
-inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource* cachedResource)
+inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource& cachedResource)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
@@ -1650,7 +1640,7 @@ inline InspectorInstrumentationCookie InspectorInstrumentation::willWriteHTML(Do
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        return willWriteHTMLImpl(instrumentingAgents, startLine, document->frame());
+        return willWriteHTMLImpl(*instrumentingAgents, startLine, document->frame());
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(startLine);
@@ -1675,7 +1665,7 @@ inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& k
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        didDispatchDOMStorageEventImpl(instrumentingAgents, key, oldValue, newValue, storageType, securityOrigin, page);
+        didDispatchDOMStorageEventImpl(*instrumentingAgents, key, oldValue, newValue, storageType, securityOrigin, page);
 #else
     UNUSED_PARAM(key);
     UNUSED_PARAM(oldValue);
@@ -1691,7 +1681,7 @@ inline bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(ScriptEx
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(false);
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return shouldPauseDedicatedWorkerOnStartImpl(instrumentingAgents);
+        return shouldPauseDedicatedWorkerOnStartImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(context);
 #endif
@@ -1702,7 +1692,7 @@ inline void InspectorInstrumentation::didStartWorkerGlobalScope(ScriptExecutionC
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didStartWorkerGlobalScopeImpl(instrumentingAgents, proxy, url);
+        didStartWorkerGlobalScopeImpl(*instrumentingAgents, proxy, url);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(proxy);
@@ -1714,7 +1704,7 @@ inline void InspectorInstrumentation::workerGlobalScopeTerminated(ScriptExecutio
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        workerGlobalScopeTerminatedImpl(instrumentingAgents, proxy);
+        workerGlobalScopeTerminatedImpl(*instrumentingAgents, proxy);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(proxy);
@@ -1726,7 +1716,7 @@ inline void InspectorInstrumentation::didCreateWebSocket(Document* document, uns
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didCreateWebSocketImpl(instrumentingAgents, identifier, requestURL, documentURL, protocol, document);
+        didCreateWebSocketImpl(*instrumentingAgents, identifier, requestURL, documentURL, protocol, document);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
@@ -1740,7 +1730,7 @@ inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(Document
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        willSendWebSocketHandshakeRequestImpl(instrumentingAgents, identifier, request, document);
+        willSendWebSocketHandshakeRequestImpl(*instrumentingAgents, identifier, request, document);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
@@ -1752,7 +1742,7 @@ inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(Docum
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didReceiveWebSocketHandshakeResponseImpl(instrumentingAgents, identifier, response, document);
+        didReceiveWebSocketHandshakeResponseImpl(*instrumentingAgents, identifier, response, document);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
@@ -1764,7 +1754,7 @@ inline void InspectorInstrumentation::didCloseWebSocket(Document* document, unsi
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didCloseWebSocketImpl(instrumentingAgents, identifier, document);
+        didCloseWebSocketImpl(*instrumentingAgents, identifier, document);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
@@ -1774,7 +1764,7 @@ inline void InspectorInstrumentation::didReceiveWebSocketFrame(Document* documen
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didReceiveWebSocketFrameImpl(instrumentingAgents, identifier, frame);
+        didReceiveWebSocketFrameImpl(*instrumentingAgents, identifier, frame);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
@@ -1785,7 +1775,7 @@ inline void InspectorInstrumentation::didReceiveWebSocketFrameError(Document* do
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didReceiveWebSocketFrameErrorImpl(instrumentingAgents, identifier, errorMessage);
+        didReceiveWebSocketFrameErrorImpl(*instrumentingAgents, identifier, errorMessage);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
@@ -1796,7 +1786,7 @@ inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document,
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didSendWebSocketFrameImpl(instrumentingAgents, identifier, frame);
+        didSendWebSocketFrameImpl(*instrumentingAgents, identifier, frame);
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(identifier);
@@ -1806,151 +1796,151 @@ inline void InspectorInstrumentation::didSendWebSocketFrame(Document* document,
 #endif
 
 #if ENABLE(WEB_REPLAY)
-inline void InspectorInstrumentation::sessionCreated(Page* page, PassRefPtr<ReplaySession> session)
+inline void InspectorInstrumentation::sessionCreated(Page& page, PassRefPtr<ReplaySession> session)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        sessionCreatedImpl(instrumentingAgents, session);
+        sessionCreatedImpl(*instrumentingAgents, session);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(session);
 #endif
 }
 
-inline void InspectorInstrumentation::sessionLoaded(Page* page, PassRefPtr<ReplaySession> session)
+inline void InspectorInstrumentation::sessionLoaded(Page& page, PassRefPtr<ReplaySession> session)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        sessionLoadedImpl(instrumentingAgents, session);
+        sessionLoadedImpl(*instrumentingAgents, session);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(session);
 #endif
 }
 
-inline void InspectorInstrumentation::sessionModified(Page* page, PassRefPtr<ReplaySession> session)
+inline void InspectorInstrumentation::sessionModified(Page& page, PassRefPtr<ReplaySession> session)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        sessionModifiedImpl(instrumentingAgents, session);
+        sessionModifiedImpl(*instrumentingAgents, session);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(session);
 #endif
 }
 
-inline void InspectorInstrumentation::segmentCreated(Page* page, PassRefPtr<ReplaySessionSegment> segment)
+inline void InspectorInstrumentation::segmentCreated(Page& page, PassRefPtr<ReplaySessionSegment> segment)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        segmentCreatedImpl(instrumentingAgents, segment);
+        segmentCreatedImpl(*instrumentingAgents, segment);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(segment);
 #endif
 }
 
-inline void InspectorInstrumentation::segmentCompleted(Page* page, PassRefPtr<ReplaySessionSegment> segment)
+inline void InspectorInstrumentation::segmentCompleted(Page& page, PassRefPtr<ReplaySessionSegment> segment)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        segmentCompletedImpl(instrumentingAgents, segment);
+        segmentCompletedImpl(*instrumentingAgents, segment);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(segment);
 #endif
 }
 
-inline void InspectorInstrumentation::segmentLoaded(Page* page, PassRefPtr<ReplaySessionSegment> segment)
+inline void InspectorInstrumentation::segmentLoaded(Page& page, PassRefPtr<ReplaySessionSegment> segment)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        segmentLoadedImpl(instrumentingAgents, segment);
+        segmentLoadedImpl(*instrumentingAgents, segment);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(segment);
 #endif
 }
 
-inline void InspectorInstrumentation::segmentUnloaded(Page* page)
+inline void InspectorInstrumentation::segmentUnloaded(Page& page)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        segmentUnloadedImpl(instrumentingAgents);
+        segmentUnloadedImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(page);
 #endif
 }
 
-inline void InspectorInstrumentation::captureStarted(Page* page)
+inline void InspectorInstrumentation::captureStarted(Page& page)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        captureStartedImpl(instrumentingAgents);
+        captureStartedImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(page);
 #endif
 }
 
-inline void InspectorInstrumentation::captureStopped(Page* page)
+inline void InspectorInstrumentation::captureStopped(Page& page)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        captureStoppedImpl(instrumentingAgents);
+        captureStoppedImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(page);
 #endif
 }
 
-inline void InspectorInstrumentation::playbackStarted(Page* page)
+inline void InspectorInstrumentation::playbackStarted(Page& page)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        playbackStartedImpl(instrumentingAgents);
+        playbackStartedImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(page);
 #endif
 }
 
-inline void InspectorInstrumentation::playbackPaused(Page* page, const ReplayPosition& position)
+inline void InspectorInstrumentation::playbackPaused(Page& page, const ReplayPosition& position)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        playbackPausedImpl(instrumentingAgents, position);
+        playbackPausedImpl(*instrumentingAgents, position);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(position);
 #endif
 }
 
-inline void InspectorInstrumentation::playbackFinished(Page* page)
+inline void InspectorInstrumentation::playbackFinished(Page& page)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        playbackFinishedImpl(instrumentingAgents);
+        playbackFinishedImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(page);
 #endif
 }
 
-inline void InspectorInstrumentation::playbackHitPosition(Page* page, const ReplayPosition& position)
+inline void InspectorInstrumentation::playbackHitPosition(Page& page, const ReplayPosition& position)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        playbackHitPositionImpl(instrumentingAgents, position);
+        playbackHitPositionImpl(*instrumentingAgents, position);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(position);
@@ -1963,7 +1953,7 @@ inline void InspectorInstrumentation::networkStateChanged(Page* page)
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        networkStateChangedImpl(instrumentingAgents);
+        networkStateChangedImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(page);
 #endif
@@ -1974,7 +1964,7 @@ inline void InspectorInstrumentation::updateApplicationCacheStatus(Frame* frame)
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        updateApplicationCacheStatusImpl(instrumentingAgents, frame);
+        updateApplicationCacheStatusImpl(*instrumentingAgents, frame);
 #else
     UNUSED_PARAM(frame);
 #endif
@@ -1984,7 +1974,7 @@ inline void InspectorInstrumentation::didRequestAnimationFrame(Document* documen
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didRequestAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
+        didRequestAnimationFrameImpl(*instrumentingAgents, callbackId, document->frame());
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(callbackId);
@@ -1995,7 +1985,7 @@ inline void InspectorInstrumentation::didCancelAnimationFrame(Document* document
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        didCancelAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
+        didCancelAnimationFrameImpl(*instrumentingAgents, callbackId, document->frame());
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(callbackId);
@@ -2006,7 +1996,7 @@ inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimatio
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
-        return willFireAnimationFrameImpl(instrumentingAgents, callbackId, document->frame());
+        return willFireAnimationFrameImpl(*instrumentingAgents, callbackId, document->frame());
 #else
     UNUSED_PARAM(document);
     UNUSED_PARAM(callbackId);
@@ -2029,28 +2019,28 @@ inline void InspectorInstrumentation::layerTreeDidChange(Page* page)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        layerTreeDidChangeImpl(instrumentingAgents);
+        layerTreeDidChangeImpl(*instrumentingAgents);
 #else
     UNUSED_PARAM(page);
 #endif
 }
 
-inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const RenderLayer* renderLayer)
+inline void InspectorInstrumentation::renderLayerDestroyed(Page* page, const RenderLayer& renderLayer)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        renderLayerDestroyedImpl(instrumentingAgents, renderLayer);
+        renderLayerDestroyedImpl(*instrumentingAgents, renderLayer);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(renderLayer);
 #endif
 }
 
-inline void InspectorInstrumentation::pseudoElementDestroyed(Page* page, PseudoElement* pseudoElement)
+inline void InspectorInstrumentation::pseudoElementDestroyed(Page* page, PseudoElement& pseudoElement)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        pseudoElementDestroyedImpl(instrumentingAgents, pseudoElement);
+        pseudoElementDestroyedImpl(*instrumentingAgents, pseudoElement);
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(pseudoElement);
@@ -2069,22 +2059,27 @@ inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForCont
 
 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame* frame)
 {
-    if (frame)
-        return instrumentingAgentsForPage(frame->page());
-    return nullptr;
+    return frame ? instrumentingAgentsForFrame(*frame) : nullptr;
+}
+
+inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(Frame& frame)
+{
+    return instrumentingAgentsForPage(frame.page());
 }
 
 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document* document)
 {
-    if (document) {
-        Page* page = document->page();
+    return document ? instrumentingAgentsForDocument(*document) : nullptr;
+}
+
+inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForDocument(Document& document)
+{
+    Page* page = document.page();
 #if ENABLE(TEMPLATE_ELEMENT)
-        if (!page && document->templateDocumentHost())
-            page = document->templateDocumentHost()->page();
+    if (!page && document.templateDocumentHost())
+        page = document.templateDocumentHost()->page();
 #endif
-        return instrumentingAgentsForPage(page);
-    }
-    return nullptr;
+    return instrumentingAgentsForPage(page);
 }
 #endif
 
index 7f00deb..261f39b 100644 (file)
 namespace WebCore {
 
 InspectorInstrumentationCookie::InspectorInstrumentationCookie()
-    : m_instrumentingAgents(nullptr)
-    , m_timelineAgentId(0)
+    : m_timelineAgentId(0)
 {
 }
 
-InspectorInstrumentationCookie::InspectorInstrumentationCookie(InstrumentingAgents* agents, int timelineAgentId)
-    : m_instrumentingAgents(agents)
+InspectorInstrumentationCookie::InspectorInstrumentationCookie(InstrumentingAgents& agents, int timelineAgentId)
+    : m_instrumentingAgents(&agents)
     , m_timelineAgentId(timelineAgentId)
 {
 }
index 6db514f..d154995 100644 (file)
 
 #include <wtf/RefPtr.h>
 
+#if ENABLE(INSPECTOR)
+
 namespace WebCore {
 
 class InspectorInstrumentation;
 class InstrumentingAgents;
 
 class InspectorInstrumentationCookie {
-#if ENABLE(INSPECTOR)
 public:
     InspectorInstrumentationCookie();
-    InspectorInstrumentationCookie(InstrumentingAgents*, int);
+    InspectorInstrumentationCookie(InstrumentingAgents&, int);
     InspectorInstrumentationCookie(const InspectorInstrumentationCookie&);
     InspectorInstrumentationCookie& operator=(const InspectorInstrumentationCookie&);
     ~InspectorInstrumentationCookie();
@@ -54,9 +55,10 @@ public:
 private:
     RefPtr<InstrumentingAgents> m_instrumentingAgents;
     int m_timelineAgentId;
-#endif
 };
 
 } // namespace WebCore
 
+#endif // ENABLE(INSPECTOR)
+
 #endif // InspectorInstrumentationCookie_h
index f4e8df0..ea828ec 100644 (file)
@@ -99,17 +99,6 @@ void InstrumentingAgents::reset()
     m_inspectorWorkerAgent = nullptr;
 }
 
-InstrumentingAgents* instrumentationForPage(Page* page)
-{
-    ASSERT(isMainThread());
-    return page ? page->inspectorController().m_instrumentingAgents.get() : nullptr;
-}
-
-InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope* workerGlobalScope)
-{
-    return workerGlobalScope ? workerGlobalScope->workerInspectorController().m_instrumentingAgents.get() : nullptr;
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
index 657cd96..47225e0 100644 (file)
@@ -168,9 +168,6 @@ private:
     InspectorWorkerAgent* m_inspectorWorkerAgent;
 };
 
-WEBCORE_EXPORT InstrumentingAgents* instrumentationForPage(Page*);
-InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope*);
-
 }
 
 #endif // !defined(InstrumentingAgents_h)
index 15babca..d499a19 100644 (file)
@@ -77,7 +77,7 @@ public:
     virtual PassRefPtr<WTF::Stopwatch> executionStopwatch() override;
 
 private:
-    friend InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope*);
+    friend class InspectorInstrumentation;
 
     WorkerGlobalScope& m_workerGlobalScope;
     RefPtr<InstrumentingAgents> m_instrumentingAgents;
index 2458b3a..1bbc36b 100644 (file)
@@ -612,7 +612,7 @@ void DocumentLoader::responseReceived(CachedResource* resource, const ResourceRe
         unsigned long identifier = m_identifierForLoadWithoutResourceLoader ? m_identifierForLoadWithoutResourceLoader : m_mainResource->identifier();
         ASSERT(identifier);
         if (frameLoader()->shouldInterruptLoadForXFrameOptions(content, response.url(), identifier)) {
-            InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, identifier, response);
+            InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, *this, identifier, response);
             String message = "Refused to display '" + response.url().stringCenterEllipsizedToLength() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'.";
             frame()->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, message, identifier);
             frame()->document()->enforceSandboxFlags(SandboxOrigin);
@@ -709,7 +709,7 @@ void DocumentLoader::continueAfterContentPolicy(PolicyAction policy)
         }
 
         if (ResourceLoader* mainResourceLoader = this->mainResourceLoader())
-            InspectorInstrumentation::continueWithPolicyDownload(m_frame, this, mainResourceLoader->identifier(), m_response);
+            InspectorInstrumentation::continueWithPolicyDownload(m_frame, *this, mainResourceLoader->identifier(), m_response);
 
         // When starting the request, we didn't know that it would result in download and not navigation. Now we know that main document URL didn't change.
         // Download may use this knowledge for purposes unrelated to cookies, notably for setting file quarantine data.
@@ -723,7 +723,7 @@ void DocumentLoader::continueAfterContentPolicy(PolicyAction policy)
     }
     case PolicyIgnore:
         if (ResourceLoader* mainResourceLoader = this->mainResourceLoader())
-            InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, mainResourceLoader->identifier(), m_response);
+            InspectorInstrumentation::continueWithPolicyIgnore(m_frame, *this, mainResourceLoader->identifier(), m_response);
         stopLoadingForPolicyChange();
         return;
     
@@ -948,7 +948,7 @@ void DocumentLoader::detachFromFrame()
         m_mainResource->removeClient(this);
 
     m_applicationCacheHost->setDOMApplicationCache(0);
-    InspectorInstrumentation::loaderDetachedFromFrame(m_frame, this);
+    InspectorInstrumentation::loaderDetachedFromFrame(*m_frame, *this);
     m_frame = 0;
 }
 
index 0006479..668f010 100644 (file)
@@ -286,11 +286,7 @@ void DocumentThreadableLoader::didReceiveData(unsigned long identifier, const ch
 
     // Preflight data should be invisible to clients.
     if (m_actualRequest) {
-#if ENABLE(INSPECTOR)
         InspectorInstrumentation::didReceiveData(m_document.frame(), identifier, 0, 0, dataLength);
-#else
-        UNUSED_PARAM(identifier);
-#endif
         return;
     }
 
@@ -311,9 +307,8 @@ void DocumentThreadableLoader::notifyFinished(CachedResource* resource)
 void DocumentThreadableLoader::didFinishLoading(unsigned long identifier, double finishTime)
 {
     if (m_actualRequest) {
-#if ENABLE(INSPECTOR)
         InspectorInstrumentation::didFinishLoading(m_document.frame(), m_document.frame()->loader().documentLoader(), identifier, finishTime);
-#endif
+
         ASSERT(!m_sameOriginRequest);
         ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl);
         preflightSuccess();
@@ -323,12 +318,8 @@ void DocumentThreadableLoader::didFinishLoading(unsigned long identifier, double
 
 void DocumentThreadableLoader::didFail(unsigned long identifier, const ResourceError& error)
 {
-#if ENABLE(INSPECTOR)
     if (m_actualRequest)
         InspectorInstrumentation::didFailLoading(m_document.frame(), m_document.frame()->loader().documentLoader(), identifier, error);
-#else
-    UNUSED_PARAM(identifier);
-#endif
 
     m_client->didFail(error);
 }
@@ -349,12 +340,9 @@ void DocumentThreadableLoader::preflightSuccess()
 void DocumentThreadableLoader::preflightFailure(unsigned long identifier, const String& url, const String& errorDescription)
 {
     ResourceError error(errorDomainWebKitInternal, 0, url, errorDescription);
-#if ENABLE(INSPECTOR)
     if (m_actualRequest)
         InspectorInstrumentation::didFailLoading(m_document.frame(), m_document.frame()->loader().documentLoader(), identifier, error);
-#else
-    UNUSED_PARAM(identifier);
-#endif
+
     m_actualRequest = nullptr; // Prevent didFinishLoading() from bypassing access check.
     m_client->didFailAccessControlCheck(error);
 }
@@ -388,7 +376,7 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Secur
 #if ENABLE(INSPECTOR)
             if (m_resource->loader()) {
                 unsigned long identifier = m_resource->loader()->identifier();
-                InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m_document, identifier, m_client);
+                InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(m_document, identifier, m_client);
             }
 #endif
             m_resource->addClient(this);
@@ -404,7 +392,7 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Secur
     if (m_document.frame())
         identifier = m_document.frame()->loader().loadResourceSynchronously(request, m_options.allowCredentials(), m_options.clientCredentialPolicy(), error, response, data);
 
-    InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m_document, identifier, m_client);
+    InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(m_document, identifier, m_client);
 
     if (!error.isNull() && response.httpStatusCode() <= 0) {
         if (requestURL.isLocalFile()) {
index b7545ef..66b0c34 100644 (file)
@@ -2501,7 +2501,7 @@ void FrameLoader::detachFromParent()
     // handlers might start a new subresource load in this frame.
     stopAllLoaders();
 
-    InspectorInstrumentation::frameDetachedFromParent(&m_frame);
+    InspectorInstrumentation::frameDetachedFromParent(m_frame);
 
     detachViewsAndDocumentLoader();
 
@@ -3035,14 +3035,14 @@ void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource, Resour
         return;
 
     if (!page->areMemoryCacheClientCallsEnabled()) {
-        InspectorInstrumentation::didLoadResourceFromMemoryCache(page, m_documentLoader.get(), resource);
+        InspectorInstrumentation::didLoadResourceFromMemoryCache(*page, m_documentLoader.get(), resource);
         m_documentLoader->recordMemoryCacheLoadForFutureClientNotification(resource->resourceRequest());
         m_documentLoader->didTellClientAboutLoad(resource->url());
         return;
     }
 
     if (m_client.dispatchDidLoadResourceFromMemoryCache(m_documentLoader.get(), newRequest, resource->response(), resource->encodedSize())) {
-        InspectorInstrumentation::didLoadResourceFromMemoryCache(page, m_documentLoader.get(), resource);
+        InspectorInstrumentation::didLoadResourceFromMemoryCache(*page, m_documentLoader.get(), resource);
         m_documentLoader->didTellClientAboutLoad(resource->url());
         return;
     }
@@ -3050,7 +3050,7 @@ void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource, Resour
     unsigned long identifier;
     ResourceError error;
     requestFromDelegate(newRequest, identifier, error);
-    InspectorInstrumentation::markResourceAsCached(page, identifier);
+    InspectorInstrumentation::markResourceAsCached(*page, identifier);
     notifier().sendRemainingDelegateMessages(m_documentLoader.get(), identifier, newRequest, resource->response(), 0, resource->encodedSize(), 0, error);
 }
 
@@ -3325,10 +3325,10 @@ void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld& world)
 
 #if ENABLE(INSPECTOR)
     if (Page* page = m_frame.page())
-        page->inspectorController().didClearWindowObjectInWorld(&m_frame, world);
+        page->inspectorController().didClearWindowObjectInWorld(m_frame, world);
 #endif
 
-    InspectorInstrumentation::didClearWindowObjectInWorld(&m_frame, world);
+    InspectorInstrumentation::didClearWindowObjectInWorld(m_frame, world);
 }
 
 void FrameLoader::dispatchGlobalObjectAvailableInAllWorlds()
@@ -3385,7 +3385,7 @@ void FrameLoader::dispatchDidCommitLoad()
         m_frame.page()->resetSeenMediaEngines();
     }
 
-    InspectorInstrumentation::didCommitLoad(&m_frame, m_documentLoader.get());
+    InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get());
 
 #if ENABLE(REMOTE_INSPECTOR)
     if (m_frame.isMainFrame())
index d2233d0..c4dd620 100644 (file)
@@ -200,7 +200,7 @@ void ResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader)
 
 void ResourceLoadScheduler::notifyDidScheduleResourceRequest(ResourceLoader* loader)
 {
-    InspectorInstrumentation::didScheduleResourceRequest(loader->frameLoader() ? loader->frameLoader()->frame().document() : 0, loader->url());
+    InspectorInstrumentation::didScheduleResourceRequest(loader->frameLoader() ? loader->frameLoader()->frame().document() : nullptr, loader->url());
 }
 
 #if USE(QUICK_LOOK)
index 3e4d6e3..61ffb65 100644 (file)
@@ -272,10 +272,8 @@ void ResourceLoader::willSendRequest(ResourceRequest& request, const ResourceRes
 
         frameLoader()->notifier().willSendRequest(this, request, redirectResponse);
     }
-#if ENABLE(INSPECTOR)
     else
         InspectorInstrumentation::willSendRequest(m_frame.get(), m_identifier, m_frame->loader().documentLoader(), request, redirectResponse);
-#endif
 
     if (!redirectResponse.isNull())
         platformStrategies()->loaderStrategy()->resourceLoadScheduler()->crossOriginRedirectReceived(this, request.url());
index e954a33..c797109 100644 (file)
@@ -502,7 +502,7 @@ PassRefPtr<ResourceHandle> ApplicationCacheGroup::createResourceHandle(const URL
 void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const ResourceResponse& response)
 {
 #if ENABLE(INSPECTOR)
-    DocumentLoader* loader = (handle == m_manifestHandle) ? 0 : m_frame->loader().documentLoader();
+    DocumentLoader* loader = (handle == m_manifestHandle) ? nullptr : m_frame->loader().documentLoader();
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_frame, m_currentResourceIdentifier, response);
     InspectorInstrumentation::didReceiveResourceResponse(cookie, m_currentResourceIdentifier, loader, response, 0);
 #endif
@@ -577,9 +577,7 @@ void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* d
 {
     UNUSED_PARAM(encodedDataLength);
 
-#if ENABLE(INSPECTOR)
     InspectorInstrumentation::didReceiveData(m_frame, m_currentResourceIdentifier, 0, length, 0);
-#endif
 
     if (handle == m_manifestHandle) {
         didReceiveManifestData(data, length);
@@ -594,11 +592,7 @@ void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* d
 
 void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle, double finishTime)
 {
-#if ENABLE(INSPECTOR)
     InspectorInstrumentation::didFinishLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, finishTime);
-#else
-    UNUSED_PARAM(finishTime);
-#endif
 
     if (handle == m_manifestHandle) {
         didFinishLoadingManifest();
@@ -633,11 +627,7 @@ void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle, double fini
 
 void ApplicationCacheGroup::didFail(ResourceHandle* handle, const ResourceError& error)
 {
-#if ENABLE(INSPECTOR)
     InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, error);
-#else
-    UNUSED_PARAM(error);
-#endif
 
     if (handle == m_manifestHandle) {
         // A network error is logged elsewhere, no need to log again. Also, it's normal for manifest fetching to fail when working offline.
index 8e737a8..6625570 100644 (file)
@@ -483,7 +483,7 @@ void CachedResource::decodedDataDeletionTimerFired()
 bool CachedResource::deleteIfPossible()
 {
     if (canDelete() && !inCache()) {
-        InspectorInstrumentation::willDestroyCachedResource(this);
+        InspectorInstrumentation::willDestroyCachedResource(*this);
         delete this;
         return true;
     }
index 237fdbb..68bf668 100644 (file)
@@ -95,7 +95,7 @@ void Chrome::invalidateContentsForSlowScroll(const IntRect& updateRect)
 void Chrome::scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
 {
     m_client.scroll(scrollDelta, rectToScroll, clipRect);
-    InspectorInstrumentation::didScroll(&m_page);
+    InspectorInstrumentation::didScroll(m_page);
 }
 
 #if USE(TILED_BACKING_STORE)
@@ -297,7 +297,7 @@ bool Chrome::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
     // otherwise cause the load to continue while we're in the middle of executing JavaScript.
     PageGroupLoadDeferrer deferrer(m_page, true);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(&m_page, message);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, message);
     bool ok = m_client.runBeforeUnloadConfirmPanel(message, frame);
     InspectorInstrumentation::didRunJavaScriptDialog(cookie);
     return ok;
@@ -321,7 +321,7 @@ void Chrome::runJavaScriptAlert(Frame* frame, const String& message)
     notifyPopupOpeningObservers();
     String displayMessage = frame->displayStringModifiedByEncoding(message);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(&m_page, displayMessage);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, displayMessage);
     m_client.runJavaScriptAlert(frame, displayMessage);
     InspectorInstrumentation::didRunJavaScriptDialog(cookie);
 }
@@ -339,7 +339,7 @@ bool Chrome::runJavaScriptConfirm(Frame* frame, const String& message)
     notifyPopupOpeningObservers();
     String displayMessage = frame->displayStringModifiedByEncoding(message);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(&m_page, displayMessage);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, displayMessage);
     bool ok = m_client.runJavaScriptConfirm(frame, displayMessage);
     InspectorInstrumentation::didRunJavaScriptDialog(cookie);
     return ok;
@@ -358,7 +358,7 @@ bool Chrome::runJavaScriptPrompt(Frame* frame, const String& prompt, const Strin
     notifyPopupOpeningObservers();
     String displayPrompt = frame->displayStringModifiedByEncoding(prompt);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(&m_page, displayPrompt);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, displayPrompt);
     bool ok = m_client.runJavaScriptPrompt(frame, displayPrompt, frame->displayStringModifiedByEncoding(defaultValue), result);
     InspectorInstrumentation::didRunJavaScriptDialog(cookie);
 
@@ -394,7 +394,7 @@ void Chrome::mouseDidMoveOverElement(const HitTestResult& result, unsigned modif
         prefetchDNS(result.absoluteLinkURL().host());
     m_client.mouseDidMoveOverElement(result, modifierFlags);
 
-    InspectorInstrumentation::mouseDidMoveOverElement(&m_page, result, modifierFlags);
+    InspectorInstrumentation::mouseDidMoveOverElement(m_page, result, modifierFlags);
 }
 
 void Chrome::setToolTip(const HitTestResult& result)
index 5cda924..7970880 100644 (file)
@@ -1860,7 +1860,7 @@ void DOMWindow::dispatchLoadEvent()
     // For load events, send a separate load event to the enclosing frame only.
     // This is a DOM extension and is independent of bubbling/capturing rules of
     // the DOM.
-    Element* ownerElement = m_frame ? m_frame->ownerElement() : 0;
+    Element* ownerElement = m_frame ? m_frame->ownerElement() : nullptr;
     if (ownerElement)
         ownerElement->dispatchEvent(Event::create(eventNames().loadEvent, false, false));
 
@@ -1892,7 +1892,7 @@ bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget
     event->setCurrentTarget(this);
     event->setEventPhase(Event::AT_TARGET);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEventOnWindow(frame(), *event, this);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEventOnWindow(frame(), *event, *this);
 
     bool result = fireEventListeners(event.get());
 
index 04aff93..866d755 100644 (file)
@@ -1636,7 +1636,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& platformMouse
 {
     RefPtr<FrameView> protector(m_frame.view());
 
-    if (InspectorInstrumentation::handleMousePress(m_frame.page())) {
+    if (InspectorInstrumentation::handleMousePress(m_frame)) {
         invalidateClick();
         return true;
     }
@@ -3865,7 +3865,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
             Node* node = result.innerElement();
             ASSERT(node);
 
-            if (InspectorInstrumentation::handleTouchEvent(m_frame.page(), node))
+            if (node && InspectorInstrumentation::handleTouchEvent(m_frame, *node))
                 return true;
 
             Document& doc = node->document();
index d96657e..d4262c8 100644 (file)
@@ -1152,7 +1152,7 @@ void FrameView::layout(bool allowSubtree)
     if (isPainting())
         return;
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(&frame());
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(frame());
     AnimationUpdateBlock animationUpdateBlock(&frame().animation());
     
     if (!allowSubtree && m_layoutRoot) {
@@ -1186,7 +1186,7 @@ void FrameView::layout(bool allowSubtree)
         if (!styleResolver || styleResolver->hasMediaQueriesAffectedByViewportChange()) {
             document.styleResolverChanged(DeferRecalcStyle);
             // FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
-            InspectorInstrumentation::mediaQueryResultChanged(&document);
+            InspectorInstrumentation::mediaQueryResultChanged(document);
         } else
             document.evaluateMediaQueryList();
 
@@ -1454,7 +1454,7 @@ String FrameView::mediaType() const
 {
     // See if we have an override type.
     String overrideType = frame().loader().client().overrideMediaType();
-    InspectorInstrumentation::applyEmulatedMedia(&frame(), &overrideType);
+    InspectorInstrumentation::applyEmulatedMedia(frame(), overrideType);
     if (!overrideType.isNull())
         return overrideType;
     return m_mediaType;
@@ -2446,7 +2446,7 @@ void FrameView::scheduleRelayout()
         return;
     if (!frame().document()->shouldScheduleLayout())
         return;
-    InspectorInstrumentation::didInvalidateLayout(&frame());
+    InspectorInstrumentation::didInvalidateLayout(frame());
     // When frame flattening is enabled, the contents of the frame could affect the layout of the parent frames.
     // Also invalidate parent frame starting from the owner element of this frame.
     if (frame().ownerRenderer() && isInChildFrameWithFrameFlattening())
@@ -2495,7 +2495,7 @@ void FrameView::scheduleRelayoutOfSubtree(RenderElement& newRelayoutRoot)
         std::chrono::milliseconds delay = renderView.document().minimumLayoutDelay();
         ASSERT(!newRelayoutRoot.container() || !newRelayoutRoot.container()->needsLayout());
         m_layoutRoot = &newRelayoutRoot;
-        InspectorInstrumentation::didInvalidateLayout(&frame());
+        InspectorInstrumentation::didInvalidateLayout(frame());
         m_delayedLayout = delay.count();
         m_layoutTimer.startOneShot(delay);
         return;
@@ -2507,7 +2507,7 @@ void FrameView::scheduleRelayoutOfSubtree(RenderElement& newRelayoutRoot)
     if (!m_layoutRoot) {
         // Just relayout the subtree.
         newRelayoutRoot.markContainingBlocksForLayout(false);
-        InspectorInstrumentation::didInvalidateLayout(&frame());
+        InspectorInstrumentation::didInvalidateLayout(frame());
         return;
     }
 
@@ -2523,7 +2523,7 @@ void FrameView::scheduleRelayoutOfSubtree(RenderElement& newRelayoutRoot)
         m_layoutRoot->markContainingBlocksForLayout(false, &newRelayoutRoot);
         m_layoutRoot = &newRelayoutRoot;
         ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
-        InspectorInstrumentation::didInvalidateLayout(&frame());
+        InspectorInstrumentation::didInvalidateLayout(frame());
         return;
     }
 
@@ -2531,7 +2531,7 @@ void FrameView::scheduleRelayoutOfSubtree(RenderElement& newRelayoutRoot)
     m_layoutRoot->markContainingBlocksForLayout(false);
     m_layoutRoot = 0;
     newRelayoutRoot.markContainingBlocksForLayout(false);
-    InspectorInstrumentation::didInvalidateLayout(&frame());
+    InspectorInstrumentation::didInvalidateLayout(frame());
 }
 
 bool FrameView::layoutPending() const
index 61cb58b..cecaf1f 100644 (file)
@@ -117,9 +117,9 @@ void PageConsoleClient::addMessage(MessageSource source, MessageLevel level, con
         return;
 
     if (callStack)
-        InspectorInstrumentation::addMessageToConsole(&m_page, source, MessageType::Log, level, message, callStack, requestIdentifier);
+        InspectorInstrumentation::addMessageToConsole(m_page, source, MessageType::Log, level, message, callStack, requestIdentifier);
     else
-        InspectorInstrumentation::addMessageToConsole(&m_page, source, MessageType::Log, level, message, url, lineNumber, columnNumber, state, requestIdentifier);
+        InspectorInstrumentation::addMessageToConsole(m_page, source, MessageType::Log, level, message, url, lineNumber, columnNumber, state, requestIdentifier);
 
     if (source == MessageSource::CSS)
         return;
@@ -142,7 +142,7 @@ void PageConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel l
 
     String message;
     bool gotMessage = arguments->getFirstArgumentAsString(message);
-    InspectorInstrumentation::addMessageToConsole(&m_page, MessageSource::ConsoleAPI, type, level, message, exec, arguments);
+    InspectorInstrumentation::addMessageToConsole(m_page, MessageSource::ConsoleAPI, type, level, message, exec, arguments);
 
     if (m_page.usesEphemeralSession())
         return;
@@ -160,34 +160,34 @@ void PageConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel l
 
 void PageConsoleClient::count(JSC::ExecState* exec, PassRefPtr<ScriptArguments> arguments)
 {
-    InspectorInstrumentation::consoleCount(&m_page, exec, arguments);
+    InspectorInstrumentation::consoleCount(m_page, exec, arguments);
 }
 
 void PageConsoleClient::profile(JSC::ExecState* exec, const String& title)
 {
-    InspectorInstrumentation::startProfiling(&m_page, exec, title);
+    InspectorInstrumentation::startProfiling(m_page, exec, title);
 }
 
 void PageConsoleClient::profileEnd(JSC::ExecState* exec, const String& title)
 {
-    if (RefPtr<JSC::Profile> profile = InspectorInstrumentation::stopProfiling(&m_page, exec, title))
+    if (RefPtr<JSC::Profile> profile = InspectorInstrumentation::stopProfiling(m_page, exec, title))
         m_profiles.append(profile.release());
 }
 
 void PageConsoleClient::time(JSC::ExecState*, const String& title)
 {
-    InspectorInstrumentation::startConsoleTiming(&m_page.mainFrame(), title);
+    InspectorInstrumentation::startConsoleTiming(m_page.mainFrame(), title);
 }
 
 void PageConsoleClient::timeEnd(JSC::ExecState* exec, const String& title)
 {
     RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, 1));
-    InspectorInstrumentation::stopConsoleTiming(&m_page.mainFrame(), title, callStack.release());
+    InspectorInstrumentation::stopConsoleTiming(m_page.mainFrame(), title, callStack.release());
 }
 
 void PageConsoleClient::timeStamp(JSC::ExecState*, PassRefPtr<ScriptArguments> arguments)
 {
-    InspectorInstrumentation::consoleTimeStamp(&m_page.mainFrame(), arguments);
+    InspectorInstrumentation::consoleTimeStamp(m_page.mainFrame(), arguments);
 }
 
 void PageConsoleClient::clearProfiles()
index 47bca70..a90af37 100644 (file)
@@ -414,7 +414,7 @@ void Settings::setScriptEnabled(bool isScriptEnabled)
 #if PLATFORM(IOS)
     m_page->setNeedsRecalcStyleInAllFrames();
 #endif
-    InspectorInstrumentation::scriptsEnabled(m_page, m_isScriptEnabled);
+    InspectorInstrumentation::scriptsEnabled(*m_page, m_isScriptEnabled);
 }
 
 void Settings::setJavaEnabled(bool isJavaEnabled)
index 9025574..5497eb8 100644 (file)
@@ -2255,7 +2255,7 @@ void RenderLayer::scrollTo(int x, int y)
     IntPoint oldPosition = IntPoint(m_scrollOffset);
     m_scrollOffset = newScrollOffset;
 
-    InspectorInstrumentation::willScrollLayer(&renderer().frame());
+    InspectorInstrumentation::willScrollLayer(renderer().frame());
 
     RenderView& view = renderer().view();
 
@@ -2308,7 +2308,7 @@ void RenderLayer::scrollTo(int x, int y)
         element->document().sendWillRevealEdgeEventsIfNeeded(oldPosition, IntPoint(newScrollOffset), visibleContentRect(), contentsSize(), element);
     }
 
-    InspectorInstrumentation::didScrollLayer(&frame);
+    InspectorInstrumentation::didScrollLayer(frame);
     if (scrollsOverflow())
         view.frameView().didChangeScrollOffset();
 
index f33ef38..e91c68c 100644 (file)
@@ -804,7 +804,7 @@ void RenderLayerCompositor::appendDocumentOverlayLayers(Vector<GraphicsLayer*>&
 void RenderLayerCompositor::layerBecameNonComposited(const RenderLayer& layer)
 {
     // Inform the inspector that the given RenderLayer was destroyed.
-    InspectorInstrumentation::renderLayerDestroyed(page(), &layer);
+    InspectorInstrumentation::renderLayerDestroyed(page(), layer);
 
     ASSERT(m_compositedLayerCount > 0);
     --m_compositedLayerCount;
index 9782278..439700a 100644 (file)
@@ -506,13 +506,13 @@ void RenderNamedFlowThread::registerNamedFlowContentElement(Element& contentElem
         unsigned short position = contentElement.compareDocumentPosition(element);
         if (position & Node::DOCUMENT_POSITION_FOLLOWING) {
             m_contentElements.insertBefore(element, &contentElement);
-            InspectorInstrumentation::didRegisterNamedFlowContentElement(&document(), &namedFlow(), &contentElement, element);
+            InspectorInstrumentation::didRegisterNamedFlowContentElement(document(), namedFlow(), contentElement, element);
             return;
         }
     }
 
     m_contentElements.add(&contentElement);
-    InspectorInstrumentation::didRegisterNamedFlowContentElement(&document(), &namedFlow(), &contentElement);
+    InspectorInstrumentation::didRegisterNamedFlowContentElement(document(), namedFlow(), contentElement);
 }
 
 void RenderNamedFlowThread::unregisterNamedFlowContentElement(Element& contentElement)
@@ -527,7 +527,7 @@ void RenderNamedFlowThread::unregisterNamedFlowContentElement(Element& contentEl
     if (canBeDestroyed())
         setMarkForDestruction();
 
-    InspectorInstrumentation::didUnregisterNamedFlowContentElement(&document(), &namedFlow(), &contentElement);
+    InspectorInstrumentation::didUnregisterNamedFlowContentElement(document(), namedFlow(), contentElement);
 }
 
 bool RenderNamedFlowThread::hasContentElement(Element& contentElement) const
@@ -560,7 +560,7 @@ void RenderNamedFlowThread::dispatchRegionOversetChangeEventIfNeeded()
         return;
 
     m_dispatchRegionOversetChangeEvent = false;
-    InspectorInstrumentation::didChangeRegionOverset(&document(), &namedFlow());
+    InspectorInstrumentation::didChangeRegionOverset(document(), namedFlow());
     
     if (!m_regionOversetChangeEventTimer.isActive() && namedFlow().hasEventListeners())
         m_regionOversetChangeEventTimer.startOneShot(0);
index 96b1f14..ac75286 100644 (file)
@@ -207,7 +207,7 @@ void ReplayController::switchSession(PassRefPtr<ReplaySession> session)
     m_currentPosition = ReplayPosition(0, 0);
 
     LOG(WebReplay, "%-20sSwitching sessions from %p to %p.\n", "ReplayController", m_loadedSession.get(), session.get());
-    InspectorInstrumentation::sessionLoaded(&m_page, m_loadedSession);
+    InspectorInstrumentation::sessionLoaded(m_page, m_loadedSession);
 }
 
 void ReplayController::createSegment()
@@ -223,7 +223,7 @@ void ReplayController::createSegment()
     m_loadedSegment = ReplaySessionSegment::create();
 
     LOG(WebReplay, "%-20s Created segment: %p.\n", "ReplayController", m_loadedSegment.get());
-    InspectorInstrumentation::segmentCreated(&m_page, m_loadedSegment);
+    InspectorInstrumentation::segmentCreated(m_page, m_loadedSegment);
 
     m_activeCursor = CapturingInputCursor::create(m_loadedSegment);
     m_activeCursor->appendInput<BeginSegmentSentinel>();
@@ -247,10 +247,10 @@ void ReplayController::completeSegment()
     unloadSegment(shouldSuppressNotifications);
 
     LOG(WebReplay, "%-20s Completed segment: %p.\n", "ReplayController", segment.get());
-    InspectorInstrumentation::segmentCompleted(&m_page, segment);
+    InspectorInstrumentation::segmentCompleted(m_page, segment);
 
     m_loadedSession->appendSegment(segment);
-    InspectorInstrumentation::sessionModified(&m_page, m_loadedSession);
+    InspectorInstrumentation::sessionModified(m_page, m_loadedSession);
 }
 
 void ReplayController::loadSegmentAtIndex(size_t segmentIndex)
@@ -272,7 +272,7 @@ void ReplayController::loadSegmentAtIndex(size_t segmentIndex)
     m_activeCursor = ReplayingInputCursor::create(m_loadedSegment, m_page, this);
 
     LOG(WebReplay, "%-20sLoading segment: %p.\n", "ReplayController", segment.get());
-    InspectorInstrumentation::segmentLoaded(&m_page, segment);
+    InspectorInstrumentation::segmentLoaded(m_page, segment);
 }
 
 void ReplayController::unloadSegment(bool suppressNotifications)
@@ -295,7 +295,7 @@ void ReplayController::unloadSegment(bool suppressNotifications)
     // didn't send out the corresponding segmentLoaded event at the start of capture.
     if (!suppressNotifications) {
         LOG(WebReplay, "%-20sUnloading segment: %p.\n", "ReplayController", unloadedSegment.get());
-        InspectorInstrumentation::segmentUnloaded(&m_page);
+        InspectorInstrumentation::segmentUnloaded(m_page);
     }
 }
 
@@ -308,7 +308,7 @@ void ReplayController::startCapturing()
     setForceDeterministicSettings(true);
 
     LOG(WebReplay, "%-20s Starting capture.\n", "ReplayController");
-    InspectorInstrumentation::captureStarted(&m_page);
+    InspectorInstrumentation::captureStarted(m_page);
 
     m_currentPosition = ReplayPosition(0, 0);
 
@@ -326,7 +326,7 @@ void ReplayController::stopCapturing()
     setForceDeterministicSettings(false);
 
     LOG(WebReplay, "%-20s Stopping capture.\n", "ReplayController");
-    InspectorInstrumentation::captureStopped(&m_page);
+    InspectorInstrumentation::captureStopped(m_page);
 }
 
 void ReplayController::startPlayback()
@@ -337,7 +337,7 @@ void ReplayController::startPlayback()
     setSegmentState(SegmentState::Dispatching);
 
     LOG(WebReplay, "%-20s Starting playback to position (segment: %d, input: %d).\n", "ReplayController", m_targetPosition.segmentOffset, m_targetPosition.inputOffset);
-    InspectorInstrumentation::playbackStarted(&m_page);
+    InspectorInstrumentation::playbackStarted(m_page);
 
     dispatcher().setDispatchSpeed(m_dispatchSpeed);
     dispatcher().run();
@@ -354,7 +354,7 @@ void ReplayController::pausePlayback()
     setSegmentState(SegmentState::Loaded);
 
     LOG(WebReplay, "%-20s Pausing playback at position (segment: %d, input: %d).\n", "ReplayController", m_currentPosition.segmentOffset, m_currentPosition.inputOffset);
-    InspectorInstrumentation::playbackPaused(&m_page, m_currentPosition);
+    InspectorInstrumentation::playbackPaused(m_page, m_currentPosition);
 }
 
 void ReplayController::cancelPlayback()
@@ -372,7 +372,7 @@ void ReplayController::cancelPlayback()
     unloadSegment();
     m_sessionState = SessionState::Inactive;
     setForceDeterministicSettings(false);
-    InspectorInstrumentation::playbackFinished(&m_page);
+    InspectorInstrumentation::playbackFinished(m_page);
 }
 
 void ReplayController::replayToPosition(const ReplayPosition& position, DispatchSpeed speed)
@@ -511,7 +511,7 @@ void ReplayController::willDispatchInput(const EventLoopInputBase&)
 
     m_currentPosition.inputOffset++;
 
-    InspectorInstrumentation::playbackHitPosition(&m_page, m_currentPosition);
+    InspectorInstrumentation::playbackHitPosition(m_page, m_currentPosition);
 
     if (m_currentPosition == m_targetPosition)
         pausePlayback();
index c73d658..9a0553d 100644 (file)
@@ -1480,7 +1480,7 @@ Vector<String> Internals::consoleMessageArgumentCounts() const
     if (!document || !document->page())
         return Vector<String>();
 
-    InstrumentingAgents* instrumentingAgents = instrumentationForPage(document->page());
+    InstrumentingAgents* instrumentingAgents = InspectorInstrumentation::instrumentingAgentsForPage(document->page());
     if (!instrumentingAgents)
         return Vector<String>();
 
index b540a13..46e18fd 100644 (file)
@@ -372,14 +372,14 @@ void XMLHttpRequest::callReadyStateChangeListener()
     if (!scriptExecutionContext())
         return;
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(scriptExecutionContext(), this);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(scriptExecutionContext(), *this);
 
     if (m_async || (m_state <= OPENED || m_state == DONE))
         m_progressEventThrottle.dispatchReadyStateChangeEvent(Event::create(eventNames().readystatechangeEvent, false, false), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
 
     InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(cookie);
     if (m_state == DONE && !m_error) {
-        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRLoadEvent(scriptExecutionContext(), this);
+        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRLoadEvent(scriptExecutionContext(), *this);
         m_progressEventThrottle.dispatchProgressEvent(eventNames().loadEvent);
         InspectorInstrumentation::didDispatchXHRLoadEvent(cookie);
         m_progressEventThrottle.dispatchProgressEvent(eventNames().loadendEvent);