Title: [189034] trunk/Source
Revision
189034
Author
[email protected]
Date
2015-08-27 10:42:45 -0700 (Thu, 27 Aug 2015)

Log Message

Web Inspector: FrontendChannel should know its own connection type
https://bugs.webkit.org/show_bug.cgi?id=148482

Reviewed by Joseph Pecoraro.

Source/_javascript_Core:

* inspector/InspectorFrontendChannel.h: Add connectionType().
* inspector/remote/RemoteInspectorDebuggableConnection.h:

Source/WebCore:

To prepare for multiple attached frontends, the frontend connection should
be able to report its type rather than explicitly setting connection type
via a getter.

No behavior change, no new tests.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::hasLocalFrontend): Ask the channel what it is.
(WebCore::InspectorController::hasRemoteFrontend): Ask the channel what it is.
(WebCore::InspectorController::connectFrontend): Use hasRemoteFrotend().
(WebCore::InspectorController::disconnectFrontend): Use hasRemoteFrontend().
(WebCore::InspectorController::InspectorController): Deleted.
* inspector/InspectorController.h: Initialize a few members here.
(WebCore::InspectorController::hasFrontend): Deleted, it was unused.
(WebCore::InspectorController::setHasRemoteFrontend): Deleted.
* inspector/WorkerInspectorController.cpp:
* page/PageDebuggable.cpp:
(WebCore::PageDebuggable::connect):
(WebCore::PageDebuggable::disconnect):
* testing/Internals.cpp: Add connectionType().

Source/WebKit/mac:

* WebCoreSupport/WebInspectorClient.h: add connectionType().

Source/WebKit/win:

* WebCoreSupport/WebInspectorClient.h: add connectionType().

Source/WebKit2:

* WebProcess/WebPage/WebInspector.h: add connectionType().

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (189033 => 189034)


--- trunk/Source/_javascript_Core/ChangeLog	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-08-27 17:42:45 UTC (rev 189034)
@@ -1,3 +1,13 @@
+2015-08-27  Brian Burg  <[email protected]>
+
+        Web Inspector: FrontendChannel should know its own connection type
+        https://bugs.webkit.org/show_bug.cgi?id=148482
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/InspectorFrontendChannel.h: Add connectionType().
+        * inspector/remote/RemoteInspectorDebuggableConnection.h:
+
 2015-08-26  Filip Pizlo  <[email protected]>
 
         Node::origin should always be set, and the dead zone due to SSA Phis can just use exitOK=false

Modified: trunk/Source/_javascript_Core/inspector/InspectorFrontendChannel.h (189033 => 189034)


--- trunk/Source/_javascript_Core/inspector/InspectorFrontendChannel.h	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/_javascript_Core/inspector/InspectorFrontendChannel.h	2015-08-27 17:42:45 UTC (rev 189034)
@@ -32,7 +32,14 @@
 
 class FrontendChannel {
 public:
+
+    enum class ConnectionType {
+        Remote,
+        Local
+    };
+
     virtual ~FrontendChannel() { }
+    virtual ConnectionType connectionType() const = 0;
     virtual bool sendMessageToFrontend(const String& message) = 0;
 };
 

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggableConnection.h (189033 => 189034)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggableConnection.h	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggableConnection.h	2015-08-27 17:42:45 UTC (rev 189034)
@@ -92,6 +92,8 @@
     void sendMessageToBackend(NSString *);
     virtual bool sendMessageToFrontend(const String&) override;
 
+    virtual ConnectionType connectionType() const override { return ConnectionType::Remote; }
+
     Lock& queueMutex() { return m_queueMutex; }
     RemoteInspectorQueue queue() const { return m_queue; }
     void clearQueue() { m_queue.clear(); }

Modified: trunk/Source/WebCore/ChangeLog (189033 => 189034)


