Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect...
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 23:56:07 +0000 (23:56 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 23:56:07 +0000 (23:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191612

Reviewed by Matt Baker.

Source/JavaScriptCore:

* inspector/InspectorFrontendRouter.cpp:
(Inspector::FrontendRouter::connectFrontend):
(Inspector::FrontendRouter::disconnectFrontend):
* inspector/InspectorFrontendRouter.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::connectFrontend):
(Inspector::JSGlobalObjectInspectorController::disconnectFrontend):
* inspector/JSGlobalObjectInspectorController.h:
* inspector/remote/RemoteControllableTarget.h:
* inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm:
(Inspector::RemoteConnectionToTarget::setup):
(Inspector::RemoteConnectionToTarget::close):
* inspector/remote/glib/RemoteConnectionToTargetGlib.cpp:
(Inspector::RemoteConnectionToTarget::setup):
(Inspector::RemoteConnectionToTarget::close):
* runtime/JSGlobalObjectDebuggable.cpp:
(JSC::JSGlobalObjectDebuggable::connect):
(JSC::JSGlobalObjectDebuggable::disconnect):
* runtime/JSGlobalObjectDebuggable.h:

Source/WebCore:

* inspector/InspectorController.cpp:
(WebCore::InspectorController::connectFrontend):
(WebCore::InspectorController::disconnectFrontend):
(WebCore::InspectorController::show):
* inspector/InspectorController.h:
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::connectFrontend):
(WebCore::WorkerInspectorController::disconnectFrontend):
* page/PageDebuggable.cpp:
(WebCore::PageDebuggable::connect):
(WebCore::PageDebuggable::disconnect):
* page/PageDebuggable.h:
* testing/Internals.cpp:
(WebCore::InspectorStubFrontend::InspectorStubFrontend):
(WebCore::InspectorStubFrontend::closeWindow):
* workers/service/context/ServiceWorkerDebuggable.cpp:
(WebCore::ServiceWorkerDebuggable::connect):
(WebCore::ServiceWorkerDebuggable::disconnect):
* workers/service/context/ServiceWorkerDebuggable.h:
* workers/service/context/ServiceWorkerInspectorProxy.cpp:
(WebCore::ServiceWorkerInspectorProxy::connectToWorker):
(WebCore::ServiceWorkerInspectorProxy::disconnectFromWorker):
* workers/service/context/ServiceWorkerInspectorProxy.h:

Source/WebKit:

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::connect):
(WebKit::WebAutomationSession::disconnect):
(WebKit::WebAutomationSession::terminate):
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/WebPageDebuggable.cpp:
(WebKit::WebPageDebuggable::connect):
(WebKit::WebPageDebuggable::disconnect):
* UIProcess/WebPageDebuggable.h:
* UIProcess/WebPageInspectorController.cpp:
(WebKit::WebPageInspectorController::connectFrontend):
(WebKit::WebPageInspectorController::disconnectFrontend):
* UIProcess/WebPageInspectorController.h:
* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::close):
* WebProcess/WebPage/WebPageInspectorTarget.cpp:
(WebKit::WebPageInspectorTarget::connect):
(WebKit::WebPageInspectorTarget::disconnect):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebInspectorClient.mm:
(-[WebInspectorWindowController destroyInspectorView]):

Source/WebKitLegacy/win:

* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorFrontendClient::destroyInspectorView):

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

34 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp
Source/JavaScriptCore/inspector/InspectorFrontendRouter.h
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h
Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h
Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm
Source/JavaScriptCore/inspector/remote/glib/RemoteConnectionToTargetGlib.cpp
Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp
Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/page/PageDebuggable.cpp
Source/WebCore/page/PageDebuggable.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/workers/service/context/ServiceWorkerDebuggable.cpp
Source/WebCore/workers/service/context/ServiceWorkerDebuggable.h
Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.cpp
Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit/UIProcess/Automation/WebAutomationSession.h
Source/WebKit/UIProcess/WebPageDebuggable.cpp
Source/WebKit/UIProcess/WebPageDebuggable.h
Source/WebKit/UIProcess/WebPageInspectorController.cpp
Source/WebKit/UIProcess/WebPageInspectorController.h
Source/WebKit/WebProcess/WebPage/WebInspector.cpp
Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.cpp

index 068fa03..a6b6883 100644 (file)
@@ -1,5 +1,32 @@
 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
