Web Inspector: Page should use std::unique_ptr for InspectorController
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jan 2014 19:15:33 +0000 (19:15 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jan 2014 19:15:33 +0000 (19:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127068

Reviewed by Joseph Pecoraro.

Source/WebCore:

Make Page and WorkerGlobalScope keep a std::unique_ptr to InspectorController
and WorkerInspectorController. Store page references and return controller
references where possible.

Convert call sites to use an InspectorController reference.
Convert instantiations of InspectorFrontendClient to use std::unique_ptr.
Convert InspectorOverlay to keep Page references.

* WebCore.exp.in:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::supportsProfiling):
(WebCore::JSDOMWindowBase::supportsRichSourceInfo):
* dom/Node.cpp:
(WebCore::Node::inspect):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::inspectedPageDestroyed):
(WebCore::InspectorController::setInspectorFrontendClient):
(WebCore::InspectorController::hasInspectorFrontendClient):
(WebCore::InspectorController::connectFrontend):
(WebCore::InspectorController::disconnectFrontend):
(WebCore::InspectorController::inspectedPage):
(WebCore::InspectorController::developerExtrasEnabled):
* inspector/InspectorController.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::canAttachWindow):
(WebCore::InspectorFrontendClientLocal::changeAttachedWindowHeight):
(WebCore::InspectorFrontendClientLocal::changeAttachedWindowWidth):
(WebCore::InspectorFrontendClientLocal::openInNewTab):
(WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight):
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::InspectorOverlay):
(WebCore::InspectorOverlay::getHighlight):
(WebCore::InspectorOverlay::highlightQuad):
(WebCore::InspectorOverlay::update):
(WebCore::InspectorOverlay::buildObjectForHighlightedNode):
(WebCore::InspectorOverlay::drawQuadHighlight):
(WebCore::InspectorOverlay::overlayPage):
(WebCore::InspectorOverlay::reset):
* inspector/InspectorOverlay.h:
* inspector/InstrumentingAgents.cpp:
(WebCore::instrumentationForPage): remove null checks.
(WebCore::instrumentationForWorkerGlobalScope): remove null checks.
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
(WebCore::WorkerInspectorController::connectFrontend):
(WebCore::WorkerInspectorController::disconnectFrontend):
* inspector/WorkerInspectorController.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
(WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::showContextMenu):
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::populate):
(WebCore::ContextMenuController::addInspectElementItem):
* page/FrameView.cpp:
(WebCore::FrameView::sendResizeEventIfNeeded):
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
(WebCore::Page::inspectorController):
* page/PageDebuggable.cpp:
(WebCore::PageDebuggable::hasLocalDebugger):
(WebCore::PageDebuggable::parentProcessIdentifier):
(WebCore::PageDebuggable::connect):
(WebCore::PageDebuggable::disconnect):
(WebCore::PageDebuggable::dispatchMessageFromRemoteFrontend):
(WebCore::PageDebuggable::setIndicating):
* platform/graphics/texmap/coordinated/CompositingCoordinator.cpp:
(WebCore::CompositingCoordinator::syncDisplayState):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::inspectorHighlightRects):
(WebCore::Internals::inspectorHighlightObject):
(WebCore::Internals::emitInspectorDidBeginFrame):
(WebCore::Internals::emitInspectorDidCancelFrame):
(WebCore::Internals::openDummyInspectorFrontend):
(WebCore::Internals::closeDummyInspectorFrontend):
(WebCore::Internals::setInspectorResourcesDataSizeLimits):
(WebCore::Internals::setJavaScriptProfilingEnabled):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
* workers/WorkerGlobalScope.h: remove clearInspector().
(WebCore::WorkerGlobalScope::workerInspectorController):
* workers/WorkerMessagingProxy.cpp:
(WebCore::connectToWorkerGlobalScopeInspectorTask):
(WebCore::disconnectFromWorkerGlobalScopeInspectorTask):
(WebCore::dispatchOnInspectorBackendTask):
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadShutdownFinishTask::performTask):

Source/WebKit/efl:

Convert call sites to use a InspectorController reference.
Convert instantiations of InspectorFrontendClient to use std::unique_ptr.

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::evaluateInWebInspector):
* WebCoreSupport/InspectorClientEfl.cpp:
(WebCore::InspectorClientEfl::openInspectorFrontend):
* ewk/ewk_view.cpp:
(ewk_view_inspector_show):
(ewk_view_inspector_close):

Source/WebKit/gtk:

Convert call sites to use a InspectorController reference.
Convert instantiations of InspectorFrontendClient to use std::unique_ptr.

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::paintWebView):
* WebCoreSupport/InspectorClientGtk.cpp:
(WebKit::InspectorClient::openInspectorFrontend):
* webkit/webkitwebinspector.cpp:
(webkit_web_inspector_set_property):
(webkit_web_inspector_get_property):
(webkit_web_inspector_show):
(webkit_web_inspector_inspect_node):
(webkit_web_inspector_inspect_coordinates):
(webkit_web_inspector_close):
(webkit_web_inspector_execute_script):

Source/WebKit/mac:

Convert call sites to use a InspectorController reference.
Convert instantiations of InspectorFrontendClient to use std::unique_ptr.

* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::openInspectorFrontend):
(-[WebInspectorWindowController destroyInspectorView:]):
* WebInspector/WebInspector.mm:
(-[WebInspector showWindow]):
(-[WebInspector isJavaScriptProfilingEnabled]):
(-[WebInspector setJavaScriptProfilingEnabled:]):
(-[WebInspector close:]):
(-[WebInspector evaluateInFrontend:callId:script:]):
* WebInspector/WebNodeHighlighter.mm:
(-[WebNodeHighlighter highlight]):

Source/WebKit/win:

Convert call sites to use a InspectorController reference.

* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorClient::openInspectorFrontend):
(WebInspectorFrontendClient::destroyInspectorView):
(WebInspectorFrontendClient::onClose):
* WebInspector.cpp:
(WebInspector::show):
(WebInspector::close):
(WebInspector::isJavaScriptProfilingEnabled):
(WebInspector::setJavaScriptProfilingEnabled):
(WebInspector::evaluateInFrontend):
* WebNodeHighlight.cpp:
(WebNodeHighlight::update):

Source/WebKit2:

Convert call sites to use a InspectorController reference.

* WebProcess/WebCoreSupport/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::drawRect):
* WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp:
(WebKit::WebInspectorFrontendClient::WebInspectorFrontendClient):
(WebKit::WebInspectorFrontendClient::closeWindow):
* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::createInspectorPage):
(WebKit::WebInspector::show):
(WebKit::WebInspector::close):
(WebKit::WebInspector::evaluateScriptForTest):
(WebKit::WebInspector::showConsole):
(WebKit::WebInspector::showResources):
(WebKit::WebInspector::showMainResourceForFrame):
(WebKit::WebInspector::startJavaScriptDebugging):
(WebKit::WebInspector::stopJavaScriptDebugging):
(WebKit::WebInspector::setJavaScriptProfilingEnabled):
(WebKit::WebInspector::startJavaScriptProfiling):
(WebKit::WebInspector::stopJavaScriptProfiling):
(WebKit::WebInspector::startPageProfiling):
(WebKit::WebInspector::stopPageProfiling):
(WebKit::WebInspector::dispatchMessageFromRemoteFrontend):
(WebKit::WebInspector::remoteFrontendConnected):
(WebKit::WebInspector::remoteFrontendDisconnected):

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

44 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/js/JSDOMWindowBase.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/inspector/InspectorOverlay.h
Source/WebCore/inspector/InstrumentingAgents.cpp
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/WorkerInspectorController.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/PageDebuggable.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/workers/WorkerGlobalScope.cpp
Source/WebCore/workers/WorkerGlobalScope.h
Source/WebCore/workers/WorkerMessagingProxy.cpp
Source/WebCore/workers/WorkerThread.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp
Source/WebKit/efl/ewk/ewk_view.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
Source/WebKit/gtk/webkit/webkitwebinspector.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKit/mac/WebInspector/WebInspector.mm
Source/WebKit/mac/WebInspector/WebNodeHighlighter.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
Source/WebKit/win/WebInspector.cpp
Source/WebKit/win/WebNodeHighlight.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
Source/WebKit2/WebProcess/WebPage/WebInspector.cpp