--- trunk/Source/WebCore/ChangeLog	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebCore/ChangeLog	2015-08-27 17:42:45 UTC (rev 189034)
@@ -1,3 +1,31 @@
+2015-08-27  Brian Burg  <[email protected]>
+
+        Web Inspector: FrontendChannel should know its own connection type
+        https://bugs.webkit.org/show_bug.cgi?id=148482
+
+        Reviewed by Joseph Pecoraro.
+
+        To prepare for multiple attached frontends, the frontend connection should
+        be able to report its type rather than explicitly setting connection type
+        via a getter.
+
+        No behavior change, no new tests.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::hasLocalFrontend): Ask the channel what it is.
+        (WebCore::InspectorController::hasRemoteFrontend): Ask the channel what it is.
+        (WebCore::InspectorController::connectFrontend): Use hasRemoteFrotend().
+        (WebCore::InspectorController::disconnectFrontend): Use hasRemoteFrontend().
+        (WebCore::InspectorController::InspectorController): Deleted.
+        * inspector/InspectorController.h: Initialize a few members here.
+        (WebCore::InspectorController::hasFrontend): Deleted, it was unused.
+        (WebCore::InspectorController::setHasRemoteFrontend): Deleted.
+        * inspector/WorkerInspectorController.cpp:
+        * page/PageDebuggable.cpp:
+        (WebCore::PageDebuggable::connect):
+        (WebCore::PageDebuggable::disconnect):
+        * testing/Internals.cpp: Add connectionType().
+
 2015-08-27  Eric Carlson  <[email protected]>
 
         Media Session: MediaSession constructor 'kind' argument optional

Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (189033 => 189034)


--- trunk/Source/WebCore/inspector/InspectorController.cpp	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp	2015-08-27 17:42:45 UTC (rev 189034)
@@ -86,16 +86,9 @@
     : m_instrumentingAgents(InstrumentingAgents::create(*this))
     , m_injectedScriptManager(std::make_unique<WebInjectedScriptManager>(*this, WebInjectedScriptHost::create()))
     , m_overlay(std::make_unique<InspectorOverlay>(page, inspectorClient))
-    , m_frontendChannel(nullptr)
     , m_executionStopwatch(Stopwatch::create())
     , m_page(page)
     , m_inspectorClient(inspectorClient)
-    , m_inspectorFrontendClient(nullptr)
-    , m_isUnderTest(false)
-    , m_isAutomaticInspection(false)
-#if ENABLE(REMOTE_INSPECTOR)
-    , m_hasRemoteFrontend(false)
-#endif
 {
     ASSERT_ARG(inspectorClient, inspectorClient);
 
@@ -197,20 +190,12 @@
 
 bool InspectorController::hasLocalFrontend() const
 {
-#if ENABLE(REMOTE_INSPECTOR)
-    return hasFrontend() && !m_hasRemoteFrontend;
-#else
-    return hasFrontend();
-#endif
+    return m_frontendChannel && m_frontendChannel->connectionType() == FrontendChannel::ConnectionType::Local;
 }
 
 bool InspectorController::hasRemoteFrontend() const
 {
-#if ENABLE(REMOTE_INSPECTOR)
-    return m_hasRemoteFrontend;
-#else
-    return false;
-#endif
+    return m_frontendChannel && m_frontendChannel->connectionType() == FrontendChannel::ConnectionType::Remote;
 }
 
 bool InspectorController::hasInspectorFrontendClient() const
@@ -250,7 +235,7 @@
     InspectorInstrumentation::frontendCreated();
 
 #if ENABLE(REMOTE_INSPECTOR)
-    if (!m_hasRemoteFrontend)
+    if (!hasRemoteFrontend())
         m_page.remoteInspectorInformationDidChange();
 #endif
 }
@@ -260,6 +245,11 @@
     if (!m_frontendChannel)
         return;
 
+#if ENABLE(REMOTE_INSPECTOR)
+    if (!hasRemoteFrontend())
+        m_page.remoteInspectorInformationDidChange();
+#endif
+
     m_agents.willDestroyFrontendAndBackend(reason);
 
     m_backendDispatcher->clearFrontend();
@@ -272,11 +262,6 @@
     m_overlay->freePage();
     InspectorInstrumentation::frontendDeleted();
     InspectorInstrumentation::unregisterInstrumentingAgents(*m_instrumentingAgents);
-
-#if ENABLE(REMOTE_INSPECTOR)
-    if (!m_hasRemoteFrontend)
-        m_page.remoteInspectorInformationDidChange();
-#endif
 }
 
 void InspectorController::show()