+        https://bugs.webkit.org/show_bug.cgi?id=191612
+
+        Reviewed by Matt Baker.
+
+        * inspector/InspectorFrontendRouter.cpp:
+        (Inspector::FrontendRouter::connectFrontend):
+        (Inspector::FrontendRouter::disconnectFrontend):
+        * inspector/InspectorFrontendRouter.h:
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::connectFrontend):
+        (Inspector::JSGlobalObjectInspectorController::disconnectFrontend):
+        * inspector/JSGlobalObjectInspectorController.h:
+        * inspector/remote/RemoteControllableTarget.h:
+        * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm:
+        (Inspector::RemoteConnectionToTarget::setup):
+        (Inspector::RemoteConnectionToTarget::close):
+        * inspector/remote/glib/RemoteConnectionToTargetGlib.cpp:
+        (Inspector::RemoteConnectionToTarget::setup):
+        (Inspector::RemoteConnectionToTarget::close):
+        * runtime/JSGlobalObjectDebuggable.cpp:
+        (JSC::JSGlobalObjectDebuggable::connect):
+        (JSC::JSGlobalObjectDebuggable::disconnect):
+        * runtime/JSGlobalObjectDebuggable.h:
+
+2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Remote Inspector)
         https://bugs.webkit.org/show_bug.cgi?id=191494
         <rdar://problem/45469854>
index 65f8525..d408d36 100644 (file)
@@ -36,28 +36,24 @@ Ref<FrontendRouter> FrontendRouter::create()
     return adoptRef(*new FrontendRouter);
 }
 