index 89babb6..e153d96 100644 (file)
@@ -1,3 +1,102 @@
+2014-01-18  Brian Burg  <bburg@apple.com>
+
+        Web Inspector: Page should use std::unique_ptr for InspectorController
+        https://bugs.webkit.org/show_bug.cgi?id=127068
+
+        Reviewed by Joseph Pecoraro.
+
+        Make Page and WorkerGlobalScope keep a std::unique_ptr to InspectorController
+        and WorkerInspectorController. Store page references and return controller
+        references where possible.
+
+        Convert call sites to use an InspectorController reference.
+        Convert instantiations of InspectorFrontendClient to use std::unique_ptr.
+        Convert InspectorOverlay to keep Page references.
+
+        * WebCore.exp.in:
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::supportsProfiling):
+        (WebCore::JSDOMWindowBase::supportsRichSourceInfo):
+        * dom/Node.cpp:
+        (WebCore::Node::inspect):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::inspectedPageDestroyed):
+        (WebCore::InspectorController::setInspectorFrontendClient):
+        (WebCore::InspectorController::hasInspectorFrontendClient):
+        (WebCore::InspectorController::connectFrontend):
+        (WebCore::InspectorController::disconnectFrontend):
+        (WebCore::InspectorController::inspectedPage):
+        (WebCore::InspectorController::developerExtrasEnabled):
+        * inspector/InspectorController.h:
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::canAttachWindow):
+        (WebCore::InspectorFrontendClientLocal::changeAttachedWindowHeight):
+        (WebCore::InspectorFrontendClientLocal::changeAttachedWindowWidth):
+        (WebCore::InspectorFrontendClientLocal::openInNewTab):
+        (WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight):
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::InspectorOverlay):
+        (WebCore::InspectorOverlay::getHighlight):
+        (WebCore::InspectorOverlay::highlightQuad):
+        (WebCore::InspectorOverlay::update):
+        (WebCore::InspectorOverlay::buildObjectForHighlightedNode):
+        (WebCore::InspectorOverlay::drawQuadHighlight):
+        (WebCore::InspectorOverlay::overlayPage):
+        (WebCore::InspectorOverlay::reset):
+        * inspector/InspectorOverlay.h:
+        * inspector/InstrumentingAgents.cpp:
+        (WebCore::instrumentationForPage): remove null checks.
+        (WebCore::instrumentationForWorkerGlobalScope): remove null checks.
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::WorkerInspectorController):
+        (WebCore::WorkerInspectorController::connectFrontend):
+        (WebCore::WorkerInspectorController::disconnectFrontend):
+        * inspector/WorkerInspectorController.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
+        (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::showContextMenu):
+        (WebCore::ContextMenuController::contextMenuItemSelected):
+        (WebCore::ContextMenuController::populate):
+        (WebCore::ContextMenuController::addInspectElementItem):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::sendResizeEventIfNeeded):
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        * page/Page.h:
+        (WebCore::Page::inspectorController):
+        * page/PageDebuggable.cpp:
+        (WebCore::PageDebuggable::hasLocalDebugger):
+        (WebCore::PageDebuggable::parentProcessIdentifier):
+        (WebCore::PageDebuggable::connect):
+        (WebCore::PageDebuggable::disconnect):
+        (WebCore::PageDebuggable::dispatchMessageFromRemoteFrontend):
+        (WebCore::PageDebuggable::setIndicating):
+        * platform/graphics/texmap/coordinated/CompositingCoordinator.cpp:
+        (WebCore::CompositingCoordinator::syncDisplayState):
+        * testing/Internals.cpp:
+        (WebCore::Internals::resetToConsistentState):
+        (WebCore::Internals::inspectorHighlightRects):
+        (WebCore::Internals::inspectorHighlightObject):
+        (WebCore::Internals::emitInspectorDidBeginFrame):
+        (WebCore::Internals::emitInspectorDidCancelFrame):
+        (WebCore::Internals::openDummyInspectorFrontend):
+        (WebCore::Internals::closeDummyInspectorFrontend):
+        (WebCore::Internals::setInspectorResourcesDataSizeLimits):
+        (WebCore::Internals::setJavaScriptProfilingEnabled):
+        * workers/WorkerGlobalScope.cpp:
+        (WebCore::WorkerGlobalScope::WorkerGlobalScope):
+        * workers/WorkerGlobalScope.h: remove clearInspector(). 
+        (WebCore::WorkerGlobalScope::workerInspectorController):
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::connectToWorkerGlobalScopeInspectorTask):
+        (WebCore::disconnectFromWorkerGlobalScopeInspectorTask):
+        (WebCore::dispatchOnInspectorBackendTask):
+        * workers/WorkerThread.cpp:
+        (WebCore::WorkerThreadShutdownFinishTask::performTask):
+
 2014-01-18  Anders Carlsson  <andersca@apple.com>
 
         Remove ENABLE_THREADED_HTML_PARSER defines everywhere
index 8a2d607..860b9ec 100644 (file)
@@ -2764,7 +2764,7 @@ __ZN7WebCore19InspectorController15connectFrontendEPN9Inspector24InspectorFronte
 __ZN7WebCore19InspectorController18disconnectFrontendEv
 __ZN7WebCore19InspectorController18setProfilerEnabledEb
 __ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKN3WTF6StringE
-__ZN7WebCore19InspectorController26setInspectorFrontendClientEN3WTF10PassOwnPtrINS_23InspectorFrontendClientEEE
+__ZN7WebCore19InspectorController26setInspectorFrontendClientENSt3__110unique_ptrINS_23InspectorFrontendClientENS1_14default_deleteIS3_EEEE
 __ZN7WebCore19InspectorController39setResourcesDataSizeLimitsFromInternalsEii
 __ZN7WebCore19InspectorController4showEv
 __ZN7WebCore19InspectorController5closeEv
index 2b8dd43..75a1f73 100644 (file)
@@ -117,7 +117,7 @@ bool JSDOMWindowBase::supportsProfiling(const JSGlobalObject* object)
         return false;
 
 #if ENABLE(INSPECTOR)
-    return page->inspectorController()->profilerEnabled();
+    return page->inspectorController().profilerEnabled();
 #else
     return false;
 #endif // ENABLE(INSPECTOR)
@@ -139,7 +139,7 @@ bool JSDOMWindowBase::supportsRichSourceInfo(const JSGlobalObject* object)
     if (!page)
         return false;
 
-    bool enabled = page->inspectorController()->enabled();
+    bool enabled = page->inspectorController().enabled();
     ASSERT(enabled || !thisObject->debugger());
     ASSERT(enabled || !supportsProfiling(thisObject));
     return enabled;
index de78751..07631cf 100644 (file)
@@ -557,7 +557,7 @@ void Node::inspect()
 {
 #if ENABLE(INSPECTOR)
     if (document().page())
-        document().page()->inspectorController()->inspect(this);
+        document().page()->inspectorController().inspect(this);
 #endif
 }
 
index 9a4f11a..844302b 100644 (file)
@@ -82,10 +82,10 @@ using namespace Inspector;
 
 namespace WebCore {
 
-InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient)
+InspectorController::InspectorController(Page& page, InspectorClient* inspectorClient)
     : m_instrumentingAgents(InstrumentingAgents::create(*this))
     , m_injectedScriptManager(std::make_unique<PageInjectedScriptManager>(*this, PageInjectedScriptHost::create()))
-    , m_overlay(InspectorOverlay::create(page, inspectorClient))
+    , m_overlay(std::make_unique<InspectorOverlay>(page, inspectorClient))
     , m_inspectorFrontendChannel(nullptr)
     , m_page(page)
     , m_inspectorClient(inspectorClient)
@@ -101,7 +101,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
     m_instrumentingAgents->setInspectorAgent(m_inspectorAgent);
     m_agents.append(std::move(inspectorAgentPtr));
 
-    auto pageAgentPtr = std::make_unique<InspectorPageAgent>(m_instrumentingAgents.get(), page, inspectorClient, m_overlay.get());
+    auto pageAgentPtr = std::make_unique<InspectorPageAgent>(m_instrumentingAgents.get(), &page, inspectorClient, m_overlay.get());
     InspectorPageAgent* pageAgent = pageAgentPtr.get();
     m_pageAgent = pageAgentPtr.get();
     m_agents.append(std::move(pageAgentPtr));
@@ -137,7 +137,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
     m_resourceAgent = resourceAgentPtr.get();
     m_agents.append(std::move(resourceAgentPtr));
 
-    auto runtimeAgentPtr = std::make_unique<PageRuntimeAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get(), page, pageAgent);
+    auto runtimeAgentPtr = std::make_unique<PageRuntimeAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get(), &page, pageAgent);
     InspectorRuntimeAgent* runtimeAgent = runtimeAgentPtr.get();
     m_agents.append(std::move(runtimeAgentPtr));
 
@@ -154,7 +154,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
     m_domDebuggerAgent = domDebuggerAgentPtr.get();
     m_agents.append(std::move(domDebuggerAgentPtr));
 
-    auto profilerAgentPtr = InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent, page, m_injectedScriptManager.get());
+    auto profilerAgentPtr = InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent, &page, m_injectedScriptManager.get());
     m_profilerAgent = profilerAgentPtr.get();
     m_agents.append(std::move(profilerAgentPtr));
 
@@ -165,7 +165,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
 
     m_agents.append(std::make_unique<InspectorCanvasAgent>(m_instrumentingAgents.get(), pageAgent, m_injectedScriptManager.get()));
 
-    m_agents.append(std::make_unique<InspectorInputAgent>(m_instrumentingAgents.get(), page));
+    m_agents.append(std::make_unique<InspectorInputAgent>(m_instrumentingAgents.get(), &page));
 
 #if USE(ACCELERATED_COMPOSITING)
     m_agents.append(std::make_unique<InspectorLayerTreeAgent>(m_instrumentingAgents.get()));
@@ -195,23 +195,17 @@ InspectorController::~InspectorController()
     ASSERT(!m_inspectorClient);
 }
 
-PassOwnPtr<InspectorController> InspectorController::create(Page* page, InspectorClient* client)
-{
-    return adoptPtr(new InspectorController(page, client));
-}
-
 void InspectorController::inspectedPageDestroyed()
 {
     disconnectFrontend();
     m_injectedScriptManager->disconnect();
     m_inspectorClient->inspectorDestroyed();
     m_inspectorClient = 0;
-    m_page = 0;
 }
 
-void InspectorController::setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient> inspectorFrontendClient)
+void InspectorController::setInspectorFrontendClient(std::unique_ptr<InspectorFrontendClient> inspectorFrontendClient)
 {
-    m_inspectorFrontendClient = inspectorFrontendClient;
+    m_inspectorFrontendClient = std::move(inspectorFrontendClient);
 }
 
 bool InspectorController::hasLocalFrontend() const
@@ -234,7 +228,7 @@ bool InspectorController::hasRemoteFrontend() const
 
 bool InspectorController::hasInspectorFrontendClient() const
 {
-    return m_inspectorFrontendClient;
+    return m_inspectorFrontendClient.get();
 }
 
 void InspectorController::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld& world)
@@ -268,7 +262,7 @@ void InspectorController::connectFrontend(InspectorFrontendChannel* frontendChan
 
 #if ENABLE(REMOTE_INSPECTOR)
     if (!m_hasRemoteFrontend)
-        m_page->remoteInspectorInformationDidChange();
+        m_page.remoteInspectorInformationDidChange();
 #endif
 }
 
@@ -290,7 +284,7 @@ void InspectorController::disconnectFrontend()
 
 #if ENABLE(REMOTE_INSPECTOR)
     if (!m_hasRemoteFrontend)
-        m_page->remoteInspectorInformationDidChange();
+        m_page.remoteInspectorInformationDidChange();
 #endif
 }
 
@@ -365,7 +359,7 @@ bool InspectorController::enabled() const
     return developerExtrasEnabled();
 }
 
-Page* InspectorController::inspectedPage() const
+Page& InspectorController::inspectedPage() const
 {
     return m_page;
 }
@@ -453,10 +447,7 @@ void InspectorController::didComposite()
 
 bool InspectorController::developerExtrasEnabled() const
 {
-    if (!m_page)
-        return false;
-
-    return m_page->settings().developerExtrasEnabled();
+    return m_page.settings().developerExtrasEnabled();
 }
 
 bool InspectorController::canAccessInspectedScriptState(JSC::ExecState* scriptState) const