Modified: trunk/Source/WebCore/inspector/InspectorController.h (189033 => 189034)


--- trunk/Source/WebCore/inspector/InspectorController.h	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebCore/inspector/InspectorController.h	2015-08-27 17:42:45 UTC (rev 189034)
@@ -94,7 +94,6 @@
 
     WEBCORE_EXPORT void dispatchMessageFromFrontend(const String& message);
 
-    bool hasFrontend() const { return !!m_frontendChannel; }
     bool hasLocalFrontend() const;
     bool hasRemoteFrontend() const;
 
@@ -102,10 +101,6 @@
     WEBCORE_EXPORT void disconnectFrontend(Inspector::DisconnectReason);
     void setProcessId(long);
 
-#if ENABLE(REMOTE_INSPECTOR)
-    void setHasRemoteFrontend(bool hasRemote) { m_hasRemoteFrontend = hasRemote; }
-#endif
-
     void inspect(Node*);
     WEBCORE_EXPORT void drawHighlight(GraphicsContext&) const;
     WEBCORE_EXPORT void getHighlight(Highlight&, InspectorOverlay::CoordinateSystem) const;
@@ -155,21 +150,17 @@
     InspectorTimelineAgent* m_timelineAgent;
 
     RefPtr<Inspector::BackendDispatcher> m_backendDispatcher;
-    Inspector::FrontendChannel* m_frontendChannel;
+    Inspector::FrontendChannel* m_frontendChannel { nullptr };
     Ref<WTF::Stopwatch> m_executionStopwatch;
     Page& m_page;
     InspectorClient* m_inspectorClient;
-    InspectorFrontendClient* m_inspectorFrontendClient;
+    InspectorFrontendClient* m_inspectorFrontendClient { nullptr };
     Inspector::AgentRegistry m_agents;
     Vector<InspectorInstrumentationCookie, 2> m_injectedScriptInstrumentationCookies;
-    bool m_isUnderTest;
-    bool m_isAutomaticInspection;
-
-#if ENABLE(REMOTE_INSPECTOR)
-    bool m_hasRemoteFrontend;
-#endif
+    bool m_isUnderTest { false };
+    bool m_isAutomaticInspection { false };
 };
 
-}
+} // namespace WebCore
 
 #endif // !defined(InspectorController_h)

Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.cpp (189033 => 189034)


--- trunk/Source/WebCore/inspector/WorkerInspectorController.cpp	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.cpp	2015-08-27 17:42:45 UTC (rev 189034)
@@ -62,6 +62,8 @@
     explicit PageInspectorProxy(WorkerGlobalScope& workerGlobalScope)
         : m_workerGlobalScope(workerGlobalScope) { }
     virtual ~PageInspectorProxy() { }