-void FrontendRouter::connectFrontend(FrontendChannel* connection)
+void FrontendRouter::connectFrontend(FrontendChannel& connection)
 {
-    ASSERT_ARG(connection, connection);
-
-    if (m_connections.contains(connection)) {
+    if (m_connections.contains(&connection)) {
         ASSERT_NOT_REACHED();
         return;
     }
 
-    m_connections.append(connection);
+    m_connections.append(&connection);
 }
 
-void FrontendRouter::disconnectFrontend(FrontendChannel* connection)
+void FrontendRouter::disconnectFrontend(FrontendChannel& connection)
 {
-    ASSERT_ARG(connection, connection);
-
-    if (!m_connections.contains(connection)) {
+    if (!m_connections.contains(&connection)) {
         ASSERT_NOT_REACHED();
         return;
     }
 
-    m_connections.removeFirst(connection);
+    m_connections.removeFirst(&connection);
 }
 
 void FrontendRouter::disconnectAllFrontends()
index ee65b2f..3d3c045 100644 (file)
@@ -43,8 +43,8 @@ public:
 
     unsigned frontendCount() const { return m_connections.size(); }
 
-    void connectFrontend(FrontendChannel*);
-    void disconnectFrontend(FrontendChannel*);
+    void connectFrontend(FrontendChannel&);
+    void disconnectFrontend(FrontendChannel&);
     void disconnectAllFrontends();
 
     void sendEvent(const String& message) const;
index d4d7aa1..ad45f6f 100644 (file)
@@ -119,10 +119,8 @@ void JSGlobalObjectInspectorController::globalObjectDestroyed()
     m_agents.discardValues();
 }
 
-void JSGlobalObjectInspectorController::connectFrontend(FrontendChannel* frontendChannel, bool isAutomaticInspection, bool immediatelyPause)
+void JSGlobalObjectInspectorController::connectFrontend(FrontendChannel& frontendChannel, bool isAutomaticInspection, bool immediatelyPause)
 {
-    ASSERT_ARG(frontendChannel, frontendChannel);
-
     m_isAutomaticInspection = isAutomaticInspection;
     m_pauseAfterInitialization = immediatelyPause;
 
@@ -147,10 +145,8 @@ void JSGlobalObjectInspectorController::connectFrontend(FrontendChannel* fronten
 #endif
 }
 
-void JSGlobalObjectInspectorController::disconnectFrontend(FrontendChannel* frontendChannel)
+void JSGlobalObjectInspectorController::disconnectFrontend(FrontendChannel& frontendChannel)
 {
-    ASSERT_ARG(frontendChannel, frontendChannel);
-
     // FIXME: change this to notify agents which frontend has disconnected (by id).
     m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectorDestroyed);
 
index 8fb6cbb..c2188d8 100644 (file)
@@ -68,8 +68,8 @@ public:
     JSGlobalObjectInspectorController(JSC::JSGlobalObject&);
     ~JSGlobalObjectInspectorController();
 
-    void connectFrontend(FrontendChannel*, bool isAutomaticInspection, bool immediatelyPause);
-    void disconnectFrontend(FrontendChannel*);
+    void connectFrontend(FrontendChannel&, bool isAutomaticInspection, bool immediatelyPause);
+    void disconnectFrontend(FrontendChannel&);
 
     void dispatchMessageFromFrontend(const String&);
 
index 8ab6d76..4bbb6a4 100644 (file)
@@ -45,8 +45,8 @@ public:
     void init();
     void update();
 
-    virtual void connect(FrontendChannel*, bool isAutomaticConnection = false, bool immediatelyPause = false) = 0;
-    virtual void disconnect(FrontendChannel*) = 0;
+    virtual void connect(FrontendChannel&, bool isAutomaticConnection = false, bool immediatelyPause = false) = 0;
+    virtual void disconnect(FrontendChannel&) = 0;
 
     unsigned targetIdentifier() const { return m_identifier; }
     void setTargetIdentifier(unsigned identifier) { m_identifier = identifier; }
index 09b5f6a..4a34269 100644 (file)
@@ -171,13 +171,13 @@ bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automatica
                 m_target = nullptr;
             } else if (is<RemoteInspectionTarget>(m_target)) {
                 auto castedTarget = downcast<RemoteInspectionTarget>(m_target);
-                castedTarget->connect(this, isAutomaticInspection, automaticallyPause);
+                castedTarget->connect(*this, isAutomaticInspection, automaticallyPause);
                 m_connected = true;
 
                 RemoteInspector::singleton().updateTargetListing(targetIdentifier);
             } else if (is<RemoteAutomationTarget>(m_target)) {
                 auto castedTarget = downcast<RemoteAutomationTarget>(m_target);
-                castedTarget->connect(this);
+                castedTarget->connect(*this);
                 m_connected = true;
 
                 RemoteInspector::singleton().updateTargetListing(targetIdentifier);
@@ -206,7 +206,7 @@ void RemoteConnectionToTarget::close()
             std::lock_guard<Lock> lock(m_targetMutex);
             if (m_target) {
                 if (m_connected)
-                    m_target->disconnect(this);
+                    m_target->disconnect(*this);
 
                 m_target = nullptr;
                 
index c66b559..13e3930 100644 (file)
@@ -56,13 +56,13 @@ bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automatica
         m_target = nullptr;
     } else if (is<RemoteInspectionTarget>(m_target)) {
         auto target = downcast<RemoteInspectionTarget>(m_target);
-        target->connect(this, isAutomaticInspection, automaticallyPause);
+        target->connect(*this, isAutomaticInspection, automaticallyPause);
         m_connected = true;
 
         RemoteInspector::singleton().updateTargetListing(targetIdentifier);
     } else if (is<RemoteAutomationTarget>(m_target)) {
         auto target = downcast<RemoteAutomationTarget>(m_target);
-        target->connect(this);
+        target->connect(*this);
         m_connected = true;
 
         RemoteInspector::singleton().updateTargetListing(targetIdentifier);
@@ -93,7 +93,7 @@ void RemoteConnectionToTarget::close()
     unsigned targetIdentifier = m_target->targetIdentifier();
 
     if (m_connected)
-        m_target->disconnect(this);
+        m_target->disconnect(*this);
 
     m_target = nullptr;
 
index f05360c..37d3c28 100644 (file)
@@ -50,14 +50,14 @@ String JSGlobalObjectDebuggable::name() const
     return name.isEmpty() ? "JSContext"_s : name;
 }
 
-void JSGlobalObjectDebuggable::connect(FrontendChannel* frontendChannel, bool automaticInspection, bool immediatelyPause)
+void JSGlobalObjectDebuggable::connect(FrontendChannel& frontendChannel, bool automaticInspection, bool immediatelyPause)
 {
     JSLockHolder locker(&m_globalObject.vm());
 
     m_globalObject.inspectorController().connectFrontend(frontendChannel, automaticInspection, immediatelyPause);
 }
 
-void JSGlobalObjectDebuggable::disconnect(FrontendChannel* frontendChannel)
+void JSGlobalObjectDebuggable::disconnect(FrontendChannel& frontendChannel)
 {
     JSLockHolder locker(&m_globalObject.vm());
 
index 0579909..7cbc0c2 100644 (file)
@@ -51,8 +51,8 @@ public:
     String name() const final;
     bool hasLocalDebugger() const final { return false; }
 
-    void connect(Inspector::FrontendChannel*, bool isAutomaticConnection = false, bool immediatelyPause = false) final;
-    void disconnect(Inspector::FrontendChannel*) final;
+    void connect(Inspector::FrontendChannel&, bool isAutomaticConnection = false, bool immediatelyPause = false) final;
+    void disconnect(Inspector::FrontendChannel&) final;
     void dispatchMessageFromRemote(const String& message) final;
 
     bool automaticInspectionAllowed() const final { return true; }
index 262e979..7b0b090 100644 (file)
@@ -1,3 +1,34 @@
+2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
+        https://bugs.webkit.org/show_bug.cgi?id=191612
+
+        Reviewed by Matt Baker.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::connectFrontend):
+        (WebCore::InspectorController::disconnectFrontend):
+        (WebCore::InspectorController::show):
+        * inspector/InspectorController.h:
+        * inspector/WorkerInspectorController.cpp:
+        (WebCore::WorkerInspectorController::connectFrontend):
+        (WebCore::WorkerInspectorController::disconnectFrontend):
+        * page/PageDebuggable.cpp:
+        (WebCore::PageDebuggable::connect):
+        (WebCore::PageDebuggable::disconnect):
+        * page/PageDebuggable.h:
+        * testing/Internals.cpp:
+        (WebCore::InspectorStubFrontend::InspectorStubFrontend):
+        (WebCore::InspectorStubFrontend::closeWindow):
+        * workers/service/context/ServiceWorkerDebuggable.cpp:
+        (WebCore::ServiceWorkerDebuggable::connect):
+        (WebCore::ServiceWorkerDebuggable::disconnect):
+        * workers/service/context/ServiceWorkerDebuggable.h:
+        * workers/service/context/ServiceWorkerInspectorProxy.cpp:
+        (WebCore::ServiceWorkerInspectorProxy::connectToWorker):
+        (WebCore::ServiceWorkerInspectorProxy::disconnectFromWorker):
+        * workers/service/context/ServiceWorkerInspectorProxy.h:
+
 2018-11-14  Timothy Hatcher  <timothy@apple.com>
 
         Update prefers-color-scheme media query matching based on GitHub issue #3278.
index e6d4b02..44aa81b 100644 (file)
@@ -254,9 +254,8 @@ void InspectorController::didClearWindowObjectInWorld(Frame& frame, DOMWrapperWo
         m_inspectorFrontendClient->windowObjectCleared();
 }
 
-void InspectorController::connectFrontend(Inspector::FrontendChannel* frontendChannel, bool isAutomaticInspection, bool immediatelyPause)
+void InspectorController::connectFrontend(Inspector::FrontendChannel& frontendChannel, bool isAutomaticInspection, bool immediatelyPause)
 {
-    ASSERT_ARG(frontendChannel, frontendChannel);
     ASSERT(m_inspectorClient);
 
     // If a frontend has connected enable the developer extras and keep them enabled.
@@ -285,7 +284,7 @@ void InspectorController::connectFrontend(Inspector::FrontendChannel* frontendCh
 #endif
 }
 
-void InspectorController::disconnectFrontend(FrontendChannel* frontendChannel)
+void InspectorController::disconnectFrontend(FrontendChannel& frontendChannel)
 {
     m_frontendRouter->disconnectFrontend(frontendChannel);
 
@@ -362,7 +361,7 @@ void InspectorController::show()
     if (m_frontendRouter->hasLocalFrontend())
         m_inspectorClient->bringFrontendToFront();
     else if (Inspector::FrontendChannel* frontendChannel = m_inspectorClient->openLocalFrontend(this))
-        connectFrontend(frontendChannel);
+        connectFrontend(*frontendChannel);
 }
 
 void InspectorController::setIsUnderTest(bool value)
index 9fdd3b7..492fc8a 100644 (file)
@@ -91,8 +91,8 @@ public:
     bool hasLocalFrontend() const;
     bool hasRemoteFrontend() const;
 
-    WEBCORE_EXPORT void connectFrontend(Inspector::FrontendChannel*, bool isAutomaticInspection = false, bool immediatelyPause = false);
-    WEBCORE_EXPORT void disconnectFrontend(Inspector::FrontendChannel*);
+    WEBCORE_EXPORT void connectFrontend(Inspector::FrontendChannel&, bool isAutomaticInspection = false, bool immediatelyPause = false);
+    WEBCORE_EXPORT void disconnectFrontend(Inspector::FrontendChannel&);
     WEBCORE_EXPORT void disconnectAllFrontends();
 
     void inspect(Node*);
index e5c7458..d2c023f 100644 (file)
@@ -114,7 +114,7 @@ void WorkerInspectorController::connectFrontend()
     m_executionStopwatch->start();
 
     m_forwardingChannel = std::make_unique<WorkerToPageFrontendChannel>(m_workerGlobalScope);
-    m_frontendRouter->connectFrontend(m_forwardingChannel.get());
+    m_frontendRouter->connectFrontend(*m_forwardingChannel.get());
     m_agents.didCreateFrontendAndBackend(&m_frontendRouter.get(), &m_backendDispatcher.get());
 }
 
@@ -130,7 +130,7 @@ void WorkerInspectorController::disconnectFrontend(Inspector::DisconnectReason r
     });
 
     m_agents.willDestroyFrontendAndBackend(reason);
-    m_frontendRouter->disconnectFrontend(m_forwardingChannel.get());
+    m_frontendRouter->disconnectFrontend(*m_forwardingChannel.get());
     m_forwardingChannel = nullptr;
 }
 