index 31e2957..89e9780 100644 (file)
@@ -77,18 +77,18 @@ class InspectorController final : public Inspector::InspectorEnvironment {
     WTF_MAKE_NONCOPYABLE(InspectorController);
     WTF_MAKE_FAST_ALLOCATED;
 public:
+    InspectorController(Page&, InspectorClient*);
     virtual ~InspectorController();
 
-    static PassOwnPtr<InspectorController> create(Page*, InspectorClient*);
     void inspectedPageDestroyed();
 
     bool enabled() const;
-    Page* inspectedPage() const;
+    Page& inspectedPage() const;
 
     void show();
     void close();
 
-    void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
+    void setInspectorFrontendClient(std::unique_ptr<InspectorFrontendClient>);
     bool hasInspectorFrontendClient() const;
     void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld&);
 
@@ -144,13 +144,11 @@ public:
     virtual void didCallInjectedScriptFunction() override;
 
 private:
-    InspectorController(Page*, InspectorClient*);
-
     friend InstrumentingAgents* instrumentationForPage(Page*);
 
     RefPtr<InstrumentingAgents> m_instrumentingAgents;
     std::unique_ptr<PageInjectedScriptManager> m_injectedScriptManager;
-    OwnPtr<InspectorOverlay> m_overlay;
+    std::unique_ptr<InspectorOverlay> m_overlay;
 
     Inspector::InspectorAgent* m_inspectorAgent;
     InspectorDOMAgent* m_domAgent;
@@ -164,9 +162,9 @@ private:
 #endif
 
     RefPtr<Inspector::InspectorBackendDispatcher> m_inspectorBackendDispatcher;
-    OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
+    std::unique_ptr<InspectorFrontendClient> m_inspectorFrontendClient;
     Inspector::InspectorFrontendChannel* m_inspectorFrontendChannel;
-    Page* m_page;
+    Page& m_page;
     InspectorClient* m_inspectorClient;
     Inspector::InspectorAgentRegistry m_agents;
     Vector<InspectorInstrumentationCookie, 2> m_injectedScriptInstrumentationCookies;
index a6cf027..4e85bc5 100644 (file)
@@ -182,8 +182,8 @@ bool InspectorFrontendClientLocal::canAttachWindow()
         return true;
 
     // Don't allow the attach if the window would be too small to accommodate the minimum inspector size.
-    unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame().view()->visibleHeight();
-    unsigned inspectedPageWidth = m_inspectorController->inspectedPage()->mainFrame().view()->visibleWidth();
+    unsigned inspectedPageHeight = m_inspectorController->inspectedPage().mainFrame().view()->visibleHeight();
+    unsigned inspectedPageWidth = m_inspectorController->inspectedPage().mainFrame().view()->visibleWidth();
     unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeightRatio;
     return minimumAttachedHeight <= maximumAttachedHeight && minimumAttachedWidth <= inspectedPageWidth;
 }
@@ -195,7 +195,7 @@ void InspectorFrontendClientLocal::setDockingUnavailable(bool unavailable)
 
 void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)
 {
-    unsigned totalHeight = m_frontendPage->mainFrame().view()->visibleHeight() + m_inspectorController->inspectedPage()->mainFrame().view()->visibleHeight();
+    unsigned totalHeight = m_frontendPage->mainFrame().view()->visibleHeight() + m_inspectorController->inspectedPage().mainFrame().view()->visibleHeight();
     unsigned attachedHeight = constrainedAttachedWindowHeight(height, totalHeight);
     m_settings->setProperty(inspectorAttachedHeightSetting, String::number(attachedHeight));
     setAttachedWindowHeight(attachedHeight);
@@ -203,7 +203,7 @@ void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)
 
 void InspectorFrontendClientLocal::changeAttachedWindowWidth(unsigned width)
 {
-    unsigned totalWidth = m_frontendPage->mainFrame().view()->visibleWidth() + m_inspectorController->inspectedPage()->mainFrame().view()->visibleWidth();
+    unsigned totalWidth = m_frontendPage->mainFrame().view()->visibleWidth() + m_inspectorController->inspectedPage().mainFrame().view()->visibleWidth();
     unsigned attachedWidth = constrainedAttachedWindowWidth(width, totalWidth);
     setAttachedWindowWidth(attachedWidth);
 }
@@ -211,8 +211,7 @@ void InspectorFrontendClientLocal::changeAttachedWindowWidth(unsigned width)
 void InspectorFrontendClientLocal::openInNewTab(const String& url)
 {
     UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
-    Page* page = m_inspectorController->inspectedPage();
-    Frame& mainFrame = page->mainFrame();
+    Frame& mainFrame = m_inspectorController->inspectedPage().mainFrame();
     FrameLoadRequest request(mainFrame.document()->securityOrigin(), ResourceRequest(), "_blank");
 
     bool created;
@@ -257,7 +256,7 @@ void InspectorFrontendClientLocal::setAttachedWindow(DockSide dockSide)
 
 void InspectorFrontendClientLocal::restoreAttachedWindowHeight()
 {
-    unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame().view()->visibleHeight();
+    unsigned inspectedPageHeight = m_inspectorController->inspectedPage().mainFrame().view()->visibleHeight();
     String value = m_settings->getProperty(inspectorAttachedHeightSetting);
     unsigned preferredHeight = value.isEmpty() ? defaultAttachedHeight : value.toUInt();
     
index f15e203..0bd869b 100644 (file)
@@ -228,10 +228,8 @@ static void buildNodeHighlight(Node* node, RenderRegion* region, const Highlight
     buildRendererHighlight(renderer, region, highlightConfig, highlight);
 }
 
-static void buildQuadHighlight(Page* page, const FloatQuad& quad, const HighlightConfig& highlightConfig, Highlight *highlight)
+static void buildQuadHighlight(const FloatQuad& quad, const HighlightConfig& highlightConfig, Highlight *highlight)
 {
-    if (!page)
-        return;
     highlight->setDataFromConfig(highlightConfig);
     highlight->type = HighlightTypeRects;
     highlight->quads.append(quad);
@@ -239,7 +237,7 @@ static void buildQuadHighlight(Page* page, const FloatQuad& quad, const Highligh
 
 } // anonymous namespace
 
-InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client)
+InspectorOverlay::InspectorOverlay(Page& page, InspectorClient* client)
     : m_page(page)
     , m_client(client)
 {
@@ -274,7 +272,7 @@ void InspectorOverlay::getHighlight(Highlight* highlight) const
     if (m_highlightNode)
         buildNodeHighlight(m_highlightNode.get(), nullptr, m_nodeHighlightConfig, highlight);
     else
-        buildQuadHighlight(m_page, *m_highlightQuad, m_quadHighlightConfig, highlight);
+        buildQuadHighlight(*m_highlightQuad, m_quadHighlightConfig, highlight);
 }
 
 void InspectorOverlay::setPausedInDebuggerMessage(const String* message)
@@ -300,7 +298,7 @@ void InspectorOverlay::highlightNode(Node* node, const HighlightConfig& highligh
 void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const HighlightConfig& highlightConfig)
 {
     if (m_quadHighlightConfig.usePageCoordinates)
-        *quad -= m_page->mainFrame().view()->scrollOffset();
+        *quad -= m_page.mainFrame().view()->scrollOffset();
 
     m_quadHighlightConfig = highlightConfig;
     m_highlightQuad = quad;
@@ -324,7 +322,7 @@ void InspectorOverlay::update()
         return;
     }
 
-    FrameView* view = m_page->mainFrame().view();
+    FrameView* view = m_page.mainFrame().view();
     if (!view)
         return;
 
@@ -332,8 +330,8 @@ void InspectorOverlay::update()
     IntSize viewportSize = view->visibleContentRect().size();
     IntSize frameViewFullSize = view->visibleContentRect(ScrollableArea::IncludeScrollbars).size();
     IntSize size = m_size.isEmpty() ? frameViewFullSize : m_size;
-    overlayPage()->setPageScaleFactor(m_page->pageScaleFactor(), IntPoint());
-    size.scale(m_page->pageScaleFactor());
+    overlayPage()->setPageScaleFactor(m_page.pageScaleFactor(), IntPoint());
+    size.scale(m_page.pageScaleFactor());
     overlayView->resize(size);
 
     // Clear canvas and paint things.
@@ -710,7 +708,7 @@ PassRefPtr<InspectorObject> InspectorOverlay::buildObjectForHighlightedNode() co
     RefPtr<InspectorObject> highlightObject = InspectorObject::create();
 
     // The main view's scroll offset is shared across all quads.
-    FrameView* mainView = m_page->mainFrame().view();
+    FrameView* mainView = m_page.mainFrame().view();
     highlightObject->setObject("scroll", buildObjectForPoint(!mainView->delegatesScrolling() ? mainView->visibleContentRect().location() : FloatPoint()));
 
     highlightObject->setArray("fragments", highlightFragments.release());
@@ -738,7 +736,7 @@ void InspectorOverlay::drawQuadHighlight()
         return;
 
     Highlight highlight;
-    buildQuadHighlight(m_page, *m_highlightQuad, m_quadHighlightConfig, &highlight);
+    buildQuadHighlight(*m_highlightQuad, m_quadHighlightConfig, &highlight);
     evaluateInOverlay("drawQuadHighlight", buildObjectForHighlight(highlight));
 }
 
@@ -757,7 +755,7 @@ Page* InspectorOverlay::overlayPage()
     fillWithEmptyClients(pageClients);
     m_overlayPage = adoptPtr(new Page(pageClients));
 
-    Settings& settings = m_page->settings();
+    Settings& settings = m_page.settings();
     Settings& overlaySettings = m_overlayPage->settings();
 
     overlaySettings.setStandardFontFamily(settings.standardFontFamily());
@@ -798,7 +796,7 @@ Page* InspectorOverlay::overlayPage()
 void InspectorOverlay::reset(const IntSize& viewportSize, const IntSize& frameViewFullSize)
 {
     RefPtr<InspectorObject> resetData = InspectorObject::create();
-    resetData->setNumber("deviceScaleFactor", m_page->deviceScaleFactor());
+    resetData->setNumber("deviceScaleFactor", m_page.deviceScaleFactor());
     resetData->setObject("viewportSize", buildObjectForSize(viewportSize));
     resetData->setObject("frameViewFullSize", buildObjectForSize(frameViewFullSize));
     evaluateInOverlay("reset", resetData.release());
index b529228..7e3d017 100644 (file)
@@ -105,10 +105,7 @@ struct Highlight {
 class InspectorOverlay {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<InspectorOverlay> create(Page* page, InspectorClient* client)
-    {
-        return adoptPtr(new InspectorOverlay(page, client));
-    }
+    InspectorOverlay(Page&, InspectorClient*);
     ~InspectorOverlay();
 
     void update();
@@ -130,8 +127,6 @@ public:
 
     void freePage();
 private:
-    InspectorOverlay(Page*, InspectorClient*);
-
     void drawGutter();
     void drawNodeHighlight();
     void drawQuadHighlight();
@@ -141,7 +136,7 @@ private:
     void evaluateInOverlay(const String& method, const String& argument);
     void evaluateInOverlay(const String& method, PassRefPtr<Inspector::InspectorValue> argument);
 
-    Page* m_page;
+    Page& m_page;
     InspectorClient* m_client;
     String m_pausedInDebuggerMessage;
     RefPtr<Node> m_highlightNode;
index a2238e9..834a4d8 100644 (file)
@@ -105,16 +105,12 @@ void InstrumentingAgents::reset()
 InstrumentingAgents* instrumentationForPage(Page* page)
 {
     ASSERT(isMainThread());
-    if (InspectorController* controller = page->inspectorController())
-        return controller->m_instrumentingAgents.get();
-    return 0;
+    return page ? page->inspectorController().m_instrumentingAgents.get() : nullptr;
 }
 
 InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope* workerGlobalScope)
 {
-    if (WorkerInspectorController* controller = workerGlobalScope->workerInspectorController())
-        return controller->m_instrumentingAgents.get();
-    return 0;
+    return workerGlobalScope ? workerGlobalScope->workerInspectorController().m_instrumentingAgents.get() : nullptr;
 }
 
 } // namespace WebCore
index c8e4140..bfdfbc8 100644 (file)
@@ -55,7 +55,6 @@
 #include "WorkerRuntimeAgent.h"
 #include "WorkerThread.h"
 #include <inspector/InspectorBackendDispatcher.h>
-#include <wtf/PassOwnPtr.h>
 
 using namespace Inspector;
 
@@ -66,36 +65,37 @@ namespace {
 class PageInspectorProxy : public InspectorFrontendChannel {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit PageInspectorProxy(WorkerGlobalScope* workerGlobalScope) : m_workerGlobalScope(workerGlobalScope) { }
+    explicit PageInspectorProxy(WorkerGlobalScope& workerGlobalScope)
+        : m_workerGlobalScope(workerGlobalScope) { }
     virtual ~PageInspectorProxy() { }
 private:
     virtual bool sendMessageToFrontend(const String& message)
     {
-        m_workerGlobalScope->thread()->workerReportingProxy().postMessageToPageInspector(message);
+        m_workerGlobalScope.thread()->workerReportingProxy().postMessageToPageInspector(message);
         return true;
     }
-    WorkerGlobalScope* m_workerGlobalScope;
+    WorkerGlobalScope& m_workerGlobalScope;
 };
 
 }
 
-WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGlobalScope)
+WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope& workerGlobalScope)
     : m_workerGlobalScope(workerGlobalScope)
     , m_instrumentingAgents(InstrumentingAgents::create(*this))
     , m_injectedScriptManager(std::make_unique<PageInjectedScriptManager>(*this, PageInjectedScriptHost::create()))