+
+    virtual ConnectionType connectionType() const override { return ConnectionType::Local; }
 private:
     virtual bool sendMessageToFrontend(const String& message) override
     {

Modified: trunk/Source/WebCore/page/PageDebuggable.cpp (189033 => 189034)


--- trunk/Source/WebCore/page/PageDebuggable.cpp	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebCore/page/PageDebuggable.cpp	2015-08-27 17:42:45 UTC (rev 189034)
@@ -77,15 +77,13 @@
         m_forcedDeveloperExtrasEnabled = false;
 
     InspectorController& inspectorController = m_page.inspectorController();
-    inspectorController.setHasRemoteFrontend(true);
-    inspectorController.connectFrontend(reinterpret_cast<Inspector::FrontendChannel*>(channel), isAutomaticInspection);
+    inspectorController.connectFrontend(channel, isAutomaticInspection);
 }
 
 void PageDebuggable::disconnect()
 {
     InspectorController& inspectorController = m_page.inspectorController();
     inspectorController.disconnectFrontend(Inspector::DisconnectReason::InspectorDestroyed);
-    inspectorController.setHasRemoteFrontend(false);
 
     if (m_forcedDeveloperExtrasEnabled) {
         m_forcedDeveloperExtrasEnabled = false;

Modified: trunk/Source/WebCore/testing/Internals.cpp (189033 => 189034)


--- trunk/Source/WebCore/testing/Internals.cpp	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebCore/testing/Internals.cpp	2015-08-27 17:42:45 UTC (rev 189034)
@@ -238,6 +238,7 @@
     explicit InspectorFrontendChannelDummy(Page*);
     virtual ~InspectorFrontendChannelDummy() { }
     virtual bool sendMessageToFrontend(const String& message) override;
+    virtual ConnectionType connectionType() const override { return ConnectionType::Local; }
 
 private:
     Page* m_frontendPage;

Modified: trunk/Source/WebKit/mac/ChangeLog (189033 => 189034)


--- trunk/Source/WebKit/mac/ChangeLog	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-08-27 17:42:45 UTC (rev 189034)
@@ -1,3 +1,12 @@
+2015-08-27  Brian Burg  <[email protected]>
+
+        Web Inspector: FrontendChannel should know its own connection type
+        https://bugs.webkit.org/show_bug.cgi?id=148482
+
+        Reviewed by Joseph Pecoraro.
+
+        * WebCoreSupport/WebInspectorClient.h: add connectionType().
+
 2015-08-26  Beth Dakin  <[email protected]>
 
         REGRESSION: Safari navigates after a cancelled force click

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h (189033 => 189034)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h	2015-08-27 17:42:45 UTC (rev 189034)
@@ -85,6 +85,7 @@
     virtual void didSetSearchingForNode(bool) override;
 
     virtual bool sendMessageToFrontend(const String&) override;
+    virtual ConnectionType connectionType() const override { return ConnectionType::Local; }
 
     bool inspectorStartsAttached();
     void setInspectorStartsAttached(bool);

Modified: trunk/Source/WebKit/win/ChangeLog (189033 => 189034)


--- trunk/Source/WebKit/win/ChangeLog	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebKit/win/ChangeLog	2015-08-27 17:42:45 UTC (rev 189034)
@@ -1,3 +1,12 @@
+2015-08-27  Brian Burg  <[email protected]>
+
+        Web Inspector: FrontendChannel should know its own connection type
+        https://bugs.webkit.org/show_bug.cgi?id=148482
+
+        Reviewed by Joseph Pecoraro.
+
+        * WebCoreSupport/WebInspectorClient.h: add connectionType().
+
 2015-08-23  Andy Estes  <[email protected]>
 
         [Content Filtering] REGRESSION (r182356): Provisional URL is incorrect in didReceiveServerRedirectForProvisionalLoadForFrame when Content Filtering is enabled

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h (189033 => 189034)


--- trunk/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h	2015-08-27 17:42:45 UTC (rev 189034)
@@ -64,7 +64,8 @@
     virtual void highlight();
     virtual void hideHighlight();
 
-    virtual bool sendMessageToFrontend(const WTF::String&);
+    virtual bool sendMessageToFrontend(const WTF::String&) override;
+    virtual ConnectionType connectionType() const override { return ConnectionType::Local; }
 
     bool inspectorStartsAttached();
     void setInspectorStartsAttached(bool);

Modified: trunk/Source/WebKit2/ChangeLog (189033 => 189034)


--- trunk/Source/WebKit2/ChangeLog	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebKit2/ChangeLog	2015-08-27 17:42:45 UTC (rev 189034)
@@ -1,3 +1,12 @@
+2015-08-27  Brian Burg  <[email protected]>
+
+        Web Inspector: FrontendChannel should know its own connection type
+        https://bugs.webkit.org/show_bug.cgi?id=148482
+
+        Reviewed by Joseph Pecoraro.
+
+        * WebProcess/WebPage/WebInspector.h: add connectionType().
+
 2015-08-27  Csaba Osztrogonác  <[email protected]>
 
         [EFL] REGRESSION: 50+ layout tests crash

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h (189033 => 189034)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h	2015-08-27 17:40:56 UTC (rev 189033)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h	2015-08-27 17:42:45 UTC (rev 189034)
@@ -46,6 +46,7 @@
     void updateDockingAvailability();
 
     virtual bool sendMessageToFrontend(const String& message) override;
+    virtual ConnectionType connectionType() const override { return ConnectionType::Local; }
 
     // Implemented in generated WebInspectorMessageReceiver.cpp
     void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to