index 32e4cb7..d9cde4f 100644 (file)
@@ -69,16 +69,14 @@ bool PageDebuggable::hasLocalDebugger() const
     return m_page.inspectorController().hasLocalFrontend();
 }
 
-void PageDebuggable::connect(Inspector::FrontendChannel* channel, bool isAutomaticConnection, bool immediatelyPause)
+void PageDebuggable::connect(FrontendChannel& channel, bool isAutomaticConnection, bool immediatelyPause)
 {
-    InspectorController& inspectorController = m_page.inspectorController();
-    inspectorController.connectFrontend(channel, isAutomaticConnection, immediatelyPause);
+    m_page.inspectorController().connectFrontend(channel, isAutomaticConnection, immediatelyPause);
 }
 
-void PageDebuggable::disconnect(Inspector::FrontendChannel* channel)
+void PageDebuggable::disconnect(FrontendChannel& channel)
 {
-    InspectorController& inspectorController = m_page.inspectorController();
-    inspectorController.disconnectFrontend(channel);
+    m_page.inspectorController().disconnectFrontend(channel);
 }
 
 void PageDebuggable::dispatchMessageFromRemote(const String& message)
index 100929b..5cb0511 100644 (file)
@@ -47,8 +47,8 @@ public:
     String url() const final;
     bool hasLocalDebugger() const final;
 