-    , m_runtimeAgent(0)
+    , m_runtimeAgent(nullptr)
 {
-    auto runtimeAgent = std::make_unique<WorkerRuntimeAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get(), workerGlobalScope);
+    auto runtimeAgent = std::make_unique<WorkerRuntimeAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get(), &workerGlobalScope);
     m_runtimeAgent = runtimeAgent.get();
     m_agents.append(std::move(runtimeAgent));
 
     auto consoleAgent = std::make_unique<WorkerConsoleAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get());
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    auto debuggerAgent = std::make_unique<WorkerDebuggerAgent>(m_instrumentingAgents.get(), workerGlobalScope, m_injectedScriptManager.get());
+    auto debuggerAgent = std::make_unique<WorkerDebuggerAgent>(m_instrumentingAgents.get(), &workerGlobalScope, m_injectedScriptManager.get());
     m_runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
     m_agents.append(std::move(debuggerAgent));
 
-    m_agents.append(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent.get(), workerGlobalScope, m_injectedScriptManager.get()));
+    m_agents.append(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent.get(), &workerGlobalScope, m_injectedScriptManager.get()));
     m_agents.append(std::make_unique<InspectorHeapProfilerAgent>(m_instrumentingAgents.get(), m_injectedScriptManager.get()));
 #endif
     m_agents.append(std::make_unique<InspectorTimelineAgent>(m_instrumentingAgents.get(), nullptr, nullptr, InspectorTimelineAgent::WorkerInspector, nullptr));
@@ -122,7 +122,7 @@ WorkerInspectorController::~WorkerInspectorController()
 void WorkerInspectorController::connectFrontend()
 {
     ASSERT(!m_frontendChannel);
-    m_frontendChannel = adoptPtr(new PageInspectorProxy(m_workerGlobalScope));
+    m_frontendChannel = std::make_unique<PageInspectorProxy>(m_workerGlobalScope);
     m_backendDispatcher = InspectorBackendDispatcher::create(m_frontendChannel.get());
     m_agents.didCreateFrontendAndBackend(m_frontendChannel.get(), m_backendDispatcher.get());
 }
@@ -134,7 +134,7 @@ void WorkerInspectorController::disconnectFrontend()
     m_agents.willDestroyFrontendAndBackend();
     m_backendDispatcher->clearFrontend();
     m_backendDispatcher.clear();
-    m_frontendChannel.clear();
+    m_frontendChannel = nullptr;
 }
 
 void WorkerInspectorController::dispatchMessageFromFrontend(const String& message)
index 49aa05f..fe6fda7 100644 (file)
@@ -40,7 +40,6 @@
 #include <wtf/FastMalloc.h>
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 
@@ -60,7 +59,7 @@ class WorkerInspectorController final : public Inspector::InspectorEnvironment {
     WTF_MAKE_NONCOPYABLE(WorkerInspectorController);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    WorkerInspectorController(WorkerGlobalScope*);
+    explicit WorkerInspectorController(WorkerGlobalScope&);
     ~WorkerInspectorController();
 
     void connectFrontend();
@@ -80,12 +79,12 @@ public:
 private:
     friend InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope*);
 
-    WorkerGlobalScope* m_workerGlobalScope;
+    WorkerGlobalScope& m_workerGlobalScope;
     RefPtr<InstrumentingAgents> m_instrumentingAgents;
     std::unique_ptr<PageInjectedScriptManager> m_injectedScriptManager;
     InspectorRuntimeAgent* m_runtimeAgent;
     Inspector::InspectorAgentRegistry m_agents;
-    OwnPtr<InspectorFrontendChannel> m_frontendChannel;
+    std::unique_ptr<InspectorFrontendChannel> m_frontendChannel;
     RefPtr<Inspector::InspectorBackendDispatcher> m_backendDispatcher;
     Vector<InspectorInstrumentationCookie, 2> m_injectedScriptInstrumentationCookies;
 };
index 2bd20b9..1c4a27f 100644 (file)
@@ -2956,7 +2956,7 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass
 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
     if (Page* page = m_frame.page()) {
         if (m_frame.isMainFrame())
-            page->inspectorController()->resume();
+            page->inspectorController().resume();
     }
 #endif
 