-    void connect(Inspector::FrontendChannel*, bool isAutomaticConnection = false, bool immediatelyPause = false) final;
-    void disconnect(Inspector::FrontendChannel*) final;
+    void connect(Inspector::FrontendChannel&, bool isAutomaticConnection = false, bool immediatelyPause = false) final;
+    void disconnect(Inspector::FrontendChannel&) final;
     void dispatchMessageFromRemote(const String& message) final;
     void setIndicating(bool) final;
 
index 8a32051..9c9b4fe 100644 (file)
@@ -335,7 +335,7 @@ InspectorStubFrontend::InspectorStubFrontend(Page& inspectedPage, RefPtr<DOMWind
     ASSERT_ARG(frontendWindow, frontendWindow);
 
     m_frontendController.setInspectorFrontendClient(this);
-    inspectedPage.inspectorController().connectFrontend(this);
+    inspectedPage.inspectorController().connectFrontend(*this);
 }
 
 InspectorStubFrontend::~InspectorStubFrontend()
@@ -349,7 +349,7 @@ void InspectorStubFrontend::closeWindow()
         return;
 
     m_frontendController.setInspectorFrontendClient(nullptr);
-    inspectedPage()->inspectorController().disconnectFrontend(this);
+    inspectedPage()->inspectorController().disconnectFrontend(*this);
 
     m_frontendWindow->close();
     m_frontendWindow = nullptr;
index 551e39a..9a3832a 100644 (file)
@@ -42,12 +42,12 @@ ServiceWorkerDebuggable::ServiceWorkerDebuggable(ServiceWorkerThreadProxy& servi
 {
 }
 
-void ServiceWorkerDebuggable::connect(Inspector::FrontendChannel* channel, bool, bool)
+void ServiceWorkerDebuggable::connect(FrontendChannel& channel, bool, bool)
 {
     m_serviceWorkerThreadProxy.inspectorProxy().connectToWorker(channel);
 }
 
-void ServiceWorkerDebuggable::disconnect(Inspector::FrontendChannel* channel)
+void ServiceWorkerDebuggable::disconnect(FrontendChannel& channel)
 {
     m_serviceWorkerThreadProxy.inspectorProxy().disconnectFromWorker(channel);
 }
index 4bcd071..59bfc3c 100644 (file)
@@ -49,8 +49,8 @@ public:
     String url() const final { return m_scopeURL; }
     bool hasLocalDebugger() const final { return false; }
 
-    void connect(Inspector::FrontendChannel*, bool isAutomaticConnection = false, bool immediatelyPause = false) final;
-    void disconnect(Inspector::FrontendChannel*) final;
+    void connect(Inspector::FrontendChannel&, bool isAutomaticConnection = false, bool immediatelyPause = false) final;
+    void disconnect(Inspector::FrontendChannel&) final;
     void dispatchMessageFromRemote(const String& message) final;
 
 private:
index 63c72e5..5f0f1ee 100644 (file)
@@ -57,18 +57,18 @@ void ServiceWorkerInspectorProxy::serviceWorkerTerminated()
     m_channel = nullptr;
 }
 
-void ServiceWorkerInspectorProxy::connectToWorker(FrontendChannel* channel)
+void ServiceWorkerInspectorProxy::connectToWorker(FrontendChannel& channel)
 {
-    m_channel = channel;
+    m_channel = &channel;
 
     m_serviceWorkerThreadProxy.thread().runLoop().postTaskForMode([] (ScriptExecutionContext& context) {
         downcast<WorkerGlobalScope>(context).inspectorController().connectFrontend();
     }, WorkerRunLoop::debuggerMode());
 }
 