@@ -3351,7 +3351,7 @@ 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);
index a36af56..6d5cf74 100644 (file)
@@ -157,7 +157,7 @@ PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(Event* event)
 void ContextMenuController::showContextMenu(Event* event)
 {
 #if ENABLE(INSPECTOR)
-    if (m_page.inspectorController()->enabled())
+    if (m_page.inspectorController().enabled())
         addInspectElementItem();
 #endif
 
@@ -503,7 +503,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
 #if ENABLE(INSPECTOR)
     case ContextMenuItemTagInspectElement:
         if (Page* page = frame->page())
-            page->inspectorController()->inspect(m_hitTestResult.innerNonSharedNode());
+            page->inspectorController().inspect(m_hitTestResult.innerNonSharedNode());
         break;
 #endif
     case ContextMenuItemTagDictationAlternative:
@@ -893,7 +893,7 @@ void ContextMenuController::populate()
 #endif                
             } else {
 #if ENABLE(INSPECTOR)
-                if (!(frame->page() && (frame->page()->inspectorController()->hasInspectorFrontendClient() || frame->page()->inspectorController()->hasRemoteFrontend()))) {
+                if (!(frame->page() && (frame->page()->inspectorController().hasInspectorFrontendClient() || frame->page()->inspectorController().hasRemoteFrontend()))) {
 #endif
 
                 // In GTK+ unavailable items are not hidden but insensitive.
@@ -1101,9 +1101,6 @@ void ContextMenuController::addInspectElementItem()
     if (!page)
         return;
 
-    if (!page->inspectorController())
-        return;
-
     ContextMenuItem InspectElementItem(ActionType, ContextMenuItemTagInspectElement, contextMenuItemTagInspectElement());
 #if USE(CROSS_PLATFORM_CONTEXT_MENUS)
     if (m_contextMenu && !m_contextMenu->items().isEmpty())
index 7678988..18bc8f5 100644 (file)
@@ -2938,7 +2938,7 @@ void FrameView::sendResizeEventIfNeeded()
 #if ENABLE(INSPECTOR)
     Page* page = frame().page();
     if (InspectorInstrumentation::hasFrontends() && isMainFrame) {
-        if (InspectorClient* inspectorClient = page ? page->inspectorController()->inspectorClient() : 0)
+        if (InspectorClient* inspectorClient = page ? page->inspectorController().inspectorClient() : nullptr)
             inspectorClient->didResizeMainFrame(&frame());
     }
 #endif
index 6b7e588..4c8f643 100644 (file)
@@ -134,7 +134,7 @@ Page::Page(PageClients& pageClients)
     , m_contextMenuController(std::make_unique<ContextMenuController>(*this, *pageClients.contextMenuClient))
 #endif
 #if ENABLE(INSPECTOR)
-    , m_inspectorController(InspectorController::create(this, pageClients.inspectorClient))
+    , m_inspectorController(std::make_unique<InspectorController>(*this, pageClients.inspectorClient))
 #endif
 #if ENABLE(POINTER_LOCK)
     , m_pointerLockController(PointerLockController::create(this))
index 4a45262..0e51797 100644 (file)
@@ -202,7 +202,7 @@ public:
     ContextMenuController& contextMenuController() const { return *m_contextMenuController; }
 #endif
 #if ENABLE(INSPECTOR)
-    InspectorController* inspectorController() const { return m_inspectorController.get(); }
+    InspectorController& inspectorController() const { return *m_inspectorController; }
 #endif
 #if ENABLE(POINTER_LOCK)
     PointerLockController* pointerLockController() const { return m_pointerLockController.get(); }
@@ -456,7 +456,7 @@ private:
     const std::unique_ptr<ContextMenuController> m_contextMenuController;
 #endif
 #if ENABLE(INSPECTOR)
-    OwnPtr<InspectorController> m_inspectorController;
+    const std::unique_ptr<InspectorController> m_inspectorController;
 #endif
 #if ENABLE(POINTER_LOCK)
     OwnPtr<PointerLockController> m_pointerLockController;
index 2a26e63..c1f2652 100644 (file)
@@ -63,12 +63,12 @@ String PageDebuggable::url() const
 
 bool PageDebuggable::hasLocalDebugger() const
 {
-    return m_page.inspectorController()->hasLocalFrontend();
+    return m_page.inspectorController().hasLocalFrontend();
 }
 
 pid_t PageDebuggable::parentProcessIdentifier() const
 {
-    if (InspectorClient* inspectorClient = m_page.inspectorController()->inspectorClient())
+    if (InspectorClient* inspectorClient = m_page.inspectorController().inspectorClient())
         return inspectorClient->parentProcessIdentifier();
 
     return 0;
@@ -76,26 +76,26 @@ pid_t PageDebuggable::parentProcessIdentifier() const
 
 void PageDebuggable::connect(Inspector::InspectorFrontendChannel* channel)
 {
-    InspectorController* inspectorController = m_page.inspectorController();
-    inspectorController->setHasRemoteFrontend(true);
-    inspectorController->connectFrontend(reinterpret_cast<WebCore::InspectorFrontendChannel*>(channel));
+    InspectorController& inspectorController = m_page.inspectorController();
+    inspectorController.setHasRemoteFrontend(true);
+    inspectorController.connectFrontend(reinterpret_cast<WebCore::InspectorFrontendChannel*>(channel));
 }
 
 void PageDebuggable::disconnect()
 {
-    InspectorController* inspectorController = m_page.inspectorController();
-    inspectorController->disconnectFrontend();
-    inspectorController->setHasRemoteFrontend(false);
+    InspectorController& inspectorController = m_page.inspectorController();
+    inspectorController.disconnectFrontend();
+    inspectorController.setHasRemoteFrontend(false);
 }
 
 void PageDebuggable::dispatchMessageFromRemoteFrontend(const String& message)
 {
-    m_page.inspectorController()->dispatchMessageFromFrontend(message);
+    m_page.inspectorController().dispatchMessageFromFrontend(message);
 }
 
 void PageDebuggable::setIndicating(bool indicating)
 {
-    m_page.inspectorController()->setIndicating(indicating);
+    m_page.inspectorController().setIndicating(indicating);
 }
 
 } // namespace WebCore
index 80c2d38..14bc956 100644 (file)
@@ -126,7 +126,7 @@ bool CompositingCoordinator::flushPendingLayerChanges()
 void CompositingCoordinator::syncDisplayState()
 {
 #if ENABLE(INSPECTOR)
-    m_page->inspectorController()->didBeginFrame();
+    m_page->inspectorController().didBeginFrame();
 #endif
 
 #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) && !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
index f638841..e4acb6d 100644 (file)
@@ -276,8 +276,7 @@ void Internals::resetToConsistentState(Page* page)
     WebCore::overrideUserPreferredLanguages(Vector<String>());
     WebCore::Settings::setUsesOverlayScrollbars(false);
 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
-    if (page->inspectorController())
-        page->inspectorController()->setProfilerEnabled(false);
+    page->inspectorController().setProfilerEnabled(false);
 #endif
 #if ENABLE(VIDEO_TRACK) && !PLATFORM(WIN)
     page->group().captionPreferences()->setCaptionsStyleSheetOverride(emptyString());
@@ -704,13 +703,13 @@ PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(ExceptionCode& ec)
 {
 #if ENABLE(INSPECTOR)
     Document* document = contextDocument();
-    if (!document || !document->page() || !document->page()->inspectorController()) {
+    if (!document || !document->page()) {
         ec = INVALID_ACCESS_ERR;
         return ClientRectList::create();
     }
 
     Highlight highlight;
-    document->page()->inspectorController()->getHighlight(&highlight);
+    document->page()->inspectorController().getHighlight(&highlight);
     return ClientRectList::create(highlight.quads);
 #else
     UNUSED_PARAM(ec);
@@ -722,11 +721,11 @@ String Internals::inspectorHighlightObject(ExceptionCode& ec)
 {
 #if ENABLE(INSPECTOR)
     Document* document = contextDocument();
-    if (!document || !document->page() || !document->page()->inspectorController()) {
+    if (!document || !document->page()) {
         ec = INVALID_ACCESS_ERR;
         return String();
     }
-    RefPtr<InspectorObject> object = document->page()->inspectorController()->buildObjectForHighlightedNode();
+    RefPtr<InspectorObject> object = document->page()->inspectorController().buildObjectForHighlightedNode();
     return object ? object->toJSONString() : String();
 #else
     UNUSED_PARAM(ec);
@@ -1153,16 +1152,14 @@ PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, i
 void Internals::emitInspectorDidBeginFrame()
 {
 #if ENABLE(INSPECTOR)
-    InspectorController* inspectorController = contextDocument()->frame()->page()->inspectorController();
-    inspectorController->didBeginFrame();
+    contextDocument()->frame()->page()->inspectorController().didBeginFrame();
 #endif
 }
 
 void Internals::emitInspectorDidCancelFrame()
 {
 #if ENABLE(INSPECTOR)
-    InspectorController* inspectorController = contextDocument()->frame()->page()->inspectorController();
-    inspectorController->didCancelFrame();
+    contextDocument()->frame()->page()->inspectorController().didCancelFrame();
 #endif
 }
 
@@ -1450,13 +1447,13 @@ PassRefPtr<DOMWindow> Internals::openDummyInspectorFrontend(const String& url)
     Page* frontendPage = m_frontendWindow->document()->page();
     ASSERT(frontendPage);
 
-    OwnPtr<InspectorFrontendClientDummy> frontendClient = adoptPtr(new InspectorFrontendClientDummy(page->inspectorController(), frontendPage));
+    auto frontendClient = std::make_unique<InspectorFrontendClientDummy>(&page->inspectorController(), frontendPage);
 
-    frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient.release());
+    frontendPage->inspectorController().setInspectorFrontendClient(std::move(frontendClient));
 
     m_frontendChannel = adoptPtr(new InspectorFrontendChannelDummy(frontendPage));
 
-    page->inspectorController()->connectFrontend(m_frontendChannel.get());
+    page->inspectorController().connectFrontend(m_frontendChannel.get());
 
     return m_frontendWindow;
 }
@@ -1467,7 +1464,7 @@ void Internals::closeDummyInspectorFrontend()
     ASSERT(page);
     ASSERT(m_frontendWindow);
 
-    page->inspectorController()->disconnectFrontend();
+    page->inspectorController().disconnectFrontend();
 
     m_frontendChannel.release();
 
@@ -1478,22 +1475,22 @@ void Internals::closeDummyInspectorFrontend()
 void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode& ec)
 {
     Page* page = contextDocument()->frame()->page();
-    if (!page || !page->inspectorController()) {
+    if (!page) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
-    page->inspectorController()->setResourcesDataSizeLimitsFromInternals(maximumResourcesContentSize, maximumSingleResourceContentSize);
+    page->inspectorController().setResourcesDataSizeLimitsFromInternals(maximumResourcesContentSize, maximumSingleResourceContentSize);
 }
 
 void Internals::setJavaScriptProfilingEnabled(bool enabled, ExceptionCode& ec)
 {
     Page* page = contextDocument()->frame()->page();
-    if (!page || !page->inspectorController()) {
+    if (!page) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
 
-    page->inspectorController()->setProfilerEnabled(enabled);
+    page->inspectorController().setProfilerEnabled(enabled);
 }
 #endif // ENABLE(INSPECTOR)
 
index baeed73..2889236 100644 (file)
@@ -88,7 +88,7 @@ WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, st
     , m_script(adoptPtr(new WorkerScriptController(this)))
     , m_thread(thread)
 #if ENABLE(INSPECTOR)
-    , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this)))
+    , m_workerInspectorController(std::make_unique<WorkerInspectorController>(*this))
 #endif
     , m_closing(false)
     , m_eventQueue(*this)
@@ -192,13 +192,6 @@ void WorkerGlobalScope::clearTimeout(int timeoutId)
     DOMTimer::removeById(scriptExecutionContext(), timeoutId);
 }
 
-#if ENABLE(INSPECTOR)
-void WorkerGlobalScope::clearInspector()
-{
-    m_workerInspectorController.clear();
-}
-#endif
-
 int WorkerGlobalScope::setInterval(PassOwnPtr<ScheduledAction> action, int timeout)
 {
     return DOMTimer::install(scriptExecutionContext(), action, timeout, false);
index c3563d8..597122c 100644 (file)
@@ -73,9 +73,6 @@ namespace WebCore {
 
         WorkerScriptController* script() { return m_script.get(); }
         void clearScript() { m_script.clear(); }
-#if ENABLE(INSPECTOR)
-        void clearInspector();
-#endif
 
         WorkerThread* thread() const { return m_thread; }
 
@@ -106,7 +103,7 @@ namespace WebCore {
         virtual bool isJSExecutionForbidden() const override;
 
 #if ENABLE(INSPECTOR)
-        WorkerInspectorController* workerInspectorController() { return m_workerInspectorController.get(); }
+        WorkerInspectorController& workerInspectorController() { return *m_workerInspectorController; }
 #endif
         // These methods are used for GC marking. See JSWorkerGlobalScope::visitChildrenVirtual(SlotVisitor&) in
         // JSWorkerGlobalScopeCustom.cpp.
@@ -168,7 +165,7 @@ namespace WebCore {
         WorkerThread* m_thread;
 
 #if ENABLE(INSPECTOR)
-        OwnPtr<WorkerInspectorController> m_workerInspectorController;
+        const std::unique_ptr<WorkerInspectorController> m_workerInspectorController;
 #endif
         bool m_closing;
 
index 0196f02..d504ad2 100644 (file)
@@ -409,7 +409,7 @@ void WorkerMessagingProxy::workerObjectDestroyedInternal(ScriptExecutionContext*
 static void connectToWorkerGlobalScopeInspectorTask(ScriptExecutionContext* context, bool)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
-    static_cast<WorkerGlobalScope*>(context)->workerInspectorController()->connectFrontend();
+    static_cast<WorkerGlobalScope*>(context)->workerInspectorController().connectFrontend();
 }
 #endif
 
@@ -428,7 +428,7 @@ void WorkerMessagingProxy::connectToInspector(WorkerGlobalScopeProxy::PageInspec
 static void disconnectFromWorkerGlobalScopeInspectorTask(ScriptExecutionContext* context, bool)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
-    static_cast<WorkerGlobalScope*>(context)->workerInspectorController()->disconnectFrontend();
+    static_cast<WorkerGlobalScope*>(context)->workerInspectorController().disconnectFrontend();
 }
 #endif
 
@@ -446,7 +446,7 @@ void WorkerMessagingProxy::disconnectFromInspector()
 static void dispatchOnInspectorBackendTask(ScriptExecutionContext* context, const String& message)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
-    static_cast<WorkerGlobalScope*>(context)->workerInspectorController()->dispatchMessageFromFrontend(message);
+    static_cast<WorkerGlobalScope*>(context)->workerInspectorController().dispatchMessageFromFrontend(message);
 }
 #endif
 
index 7b48950..fca606e 100644 (file)
@@ -216,9 +216,6 @@ public:
     {
         ASSERT_WITH_SECURITY_IMPLICATION(context->isWorkerGlobalScope());
         WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(context);
-#if ENABLE(INSPECTOR)
-        workerGlobalScope->clearInspector();
-#endif
         // It's not safe to call clearScript until all the cleanup tasks posted by functions initiated by WorkerThreadShutdownStartTask have completed.
         workerGlobalScope->clearScript();
     }
index 645df4c..e85cc20 100644 (file)
@@ -1,3 +1,21 @@
+2014-01-18  Brian Burg  <bburg@apple.com>
+
+        Web Inspector: Page should use std::unique_ptr for InspectorController
+        https://bugs.webkit.org/show_bug.cgi?id=127068
+
+        Reviewed by Joseph Pecoraro.
+
+        Convert call sites to use a InspectorController reference.
+        Convert instantiations of InspectorFrontendClient to use std::unique_ptr.
+
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::evaluateInWebInspector):
+        * WebCoreSupport/InspectorClientEfl.cpp:
+        (WebCore::InspectorClientEfl::openInspectorFrontend):
+        * ewk/ewk_view.cpp:
+        (ewk_view_inspector_show):
+        (ewk_view_inspector_close):
+
 2014-01-17  Anders Carlsson  <andersca@apple.com>
 
         Remove another unused FrameLoaderClient callback
index 1a7a79c..9c56f87 100644 (file)
@@ -466,8 +466,7 @@ void DumpRenderTreeSupportEfl::evaluateInWebInspector(const Evas_Object* ewkView
 #if ENABLE(INSPECTOR)
     DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
-    if (page->inspectorController())
-        page->inspectorController()->evaluateForTestInFrontend(callId, script);
+    page->inspectorController().evaluateForTestInFrontend(callId, script);
 #else
     UNUSED_PARAM(ewkView);
     UNUSED_PARAM(callId);
index eaeb99f..ca18f96 100644 (file)
@@ -99,11 +99,11 @@ InspectorFrontendChannel* InspectorClientEfl::openInspectorFrontend(InspectorCon
     String inspectorUri = inspectorFilesPath() + "/Main.html";
     ewk_view_uri_set(m_inspectorView, inspectorUri.utf8().data());
 
-    OwnPtr<InspectorFrontendClientEfl> frontendClient = adoptPtr(new InspectorFrontendClientEfl(m_inspectedView, m_inspectorView, this));
+    auto frontendClient = std::make_unique<InspectorFrontendClientEfl>(m_inspectedView, m_inspectorView, this);
     m_frontendClient = frontendClient.get();
 
-    InspectorController* controller = EWKPrivate::corePage(m_inspectorView)->inspectorController();
-    controller->setInspectorFrontendClient(frontendClient.release());
+    InspectorController& controller = EWKPrivate::corePage(m_inspectorView)->inspectorController();
+    controller.setInspectorFrontendClient(std::move(frontendClient));
     
     return this;
 }
@@ -147,7 +147,7 @@ String InspectorClientEfl::inspectorFilesPath()
 }
 
 InspectorFrontendClientEfl::InspectorFrontendClientEfl(Evas_Object* inspectedView, Evas_Object* inspectorView, InspectorClientEfl* inspectorClient)
-    : InspectorFrontendClientLocal(EWKPrivate::corePage(inspectedView)->inspectorController(), EWKPrivate::corePage(inspectorView), adoptPtr(new InspectorFrontendSettingsEfl()))
+    : InspectorFrontendClientLocal(&EWKPrivate::corePage(inspectedView)->inspectorController(), EWKPrivate::corePage(inspectorView), adoptPtr(new InspectorFrontendSettingsEfl()))
     , m_inspectedView(inspectedView)
     , m_inspectorView(inspectorView)
     , m_inspectorClient(inspectorClient)
@@ -213,7 +213,7 @@ void InspectorFrontendClientEfl::setToolbarHeight(unsigned)
 void InspectorFrontendClientEfl::destroyInspectorWindow(bool notifyInspectorController)
 {
     if (notifyInspectorController)
-        EWKPrivate::corePage(m_inspectedView)->inspectorController()->disconnectFrontend();
+        EWKPrivate::corePage(m_inspectedView)->inspectorController().disconnectFrontend();
 
     if (m_inspectorClient)
         m_inspectorClient->releaseFrontendPage();
index 40474fb..839610d 100644 (file)
@@ -4662,7 +4662,7 @@ void ewk_view_inspector_show(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
 
-    priv->page->inspectorController()->show();
+    priv->page->inspectorController().show();
 #else
     UNUSED_PARAM(ewkView);
 #endif
@@ -4674,7 +4674,7 @@ void ewk_view_inspector_close(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
 
-    priv->page->inspectorController()->close();
+    priv->page->inspectorController().close();
 #else
     UNUSED_PARAM(ewkView);
 #endif
index 36de1c9..db97aea 100644 (file)
@@ -1,3 +1,26 @@
+2014-01-18  Brian Burg  <bburg@apple.com>
+
+        Web Inspector: Page should use std::unique_ptr for InspectorController
+        https://bugs.webkit.org/show_bug.cgi?id=127068
+
+        Reviewed by Joseph Pecoraro.
+
+        Convert call sites to use a InspectorController reference.
+        Convert instantiations of InspectorFrontendClient to use std::unique_ptr.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::paintWebView):
+        * WebCoreSupport/InspectorClientGtk.cpp:
+        (WebKit::InspectorClient::openInspectorFrontend):
+        * webkit/webkitwebinspector.cpp:
+        (webkit_web_inspector_set_property):
+        (webkit_web_inspector_get_property):
+        (webkit_web_inspector_show):
+        (webkit_web_inspector_inspect_node):
+        (webkit_web_inspector_inspect_coordinates):
+        (webkit_web_inspector_close):
+        (webkit_web_inspector_execute_script):
+
 2014-01-17  Anders Carlsson  <andersca@apple.com>
 
         Remove another unused FrameLoaderClient callback
index 49ca84d..0443135 100644 (file)
@@ -567,7 +567,7 @@ static void paintWebView(WebKitWebView* webView, Frame* frame, const Region& dir
 
     gc.save();
     gc.clip(dirtyRegion.bounds());
-    frame->page()->inspectorController()->drawHighlight(gc);
+    frame->page()->inspectorController().drawHighlight(gc);
     gc.restore();
 }
 
index 38c9b03..cdad8f7 100644 (file)
@@ -109,9 +109,9 @@ InspectorFrontendChannel* InspectorClient::openInspectorFrontend(InspectorContro
     gtk_widget_show(GTK_WIDGET(inspectorWebView));
 
     m_frontendPage = core(inspectorWebView);
-    OwnPtr<InspectorFrontendClient> frontendClient = adoptPtr(new InspectorFrontendClient(m_inspectedWebView, inspectorWebView, webInspector, m_frontendPage, this));
+    auto frontendClient = std::make_unique<InspectorFrontendClient>(m_inspectedWebView, inspectorWebView, webInspector, m_frontendPage, this);
     m_frontendClient = frontendClient.get();
-    m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient.release());
+    m_frontendPage->inspectorController().setInspectorFrontendClient(std::move(frontendClient));
 
     // The inspector must be in it's own PageGroup to avoid deadlock while debugging.
     m_frontendPage->setGroupName("");
@@ -156,7 +156,7 @@ bool InspectorClient::sendMessageToFrontend(const String& message)
 }
 
 InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage, InspectorClient* inspectorClient)
-    : InspectorFrontendClientLocal(core(inspectedWebView)->inspectorController(), inspectorPage, adoptPtr(new InspectorFrontendSettingsGtk()))
+    : InspectorFrontendClientLocal(&core(inspectedWebView)->inspectorController(), inspectorPage, adoptPtr(new InspectorFrontendSettingsGtk()))
     , m_inspectorWebView(inspectorWebView)
     , m_inspectedWebView(inspectedWebView)
     , m_webInspector(webInspector)
@@ -189,7 +189,7 @@ void InspectorFrontendClient::destroyInspectorWindow(bool notifyInspectorControl
     }
 
     if (notifyInspectorController)
-        core(m_inspectedWebView)->inspectorController()->disconnectFrontend();
+        core(m_inspectedWebView)->inspectorController().disconnectFrontend();
 
     if (m_inspectorClient)
         m_inspectorClient->releaseFrontendPage();
index 8a04446..e9a0891 100644 (file)
@@ -353,7 +353,7 @@ static void webkit_web_inspector_set_property(GObject* object, guint prop_id, co
     case PROP_JAVASCRIPT_PROFILING_ENABLED: {
 #if ENABLE(JAVASCRIPT_DEBUGGER)
         bool enabled = g_value_get_boolean(value);
-        priv->page->inspectorController()->setProfilerEnabled(enabled);
+        priv->page->inspectorController().setProfilerEnabled(enabled);
 #else
         g_message("PROP_JAVASCRIPT_PROFILING_ENABLED is not work because of the javascript debugger is disabled\n");
 #endif
@@ -383,7 +383,7 @@ static void webkit_web_inspector_get_property(GObject* object, guint prop_id, GV
         break;
     case PROP_JAVASCRIPT_PROFILING_ENABLED:
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-        g_value_set_boolean(value, priv->page->inspectorController()->profilerEnabled());
+        g_value_set_boolean(value, priv->page->inspectorController().profilerEnabled());
 #else
         g_message("PROP_JAVASCRIPT_PROFILING_ENABLED is not work because of the javascript debugger is disabled\n");
 #endif
@@ -491,7 +491,7 @@ void webkit_web_inspector_show(WebKitWebInspector* webInspector)
     if (!view)
         return;
 
-    priv->page->inspectorController()->show();
+    priv->page->inspectorController().show();
 }
 
 /**
@@ -508,7 +508,7 @@ void webkit_web_inspector_inspect_node(WebKitWebInspector* webInspector, WebKitD
     g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(webInspector));
     g_return_if_fail(WEBKIT_DOM_IS_NODE(node));
 
-    webInspector->priv->page->inspectorController()->inspect(core(node));
+    webInspector->priv->page->inspectorController().inspect(core(node));
 }
 
 /**
@@ -546,7 +546,7 @@ void webkit_web_inspector_inspect_coordinates(WebKitWebInspector* webInspector,
     HitTestResult result(documentPoint);
 
     frame.contentRenderer()->layer()->hitTest(request, result);
-    priv->page->inspectorController()->inspect(result.innerNonSharedNode());
+    priv->page->inspectorController().inspect(result.innerNonSharedNode());
 }
 
 /**
@@ -562,7 +562,7 @@ void webkit_web_inspector_close(WebKitWebInspector* webInspector)
     g_return_if_fail(WEBKIT_IS_WEB_INSPECTOR(webInspector));
 
     WebKitWebInspectorPrivate* priv = webInspector->priv;
-    priv->page->inspectorController()->close();
+    priv->page->inspectorController().close();
 }
 
 void webkit_web_inspector_execute_script(WebKitWebInspector* webInspector, long callId, const gchar* script)
@@ -571,5 +571,5 @@ void webkit_web_inspector_execute_script(WebKitWebInspector* webInspector, long
     g_return_if_fail(script);
 
     WebKitWebInspectorPrivate* priv = webInspector->priv;
-    priv->page->inspectorController()->evaluateForTestInFrontend(callId, script);
+    priv->page->inspectorController().evaluateForTestInFrontend(callId, script);
 }
index 68ab4fc..133ade1 100644 (file)
@@ -1,3 +1,25 @@
+2014-01-18  Brian Burg  <bburg@apple.com>
+
+        Web Inspector: Page should use std::unique_ptr for InspectorController
+        https://bugs.webkit.org/show_bug.cgi?id=127068
+
+        Reviewed by Joseph Pecoraro.
+
+        Convert call sites to use a InspectorController reference.
+        Convert instantiations of InspectorFrontendClient to use std::unique_ptr.
+
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorClient::openInspectorFrontend):
+        (-[WebInspectorWindowController destroyInspectorView:]):
+        * WebInspector/WebInspector.mm:
+        (-[WebInspector showWindow]):
+        (-[WebInspector isJavaScriptProfilingEnabled]):
+        (-[WebInspector setJavaScriptProfilingEnabled:]):
+        (-[WebInspector close:]):
+        (-[WebInspector evaluateInFrontend:callId:script:]):
+        * WebInspector/WebNodeHighlighter.mm:
+        (-[WebNodeHighlighter highlight]):
+
 2014-01-18  Anders Carlsson  <andersca@apple.com>
 
         Remove ENABLE_THREADED_HTML_PARSER defines everywhere
index a14c885..32a7270 100644 (file)
@@ -145,11 +145,11 @@ InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorCon
     [windowController.get() setInspectorClient:this];
 
     m_frontendPage = core([windowController.get() webView]);
-    OwnPtr<WebInspectorFrontendClient> frontendClient = adoptPtr(new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage, createFrontendSettings()));
+    auto frontendClient = std::make_unique<WebInspectorFrontendClient>(m_webView, windowController.get(), inspectorController, m_frontendPage, createFrontendSettings());
     m_frontendClient = frontendClient.get();
     RetainPtr<WebInspectorFrontend> webInspectorFrontend = adoptNS([[WebInspectorFrontend alloc] initWithFrontendClient:frontendClient.get()]);
     [[m_webView inspector] setFrontend:webInspectorFrontend.get()];
-    m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient.release());
+    m_frontendPage->inspectorController().setInspectorFrontendClient(std::move(frontendClient));
     return this;
 }
 
@@ -693,7 +693,7 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String
 
     if (notifyInspectorController) {
         if (Page* inspectedPage = [_inspectedWebView.get() page])
-            inspectedPage->inspectorController()->disconnectFrontend();
+            inspectedPage->inspectorController().disconnectFrontend();
     }
 
     RetainPtr<WebInspectorWindowController> protect(self);
index e31ba9c..e4e9aad 100644 (file)
@@ -66,7 +66,7 @@ NSString *WebInspectorDidStopSearchingForNode = @"WebInspectorDidStopSearchingFo
 - (void)showWindow
 {
     if (Page* page = core(_webView))
-        page->inspectorController()->show();
+        page->inspectorController().show();
 }
 
 - (void)show:(id)sender
@@ -142,7 +142,7 @@ NSString *WebInspectorDidStopSearchingForNode = @"WebInspectorDidStopSearchingFo
 - (BOOL)isJavaScriptProfilingEnabled
 {
     if (Page* page = core(_webView))
-        return page->inspectorController()->profilerEnabled();
+        return page->inspectorController().profilerEnabled();
     return NO;
 }
 
@@ -152,7 +152,7 @@ NSString *WebInspectorDidStopSearchingForNode = @"WebInspectorDidStopSearchingFo
     if (!page)
         return;
 
-    page->inspectorController()->setProfilerEnabled(enabled);
+    page->inspectorController().setProfilerEnabled(enabled);
 }
 
 - (BOOL)isTimelineProfilingEnabled
@@ -169,7 +169,7 @@ NSString *WebInspectorDidStopSearchingForNode = @"WebInspectorDidStopSearchingFo
 - (void)close:(id)sender 
 {
     if (Page* page = core(_webView))
-        page->inspectorController()->close();
+        page->inspectorController().close();
 }
 
 - (void)attach:(id)sender
@@ -185,7 +185,7 @@ NSString *WebInspectorDidStopSearchingForNode = @"WebInspectorDidStopSearchingFo
 - (void)evaluateInFrontend:(id)sender callId:(long)callId script:(NSString *)script
 {
     if (Page* page = core(_webView))
-        page->inspectorController()->evaluateForTestInFrontend(callId, script);
+        page->inspectorController().evaluateForTestInFrontend(callId, script);
 }
 
 - (void)setFrontend:(WebInspectorFrontend *)frontend
index 2ba59d6..d296f78 100644 (file)
@@ -66,7 +66,7 @@
         return; // Skip the highlight if we have no window (e.g. hidden tab).
     
     if (!_currentHighlight) {
-        _currentHighlight = [[WebNodeHighlight alloc] initWithTargetView:view inspectorController:[_inspectedWebView page]->inspectorController()];
+        _currentHighlight = [[WebNodeHighlight alloc] initWithTargetView:view inspectorController:&[_inspectedWebView page]->inspectorController()];
         [_currentHighlight setDelegate:self];
         [_currentHighlight attach];
     } else {
index f9d04e0..bb8a629 100644 (file)
@@ -1,3 +1,25 @@
+2014-01-18  Brian Burg  <bburg@apple.com>
+
+        Web Inspector: Page should use std::unique_ptr for InspectorController
+        https://bugs.webkit.org/show_bug.cgi?id=127068
+
+        Reviewed by Joseph Pecoraro.
+
+        Convert call sites to use a InspectorController reference.
+
+        * WebCoreSupport/WebInspectorClient.cpp:
+        (WebInspectorClient::openInspectorFrontend):
+        (WebInspectorFrontendClient::destroyInspectorView):
+        (WebInspectorFrontendClient::onClose):
+        * WebInspector.cpp:
+        (WebInspector::show):
+        (WebInspector::close):
+        (WebInspector::isJavaScriptProfilingEnabled):
+        (WebInspector::setJavaScriptProfilingEnabled):
+        (WebInspector::evaluateInFrontend):
+        * WebNodeHighlight.cpp:
+        (WebNodeHighlight::update):
+
 2014-01-17  Anders Carlsson  <andersca@apple.com>
 
         Clean up PageCache classes
index ef522a2..f22b709 100644 (file)
@@ -170,9 +170,9 @@ WebCore::InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(Ins
         return 0;
 
     m_frontendPage = core(frontendWebView.get());
-    OwnPtr<WebInspectorFrontendClient> frontendClient = adoptPtr(new WebInspectorFrontendClient(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this, createFrontendSettings()));
+    auto frontendClient = std::make_unique<WebInspectorFrontendClient>(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this, createFrontendSettings());
     m_frontendClient = frontendClient.get();
-    m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient.release());
+    m_frontendPage->inspectorController().setInspectorFrontendClient(std::move(frontendClient));
     m_frontendHwnd = frontendHwnd;
     return this;
 }
@@ -224,7 +224,7 @@ void WebInspectorClient::releaseFrontend()
 }
 
 WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, HWND inspectedWebViewHwnd, HWND frontendHwnd, const COMPtr<WebView>& frontendWebView, HWND frontendWebViewHwnd, WebInspectorClient* inspectorClient, PassOwnPtr<Settings> settings)
-    : InspectorFrontendClientLocal(inspectedWebView->page()->inspectorController(),  core(frontendWebView.get()), settings)
+    : InspectorFrontendClientLocal(&inspectedWebView->page()->inspectorController(),  core(frontendWebView.get()), settings)
     , m_inspectedWebView(inspectedWebView)
     , m_inspectedWebViewHwnd(inspectedWebViewHwnd)
     , m_inspectorClient(inspectorClient)
@@ -438,7 +438,7 @@ void WebInspectorFrontendClient::destroyInspectorView(bool notifyInspectorContro
     closeWindowWithoutNotifications();
 
     if (notifyInspectorController) {
-        m_inspectedWebView->page()->inspectorController()->disconnectFrontend();
+        m_inspectedWebView->page()->inspectorController().disconnectFrontend();
         m_inspectorClient->updateHighlight();
     }
     ::DestroyWindow(m_frontendHwnd);
@@ -472,7 +472,7 @@ LRESULT WebInspectorFrontendClient::onSize(WPARAM, LPARAM)
 LRESULT WebInspectorFrontendClient::onClose(WPARAM, LPARAM)
 {
     ::ShowWindow(m_frontendHwnd, SW_HIDE);
-    m_inspectedWebView->page()->inspectorController()->close();
+    m_inspectedWebView->page()->inspectorController().close();
 
     return 0;
 }
index 8bfa7e5..fd58fd6 100644 (file)
@@ -109,7 +109,7 @@ HRESULT STDMETHODCALLTYPE WebInspector::show()
 {
     if (m_webView)
         if (Page* page = m_webView->page())
-            page->inspectorController()->show();
+            page->inspectorController().show();
 
     return S_OK;
 }
@@ -131,7 +131,7 @@ HRESULT STDMETHODCALLTYPE WebInspector::close()
 {
     if (m_webView)
         if (Page* page = m_webView->page())
-            page->inspectorController()->close();
+            page->inspectorController().close();
 
     return S_OK;
 }
@@ -219,7 +219,7 @@ HRESULT STDMETHODCALLTYPE WebInspector::isJavaScriptProfilingEnabled(BOOL* isPro
     if (!page)
         return S_OK;
 
-    *isProfilingEnabled = page->inspectorController()->profilerEnabled();
+    *isProfilingEnabled = page->inspectorController().profilerEnabled();
     return S_OK;
 }
 
@@ -232,7 +232,7 @@ HRESULT STDMETHODCALLTYPE WebInspector::setJavaScriptProfilingEnabled(BOOL enabl
     if (!page)
         return S_OK;
 
-    page->inspectorController()->setProfilerEnabled(enabled);
+    page->inspectorController().setProfilerEnabled(enabled);
 
     return S_OK;
 }
@@ -247,7 +247,7 @@ HRESULT STDMETHODCALLTYPE  WebInspector::evaluateInFrontend(ULONG callId, BSTR b
         return S_OK;
 
     String script(bScript, SysStringLen(bScript));
-    page->inspectorController()->evaluateForTestInFrontend(callId, script);
+    page->inspectorController().evaluateForTestInFrontend(callId, script);
     return S_OK;
 }
 
index 057de5a..943e387 100644 (file)
@@ -165,8 +165,8 @@ void WebNodeHighlight::update()
 
     GraphicsContext context(hdc.get());
 #if ENABLE(INSPECTOR)
-    m_inspectedWebView->page()->inspectorController()->drawHighlight(context);
-#endif // ENABLE(INSPECTOR)
+    m_inspectedWebView->page()->inspectorController().drawHighlight(context);
+#endif
 
     BLENDFUNCTION bf;
     bf.BlendOp = AC_SRC_OVER;
index 041cd39..23047a1 100644 (file)
@@ -1,3 +1,36 @@
+2014-01-18  Brian Burg  <bburg@apple.com>
+
+        Web Inspector: Page should use std::unique_ptr for InspectorController
+        https://bugs.webkit.org/show_bug.cgi?id=127068
+
+        Reviewed by Joseph Pecoraro.
+
+        Convert call sites to use a InspectorController reference.
+
+        * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
+        (WebKit::WebInspectorClient::drawRect):
+        * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp:
+        (WebKit::WebInspectorFrontendClient::WebInspectorFrontendClient):
+        (WebKit::WebInspectorFrontendClient::closeWindow):
+        * WebProcess/WebPage/WebInspector.cpp:
+        (WebKit::WebInspector::createInspectorPage):
+        (WebKit::WebInspector::show):
+        (WebKit::WebInspector::close):
+        (WebKit::WebInspector::evaluateScriptForTest):
+        (WebKit::WebInspector::showConsole):
+        (WebKit::WebInspector::showResources):
+        (WebKit::WebInspector::showMainResourceForFrame):
+        (WebKit::WebInspector::startJavaScriptDebugging):
+        (WebKit::WebInspector::stopJavaScriptDebugging):
+        (WebKit::WebInspector::setJavaScriptProfilingEnabled):
+        (WebKit::WebInspector::startJavaScriptProfiling):
+        (WebKit::WebInspector::stopJavaScriptProfiling):
+        (WebKit::WebInspector::startPageProfiling):
+        (WebKit::WebInspector::stopPageProfiling):
+        (WebKit::WebInspector::dispatchMessageFromRemoteFrontend):
+        (WebKit::WebInspector::remoteFrontendConnected):
+        (WebKit::WebInspector::remoteFrontendDisconnected):
+
 2014-01-18  Anders Carlsson  <andersca@apple.com>
 
         Remove ENABLE_THREADED_HTML_PARSER defines everywhere
index 42fafe0..76e0b8d 100644 (file)
@@ -145,7 +145,7 @@ void WebInspectorClient::didMoveToWebPage(PageOverlay*, WebPage*)
 
 void WebInspectorClient::drawRect(PageOverlay*, WebCore::GraphicsContext& context, const WebCore::IntRect& /*dirtyRect*/)
 {
-    m_page->corePage()->inspectorController()->drawHighlight(context);
+    m_page->corePage()->inspectorController().drawHighlight(context);
 }
 
 bool WebInspectorClient::mouseEvent(PageOverlay*, const WebMouseEvent&)
index d1f51dd..058f0ff 100644 (file)
@@ -40,7 +40,7 @@ using namespace WebCore;
 namespace WebKit {
 
 WebInspectorFrontendClient::WebInspectorFrontendClient(WebPage* page, WebPage* inspectorPage)
-    : InspectorFrontendClientLocal(page->corePage()->inspectorController(), inspectorPage->corePage(), adoptPtr(new Settings()))
+    : InspectorFrontendClientLocal(&page->corePage()->inspectorController(), inspectorPage->corePage(), adoptPtr(new Settings()))
     , m_page(page)
 {
 }
@@ -57,7 +57,7 @@ void WebInspectorFrontendClient::bringToFront()
 
 void WebInspectorFrontendClient::closeWindow()
 {
-    m_page->corePage()->inspectorController()->disconnectFrontend();
+    m_page->corePage()->inspectorController().disconnectFrontend();
     m_page->inspector()->didClose();
 }
 
index 9c9ecb5..430522b 100644 (file)
@@ -89,9 +89,9 @@ WebPage* WebInspector::createInspectorPage()
     m_inspectorPage = WebProcess::shared().webPage(inspectorPageID);
     ASSERT(m_inspectorPage);
 
-    OwnPtr<WebInspectorFrontendClient> frontendClient = adoptPtr(new WebInspectorFrontendClient(m_page, m_inspectorPage));
+    auto frontendClient = std::make_unique<WebInspectorFrontendClient>(m_page, m_inspectorPage);
     m_frontendClient = frontendClient.get();
-    m_inspectorPage->corePage()->inspectorController()->setInspectorFrontendClient(frontendClient.release());
+    m_inspectorPage->corePage()->inspectorController().setInspectorFrontendClient(std::move(frontendClient));
     return m_inspectorPage;
 }
 
@@ -162,12 +162,12 @@ void WebInspector::setToolbarHeight(unsigned height)
 // Called by WebInspector messages
 void WebInspector::show()
 {
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
 }
 
 void WebInspector::close()
 {
-    m_page->corePage()->inspectorController()->close();
+    m_page->corePage()->inspectorController().close();
 }
 
 void WebInspector::didSave(const String& url)
@@ -202,19 +202,19 @@ void WebInspector::detached()
 
 void WebInspector::evaluateScriptForTest(long callID, const String& script)
 {
-    m_page->corePage()->inspectorController()->evaluateForTestInFrontend(callID, script);
+    m_page->corePage()->inspectorController().evaluateForTestInFrontend(callID, script);
 }
 
 void WebInspector::showConsole()
 {
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (m_frontendClient)
         m_frontendClient->showConsole();
 }
 
 void WebInspector::showResources()
 {
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (m_frontendClient)
         m_frontendClient->showResources();
 }
@@ -225,7 +225,7 @@ void WebInspector::showMainResourceForFrame(uint64_t frameID)
     if (!frame)
         return;
 
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (m_frontendClient)
         m_frontendClient->showMainResourceForFrame(frame->coreFrame());
 }
@@ -233,7 +233,7 @@ void WebInspector::showMainResourceForFrame(uint64_t frameID)
 void WebInspector::startJavaScriptDebugging()
 {
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (m_frontendClient)
         m_frontendClient->setDebuggingEnabled(true);
 #endif
@@ -242,7 +242,7 @@ void WebInspector::startJavaScriptDebugging()
 void WebInspector::stopJavaScriptDebugging()
 {
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (m_frontendClient)
         m_frontendClient->setDebuggingEnabled(false);
 #endif
@@ -251,18 +251,18 @@ void WebInspector::stopJavaScriptDebugging()
 void WebInspector::setJavaScriptProfilingEnabled(bool enabled)
 {
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (!m_frontendClient)
         return;
 
-    m_page->corePage()->inspectorController()->setProfilerEnabled(enabled);
+    m_page->corePage()->inspectorController().setProfilerEnabled(enabled);
 #endif
 }
 
 void WebInspector::startJavaScriptProfiling()
 {
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (m_frontendClient)
         m_frontendClient->startProfilingJavaScript();
 #endif
@@ -271,7 +271,7 @@ void WebInspector::startJavaScriptProfiling()
 void WebInspector::stopJavaScriptProfiling()
 {
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (m_frontendClient)
         m_frontendClient->stopProfilingJavaScript();
 #endif
@@ -279,14 +279,14 @@ void WebInspector::stopJavaScriptProfiling()
 
 void WebInspector::startPageProfiling()
 {
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (m_frontendClient)
         m_frontendClient->setTimelineProfilingEnabled(true);
 }
 
 void WebInspector::stopPageProfiling()
 {
-    m_page->corePage()->inspectorController()->show();
+    m_page->corePage()->inspectorController().show();
     if (m_frontendClient)
         m_frontendClient->setTimelineProfilingEnabled(false);
 }
@@ -310,7 +310,7 @@ void WebInspector::sendMessageToRemoteFrontend(const String& message)
 
 void WebInspector::dispatchMessageFromRemoteFrontend(const String& message)
 {
-    m_page->corePage()->inspectorController()->dispatchMessageFromFrontend(message);
+    m_page->corePage()->inspectorController().dispatchMessageFromFrontend(message);
 }
 
 void WebInspector::remoteFrontendConnected()
@@ -319,14 +319,14 @@ void WebInspector::remoteFrontendConnected()
     // Switching between in-process and remote inspectors isn't supported yet.
     ASSERT(!m_inspectorPage);
     
-    m_page->corePage()->inspectorController()->connectFrontend(m_frontendChannel);
+    m_page->corePage()->inspectorController().connectFrontend(m_frontendChannel);
     m_remoteFrontendConnected = true;
 }
 
 void WebInspector::remoteFrontendDisconnected()
 {
     ASSERT(m_remoteFrontendConnected);
-    m_page->corePage()->inspectorController()->disconnectFrontend();
+    m_page->corePage()->inspectorController().disconnectFrontend();
     m_remoteFrontendConnected = false;
 }
 #endif