-void ServiceWorkerInspectorProxy::disconnectFromWorker(FrontendChannel* channel)
+void ServiceWorkerInspectorProxy::disconnectFromWorker(FrontendChannel& channel)
 {
-    ASSERT_UNUSED(channel, channel == m_channel);
+    ASSERT_UNUSED(channel, &channel == m_channel);
     m_channel = nullptr;
 
     m_serviceWorkerThreadProxy.thread().runLoop().postTaskForMode([] (ScriptExecutionContext& context) {
index 0c7ebcd..6aa874e 100644 (file)
@@ -49,8 +49,8 @@ public:
 
     void serviceWorkerTerminated();
 
-    void connectToWorker(Inspector::FrontendChannel*);
-    void disconnectFromWorker(Inspector::FrontendChannel*);
+    void connectToWorker(Inspector::FrontendChannel&);
+    void disconnectFromWorker(Inspector::FrontendChannel&);
     void sendMessageToWorker(const String&);
     void sendMessageFromWorkerToFrontend(const String&);
 
index aae4a60..d66e5f2 100644 (file)
@@ -1,5 +1,31 @@
 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
+        https://bugs.webkit.org/show_bug.cgi?id=191612
+
+        Reviewed by Matt Baker.
+
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::connect):
+        (WebKit::WebAutomationSession::disconnect):
+        (WebKit::WebAutomationSession::terminate):
+        * UIProcess/Automation/WebAutomationSession.h:
+        * UIProcess/WebPageDebuggable.cpp:
+        (WebKit::WebPageDebuggable::connect):
+        (WebKit::WebPageDebuggable::disconnect):
+        * UIProcess/WebPageDebuggable.h:
+        * UIProcess/WebPageInspectorController.cpp:
+        (WebKit::WebPageInspectorController::connectFrontend):
+        (WebKit::WebPageInspectorController::disconnectFrontend):
+        * UIProcess/WebPageInspectorController.h:
+        * WebProcess/WebPage/WebInspector.cpp:
+        (WebKit::WebInspector::close):
+        * WebProcess/WebPage/WebPageInspectorTarget.cpp:
+        (WebKit::WebPageInspectorTarget::connect):
+        (WebKit::WebPageInspectorTarget::disconnect):
+
+2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
+
         Unreviewed attempted wincairo build fix after 238192.
 
         * WebProcess/WebPage/WebPageInspectorTargetController.h:
index a7b1831..bba73da 100644 (file)
@@ -118,20 +118,20 @@ void WebAutomationSession::dispatchMessageFromRemote(const String& message)
     m_backendDispatcher->dispatch(message);
 }
 
-void WebAutomationSession::connect(Inspector::FrontendChannel* channel, bool isAutomaticConnection, bool immediatelyPause)
+void WebAutomationSession::connect(Inspector::FrontendChannel& channel, bool isAutomaticConnection, bool immediatelyPause)
 {
     UNUSED_PARAM(isAutomaticConnection);
     UNUSED_PARAM(immediatelyPause);
 
-    m_remoteChannel = channel;
+    m_remoteChannel = &channel;
     m_frontendRouter->connectFrontend(channel);
 
     setIsPaired(true);
 }
 
-void WebAutomationSession::disconnect(Inspector::FrontendChannel* channel)
+void WebAutomationSession::disconnect(Inspector::FrontendChannel& channel)
 {
-    ASSERT(channel == m_remoteChannel);
+    ASSERT(&channel == m_remoteChannel);
     terminate();
 }
 
@@ -152,7 +152,7 @@ void WebAutomationSession::terminate()
 #if ENABLE(REMOTE_INSPECTOR)
     if (Inspector::FrontendChannel* channel = m_remoteChannel) {
         m_remoteChannel = nullptr;
-        m_frontendRouter->disconnectFrontend(channel);
+        m_frontendRouter->disconnectFrontend(*channel);
     }
 
     setIsPaired(false);
index 5b20157..c700045 100644 (file)
@@ -130,8 +130,8 @@ public:
     // Inspector::RemoteAutomationTarget API
     String name() const override { return m_sessionIdentifier; }
     void dispatchMessageFromRemote(const String& message) override;
-    void connect(Inspector::FrontendChannel*, bool isAutomaticConnection = false, bool immediatelyPause = false) override;
-    void disconnect(Inspector::FrontendChannel*) override;
+    void connect(Inspector::FrontendChannel&, bool isAutomaticConnection = false, bool immediatelyPause = false) override;
+    void disconnect(Inspector::FrontendChannel&) override;
 #endif
     void terminate();
 
index f32c8da..166417b 100644 (file)
@@ -66,12 +66,12 @@ bool WebPageDebuggable::hasLocalDebugger() const
     return m_page.inspectorController().hasLocalFrontend();
 }
 
-void WebPageDebuggable::connect(Inspector::FrontendChannel* channel, bool isAutomaticConnection, bool immediatelyPause)
+void WebPageDebuggable::connect(FrontendChannel& channel, bool isAutomaticConnection, bool immediatelyPause)
 {
     m_page.inspectorController().connectFrontend(channel, isAutomaticConnection, immediatelyPause);
 }
 
-void WebPageDebuggable::disconnect(Inspector::FrontendChannel* channel)
+void WebPageDebuggable::disconnect(FrontendChannel& channel)
 {
     m_page.inspectorController().disconnectFrontend(channel);
 }
index ab214bd..9f8df70 100644 (file)
@@ -47,8 +47,8 @@ public:
     String url() const final;
     bool hasLocalDebugger() const final;
 
-    void connect(Inspector::FrontendChannel*, bool isAutomaticConnection = false, bool immediatelyPause = false) final;
-    void disconnect(Inspector::FrontendChannel*) final;
+    void connect(Inspector::FrontendChannel&, bool isAutomaticConnection = false, bool immediatelyPause = false) final;
+    void disconnect(Inspector::FrontendChannel&) final;
     void dispatchMessageFromRemote(const String& message) final;
     void setIndicating(bool) final;
 
index 797420c..c4b92c8 100644 (file)
@@ -62,10 +62,8 @@ bool WebPageInspectorController::hasLocalFrontend() const
     return m_frontendRouter->hasLocalFrontend();
 }
 
-void WebPageInspectorController::connectFrontend(Inspector::FrontendChannel* frontendChannel, bool, bool)
+void WebPageInspectorController::connectFrontend(Inspector::FrontendChannel& frontendChannel, bool, bool)
 {
-    ASSERT_ARG(frontendChannel, frontendChannel);
-
     bool connectingFirstFrontend = !m_frontendRouter->hasFrontends();
 
     m_frontendRouter->connectFrontend(frontendChannel);
@@ -81,7 +79,7 @@ void WebPageInspectorController::connectFrontend(Inspector::FrontendChannel* fro
 #endif
 }
 
-void WebPageInspectorController::disconnectFrontend(FrontendChannel* frontendChannel)
+void WebPageInspectorController::disconnectFrontend(FrontendChannel& frontendChannel)
 {
     m_frontendRouter->disconnectFrontend(frontendChannel);
 
index 2c91e02..0caf6a1 100644 (file)
@@ -50,8 +50,8 @@ public:
 
     bool hasLocalFrontend() const;
 
-    void connectFrontend(Inspector::FrontendChannel*, bool isAutomaticInspection = false, bool immediatelyPause = false);
-    void disconnectFrontend(Inspector::FrontendChannel*);
+    void connectFrontend(Inspector::FrontendChannel&, bool isAutomaticInspection = false, bool immediatelyPause = false);
+    void disconnectFrontend(Inspector::FrontendChannel&);
     void disconnectAllFrontends();
 
     void dispatchMessageFromFrontend(const String& message);
index b32737a..2daa636 100644 (file)
@@ -145,7 +145,7 @@ void WebInspector::close()
     if (!m_frontendConnection)
         return;
 
-    m_page->corePage()->inspectorController().disconnectFrontend(this);
+    m_page->corePage()->inspectorController().disconnectFrontend(*this);
     closeFrontendConnection();
 }
 
index a763484..f1bea50 100644 (file)
@@ -47,13 +47,13 @@ String WebPageInspectorTarget::identifier() const
 void WebPageInspectorTarget::connect(Inspector::FrontendChannel& channel)
 {
     if (m_page.corePage())
-        m_page.corePage()->inspectorController().connectFrontend(&channel);
+        m_page.corePage()->inspectorController().connectFrontend(channel);
 }
 
 void WebPageInspectorTarget::disconnect(Inspector::FrontendChannel& channel)
 {
     if (m_page.corePage())
-        m_page.corePage()->inspectorController().disconnectFrontend(&channel);
+        m_page.corePage()->inspectorController().disconnectFrontend(channel);
 }
 
 void WebPageInspectorTarget::sendMessageToTargetBackend(const String& message)
index 78aa0ef..4567883 100644 (file)
@@ -1,5 +1,15 @@
 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
+        https://bugs.webkit.org/show_bug.cgi?id=191612
+
+        Reviewed by Matt Baker.
+
+        * WebCoreSupport/WebInspectorClient.mm:
+        (-[WebInspectorWindowController destroyInspectorView]):
+
+2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Remote Inspector)
         https://bugs.webkit.org/show_bug.cgi?id=191494
         <rdar://problem/45469854>
index 97a6961..4a5c3f8 100644 (file)
@@ -655,7 +655,7 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String
     if (Page* frontendPage = _frontendClient->frontendPage())
         frontendPage->inspectorController().setInspectorFrontendClient(nullptr);
     if (Page* inspectedPage = [_inspectedWebView.get() page])
-        inspectedPage->inspectorController().disconnectFrontend(_inspectorClient);
+        inspectedPage->inspectorController().disconnectFrontend(*_inspectorClient);
 
     [[_inspectedWebView.get() inspector] releaseFrontend];
     _inspectorClient->releaseFrontend();
index 2b3e0af..138e634 100644 (file)
@@ -1,3 +1,13 @@
+2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
+        https://bugs.webkit.org/show_bug.cgi?id=191612
+
+        Reviewed by Matt Baker.
+
+        * WebCoreSupport/WebInspectorClient.cpp:
+        (WebInspectorFrontendClient::destroyInspectorView):
+
 2018-11-12  Don Olmstead  <don.olmstead@sony.com>
 
         Shipped PNGs include bad profiles: iCCP: known incorrect sRGB profile
index 08c683e..f8f0a46 100644 (file)
@@ -422,7 +422,7 @@ void WebInspectorFrontendClient::destroyInspectorView()
     if (Page* frontendPage = this->frontendPage())
         frontendPage->inspectorController().setInspectorFrontendClient(nullptr);
     if (Page* inspectedPage = m_inspectedWebView->page())
-        inspectedPage->inspectorController().disconnectFrontend(m_inspectorClient);
+        inspectedPage->inspectorController().disconnectFrontend(*m_inspectorClient);
 
     m_inspectorClient->releaseFrontend();