[RemoteInspector] Fix connection and target identifier types.
authorBasuke.Suzuki@sony.com <Basuke.Suzuki@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2019 18:54:17 +0000 (18:54 +0000)
committerBasuke.Suzuki@sony.com <Basuke.Suzuki@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2019 18:54:17 +0000 (18:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197243

Reviewed by Ross Kirsling.

Give dedicated type for RemoteControllableTarget's identifier as Inspector::TargetID.

Also rename ClientID type used in Socket backend to ConnectionID because this is the identifier
socket endpoint assign to the newly created connection. The size was changed to uint32_t.
Enough size for managing connections.

* inspector/remote/RemoteConnectionToTarget.cpp:
(Inspector::RemoteConnectionToTarget::setup):
(Inspector::RemoteConnectionToTarget::close):
(Inspector::RemoteConnectionToTarget::targetIdentifier const):
* inspector/remote/RemoteConnectionToTarget.h:
* inspector/remote/RemoteControllableTarget.h:
* inspector/remote/RemoteInspector.cpp:
(Inspector::RemoteInspector::nextAvailableTargetIdentifier):
(Inspector::RemoteInspector::registerTarget):
(Inspector::RemoteInspector::unregisterTarget):
(Inspector::RemoteInspector::updateTarget):
(Inspector::RemoteInspector::setupFailed):
(Inspector::RemoteInspector::setupCompleted):
(Inspector::RemoteInspector::waitingForAutomaticInspection):
(Inspector::RemoteInspector::updateTargetListing):
* inspector/remote/RemoteInspector.h:
* inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm:
(Inspector::RemoteConnectionToTarget::targetIdentifier const):
(Inspector::RemoteConnectionToTarget::setup):
(Inspector::RemoteConnectionToTarget::close):
* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
(Inspector::RemoteInspector::sendMessageToRemote):
(Inspector::RemoteInspector::receivedSetupMessage):
(Inspector::RemoteInspector::receivedDataMessage):
(Inspector::RemoteInspector::receivedDidCloseMessage):
(Inspector::RemoteInspector::receivedIndicateMessage):
(Inspector::RemoteInspector::receivedAutomaticInspectionRejectMessage):
* inspector/remote/glib/RemoteInspectorGlib.cpp:
(Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
(Inspector::RemoteInspector::sendMessageToRemote):
(Inspector::RemoteInspector::receivedSetupMessage):
(Inspector::RemoteInspector::receivedDataMessage):
(Inspector::RemoteInspector::receivedCloseMessage):
(Inspector::RemoteInspector::setup):
(Inspector::RemoteInspector::sendMessageToTarget):
* inspector/remote/socket/RemoteInspectorConnectionClient.cpp:
(Inspector::RemoteInspectorConnectionClient::didReceiveWebInspectorEvent):
* inspector/remote/socket/RemoteInspectorConnectionClient.h:
(Inspector::RemoteInspectorConnectionClient::didAccept):
* inspector/remote/socket/RemoteInspectorMessageParser.cpp:
(Inspector::MessageParser::MessageParser):
(Inspector::MessageParser::parse):
* inspector/remote/socket/RemoteInspectorMessageParser.h:
(Inspector::MessageParser::setDidParseMessageListener):
* inspector/remote/socket/RemoteInspectorServer.cpp:
(Inspector::RemoteInspectorServer::didAccept):
(Inspector::RemoteInspectorServer::didClose):
(Inspector::RemoteInspectorServer::dispatchMap):
(Inspector::RemoteInspectorServer::sendWebInspectorEvent):
(Inspector::RemoteInspectorServer::sendCloseEvent):
(Inspector::RemoteInspectorServer::connectionClosed):
* inspector/remote/socket/RemoteInspectorServer.h:
* inspector/remote/socket/RemoteInspectorSocket.cpp:
(Inspector::RemoteInspector::didClose):
(Inspector::RemoteInspector::sendMessageToRemote):
(Inspector::RemoteInspector::setup):
(Inspector::RemoteInspector::sendMessageToTarget):
* inspector/remote/socket/RemoteInspectorSocket.h:
* inspector/remote/socket/RemoteInspectorSocketEndpoint.cpp:
(Inspector::RemoteInspectorSocketEndpoint::connectInet):
(Inspector::RemoteInspectorSocketEndpoint::isListening):
(Inspector::RemoteInspectorSocketEndpoint::workerThread):
(Inspector::RemoteInspectorSocketEndpoint::createClient):
(Inspector::RemoteInspectorSocketEndpoint::recvIfEnabled):
(Inspector::RemoteInspectorSocketEndpoint::sendIfEnabled):
(Inspector::RemoteInspectorSocketEndpoint::send):
(Inspector::RemoteInspectorSocketEndpoint::acceptInetSocketIfEnabled):
* inspector/remote/socket/RemoteInspectorSocketEndpoint.h:

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

19 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.cpp
Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h
Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h
Source/JavaScriptCore/inspector/remote/RemoteInspector.cpp
Source/JavaScriptCore/inspector/remote/RemoteInspector.h
Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm
Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm
Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorConnectionClient.cpp
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorConnectionClient.h
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorMessageParser.cpp
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorMessageParser.h
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.h
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorSocket.cpp
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorSocket.h
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorSocketEndpoint.cpp
Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorSocketEndpoint.h

index 0a85d70..0879784 100644 (file)
@@ -1,3 +1,86 @@
+2019-04-25  Basuke Suzuki  <Basuke.Suzuki@sony.com>
+
+        [RemoteInspector] Fix connection and target identifier types.
+        https://bugs.webkit.org/show_bug.cgi?id=197243
+
+        Reviewed by Ross Kirsling.
+
+        Give dedicated type for RemoteControllableTarget's identifier as Inspector::TargetID.
+
+        Also rename ClientID type used in Socket backend to ConnectionID because this is the identifier
+        socket endpoint assign to the newly created connection. The size was changed to uint32_t.
+        Enough size for managing connections.
+
+        * inspector/remote/RemoteConnectionToTarget.cpp:
+        (Inspector::RemoteConnectionToTarget::setup):
+        (Inspector::RemoteConnectionToTarget::close):
+        (Inspector::RemoteConnectionToTarget::targetIdentifier const):
+        * inspector/remote/RemoteConnectionToTarget.h:
+        * inspector/remote/RemoteControllableTarget.h:
+        * inspector/remote/RemoteInspector.cpp:
+        (Inspector::RemoteInspector::nextAvailableTargetIdentifier):
+        (Inspector::RemoteInspector::registerTarget):
+        (Inspector::RemoteInspector::unregisterTarget):
+        (Inspector::RemoteInspector::updateTarget):
+        (Inspector::RemoteInspector::setupFailed):
+        (Inspector::RemoteInspector::setupCompleted):
+        (Inspector::RemoteInspector::waitingForAutomaticInspection):
+        (Inspector::RemoteInspector::updateTargetListing):
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm:
+        (Inspector::RemoteConnectionToTarget::targetIdentifier const):
+        (Inspector::RemoteConnectionToTarget::setup):
+        (Inspector::RemoteConnectionToTarget::close):
+        * inspector/remote/cocoa/RemoteInspectorCocoa.mm:
+        (Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
+        (Inspector::RemoteInspector::sendMessageToRemote):
+        (Inspector::RemoteInspector::receivedSetupMessage):
+        (Inspector::RemoteInspector::receivedDataMessage):
+        (Inspector::RemoteInspector::receivedDidCloseMessage):
+        (Inspector::RemoteInspector::receivedIndicateMessage):
+        (Inspector::RemoteInspector::receivedAutomaticInspectionRejectMessage):
+        * inspector/remote/glib/RemoteInspectorGlib.cpp:
+        (Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
+        (Inspector::RemoteInspector::sendMessageToRemote):
+        (Inspector::RemoteInspector::receivedSetupMessage):
+        (Inspector::RemoteInspector::receivedDataMessage):
+        (Inspector::RemoteInspector::receivedCloseMessage):
+        (Inspector::RemoteInspector::setup):
+        (Inspector::RemoteInspector::sendMessageToTarget):
+        * inspector/remote/socket/RemoteInspectorConnectionClient.cpp:
+        (Inspector::RemoteInspectorConnectionClient::didReceiveWebInspectorEvent):
+        * inspector/remote/socket/RemoteInspectorConnectionClient.h:
+        (Inspector::RemoteInspectorConnectionClient::didAccept):
+        * inspector/remote/socket/RemoteInspectorMessageParser.cpp:
+        (Inspector::MessageParser::MessageParser):
+        (Inspector::MessageParser::parse):
+        * inspector/remote/socket/RemoteInspectorMessageParser.h:
+        (Inspector::MessageParser::setDidParseMessageListener):
+        * inspector/remote/socket/RemoteInspectorServer.cpp:
+        (Inspector::RemoteInspectorServer::didAccept):
+        (Inspector::RemoteInspectorServer::didClose):
+        (Inspector::RemoteInspectorServer::dispatchMap):
+        (Inspector::RemoteInspectorServer::sendWebInspectorEvent):
+        (Inspector::RemoteInspectorServer::sendCloseEvent):
+        (Inspector::RemoteInspectorServer::connectionClosed):
+        * inspector/remote/socket/RemoteInspectorServer.h:
+        * inspector/remote/socket/RemoteInspectorSocket.cpp:
+        (Inspector::RemoteInspector::didClose):
+        (Inspector::RemoteInspector::sendMessageToRemote):
+        (Inspector::RemoteInspector::setup):
+        (Inspector::RemoteInspector::sendMessageToTarget):
+        * inspector/remote/socket/RemoteInspectorSocket.h:
+        * inspector/remote/socket/RemoteInspectorSocketEndpoint.cpp:
+        (Inspector::RemoteInspectorSocketEndpoint::connectInet):
+        (Inspector::RemoteInspectorSocketEndpoint::isListening):
+        (Inspector::RemoteInspectorSocketEndpoint::workerThread):
+        (Inspector::RemoteInspectorSocketEndpoint::createClient):
+        (Inspector::RemoteInspectorSocketEndpoint::recvIfEnabled):
+        (Inspector::RemoteInspectorSocketEndpoint::sendIfEnabled):
+        (Inspector::RemoteInspectorSocketEndpoint::send):
+        (Inspector::RemoteInspectorSocketEndpoint::acceptInetSocketIfEnabled):
+        * inspector/remote/socket/RemoteInspectorSocketEndpoint.h:
+
 2019-04-25  Alex Christensen  <achristensen@webkit.org>
 
         Start using C++17
index dd1e703..2335b29 100644 (file)
@@ -49,7 +49,7 @@ bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automatica
     if (!m_target)
         return false;
 
-    unsigned targetIdentifier = this->targetIdentifier().valueOr(0);
+    auto targetIdentifier = this->targetIdentifier().valueOr(0);
 
     if (!m_target || !m_target->remoteControlAllowed()) {
         RemoteInspector::singleton().setupFailed(targetIdentifier);
@@ -90,7 +90,7 @@ void RemoteConnectionToTarget::close()
     if (!m_target)
         return;
 
-    unsigned targetIdentifier = m_target->targetIdentifier();
+    auto targetIdentifier = m_target->targetIdentifier();
 
     if (m_connected)
         m_target->disconnect(*this);
@@ -106,9 +106,9 @@ void RemoteConnectionToTarget::targetClosed()
     m_target = nullptr;
 }
 
-Optional<unsigned> RemoteConnectionToTarget::targetIdentifier() const
+Optional<TargetID> RemoteConnectionToTarget::targetIdentifier() const
 {
-    return m_target ? Optional<unsigned>(m_target->targetIdentifier()) : WTF::nullopt;
+    return m_target ? Optional<TargetID>(m_target->targetIdentifier()) : WTF::nullopt;
 }
 
 void RemoteConnectionToTarget::sendMessageToFrontend(const String& message)
index 8b0e14b..eecea0d 100644 (file)
@@ -28,6 +28,7 @@
 #if ENABLE(REMOTE_INSPECTOR)
 
 #include "InspectorFrontendChannel.h"
+#include "RemoteControllableTarget.h"
 #include <wtf/Lock.h>
 #include <wtf/ThreadSafeRefCounted.h>
 
@@ -65,7 +66,7 @@ public:
     void close();
     void targetClosed();
 
-    Optional<unsigned> targetIdentifier() const;
+    Optional<TargetID> targetIdentifier() const;
 #if PLATFORM(COCOA)
     NSString *connectionIdentifier() const;
     NSString *destination() const;
index 4bbb6a4..54f23a5 100644 (file)
@@ -38,6 +38,8 @@ namespace Inspector {
 
 class FrontendChannel;
 
+using TargetID = unsigned;
+
 class JS_EXPORT_PRIVATE RemoteControllableTarget {
 public:
     virtual ~RemoteControllableTarget();
@@ -48,8 +50,8 @@ public:
     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; }
+    TargetID targetIdentifier() const { return m_identifier; }
+    void setTargetIdentifier(TargetID identifier) { m_identifier = identifier; }
 
     enum class Type { JavaScript, ServiceWorker, Web, Automation };
     virtual Type type() const = 0;
@@ -62,7 +64,7 @@ public:
 #endif
 
 private:
-    unsigned m_identifier { 0 };
+    TargetID m_identifier { 0 };
 };
 
 } // namespace Inspector
index c7dabf6..9a6a96f 100644 (file)
@@ -44,12 +44,12 @@ void RemoteInspector::startDisabled()
     RemoteInspector::startEnabled = false;
 }
 
-unsigned RemoteInspector::nextAvailableTargetIdentifier()
+TargetID RemoteInspector::nextAvailableTargetIdentifier()
 {
-    unsigned nextValidTargetIdentifier;
+    TargetID nextValidTargetIdentifier;
     do {
         nextValidTargetIdentifier = m_nextAvailableTargetIdentifier++;
-    } while (!nextValidTargetIdentifier || nextValidTargetIdentifier == std::numeric_limits<unsigned>::max() || m_targetMap.contains(nextValidTargetIdentifier));
+    } while (!nextValidTargetIdentifier || nextValidTargetIdentifier == std::numeric_limits<TargetID>::max() || m_targetMap.contains(nextValidTargetIdentifier));
     return nextValidTargetIdentifier;
 }
 
@@ -59,7 +59,7 @@ void RemoteInspector::registerTarget(RemoteControllableTarget* target)
 
     LockHolder lock(m_mutex);
 
-    unsigned targetIdentifier = nextAvailableTargetIdentifier();
+    auto targetIdentifier = nextAvailableTargetIdentifier();
     target->setTargetIdentifier(targetIdentifier);
 
     {
@@ -82,7 +82,7 @@ void RemoteInspector::unregisterTarget(RemoteControllableTarget* target)
 
     LockHolder lock(m_mutex);
 
-    unsigned targetIdentifier = target->targetIdentifier();
+    auto targetIdentifier = target->targetIdentifier();
     if (!targetIdentifier)
         return;
 
@@ -104,7 +104,7 @@ void RemoteInspector::updateTarget(RemoteControllableTarget* target)
 
     LockHolder lock(m_mutex);
 
-    unsigned targetIdentifier = target->targetIdentifier();
+    auto targetIdentifier = target->targetIdentifier();
     if (!targetIdentifier)
         return;
 
@@ -156,7 +156,7 @@ void RemoteInspector::setClient(RemoteInspector::Client* client)
     pushListingsSoon();
 }
 
-void RemoteInspector::setupFailed(unsigned targetIdentifier)
+void RemoteInspector::setupFailed(TargetID targetIdentifier)
 {
     LockHolder lock(m_mutex);
 
@@ -170,7 +170,7 @@ void RemoteInspector::setupFailed(unsigned targetIdentifier)
     pushListingsSoon();
 }
 
-void RemoteInspector::setupCompleted(unsigned targetIdentifier)
+void RemoteInspector::setupCompleted(TargetID targetIdentifier)
 {
     LockHolder lock(m_mutex);
 
@@ -178,7 +178,7 @@ void RemoteInspector::setupCompleted(unsigned targetIdentifier)
         m_automaticInspectionPaused = false;
 }
 
-bool RemoteInspector::waitingForAutomaticInspection(unsigned)
+bool RemoteInspector::waitingForAutomaticInspection(TargetID)
 {
     // We don't take the lock to check this because we assume it will be checked repeatedly.
     return m_automaticInspectionPaused;
@@ -208,7 +208,7 @@ TargetListing RemoteInspector::listingForTarget(const RemoteControllableTarget&
     return nullptr;
 }
 
-void RemoteInspector::updateTargetListing(unsigned targetIdentifier)
+void RemoteInspector::updateTargetListing(TargetID targetIdentifier)
 {
     auto target = m_targetMap.get(targetIdentifier);
     if (!target)
index 5e5b862..71b7cf4 100644 (file)
@@ -27,6 +27,8 @@
 
 #if ENABLE(REMOTE_INSPECTOR)
 
+#include "RemoteControllableTarget.h"
+
 #include <utility>
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
@@ -113,16 +115,16 @@ public:
     void registerTarget(RemoteControllableTarget*);
     void unregisterTarget(RemoteControllableTarget*);
     void updateTarget(RemoteControllableTarget*);
-    void sendMessageToRemote(unsigned targetIdentifier, const String& message);
+    void sendMessageToRemote(TargetID, const String& message);
 
     RemoteInspector::Client* client() const { return m_client; }
     void setClient(RemoteInspector::Client*);
     void clientCapabilitiesDidChange();
     Optional<RemoteInspector::Client::Capabilities> clientCapabilities() const { return m_clientCapabilities; }
 
-    void setupFailed(unsigned targetIdentifier);
-    void setupCompleted(unsigned targetIdentifier);
-    bool waitingForAutomaticInspection(unsigned targetIdentifier);
+    void setupFailed(TargetID);
+    void setupCompleted(TargetID);
+    bool waitingForAutomaticInspection(TargetID);
     void updateAutomaticInspectionCandidate(RemoteInspectionTarget*);
 
     bool enabled() const { return m_enabled; }
@@ -139,14 +141,14 @@ public:
     void setParentProcessInfomationIsDelayed();
 #endif
 
-    void updateTargetListing(unsigned targetIdentifier);
+    void updateTargetListing(TargetID);
 
 #if USE(GLIB)
     void requestAutomationSession(const char* sessionID, const Client::SessionCapabilities&);
 #endif
 #if USE(GLIB) || PLATFORM(PLAYSTATION)
-    void setup(unsigned targetIdentifier);
-    void sendMessageToTarget(unsigned targetIdentifier, const char* message);
+    void setup(TargetID);
+    void sendMessageToTarget(TargetID, const char* message);
 #endif
 #if PLATFORM(PLAYSTATION)
     static void setConnectionIdentifier(PlatformSocketType);
@@ -155,7 +157,7 @@ public:
 private:
     RemoteInspector();
 
-    unsigned nextAvailableTargetIdentifier();
+    TargetID nextAvailableTargetIdentifier();
 
     enum class StopSource { API, XPCMessage };
     void stopInternal(StopSource);
@@ -168,9 +170,9 @@ private:
     static const GDBusInterfaceVTable s_interfaceVTable;
 
     void receivedGetTargetListMessage();
-    void receivedSetupMessage(unsigned targetIdentifier);
-    void receivedDataMessage(unsigned targetIdentifier, const char* message);
-    void receivedCloseMessage(unsigned targetIdentifier);
+    void receivedSetupMessage(TargetID);
+    void receivedDataMessage(TargetID, const char* message);
+    void receivedCloseMessage(TargetID);
     void receivedAutomationSessionRequestMessage(const char* sessionID);
 #endif
 
@@ -206,14 +208,14 @@ private:
 #endif
 #if PLATFORM(PLAYSTATION)
     HashMap<String, CallHandler>& dispatchMap() override;
-    void didClose(ClientID) override;
+    void didClose(ConnectionID) override;
 
     void sendWebInspectorEvent(const String&);
 
-    void receivedGetTargetListMessage(const struct Event&);
-    void receivedSetupMessage(const struct Event&);
-    void receivedDataMessage(const struct Event&);
-    void receivedCloseMessage(const struct Event&);
+    void receivedGetTargetListMessage(const Event&);
+    void receivedSetupMessage(const Event&);
+    void receivedDataMessage(const Event&);
+    void receivedCloseMessage(const Event&);
 #endif
     static bool startEnabled;
 
@@ -223,9 +225,9 @@ private:
     // from any thread.
     Lock m_mutex;
 
-    HashMap<unsigned, RemoteControllableTarget*> m_targetMap;
-    HashMap<unsigned, RefPtr<RemoteConnectionToTarget>> m_targetConnectionMap;
-    HashMap<unsigned, TargetListing> m_targetListingMap;
+    HashMap<TargetID, RemoteControllableTarget*> m_targetMap;
+    HashMap<TargetID, RefPtr<RemoteConnectionToTarget>> m_targetConnectionMap;
+    HashMap<TargetID, TargetListing> m_targetListingMap;
 
 #if PLATFORM(COCOA)
     RefPtr<RemoteInspectorXPCConnection> m_relayConnection;
@@ -238,7 +240,7 @@ private:
 #if PLATFORM(PLAYSTATION)
     std::unique_ptr<RemoteInspectorSocketEndpoint> m_socketConnection;
     static PlatformSocketType s_connectionIdentifier;
-    Optional<ClientID> m_clientID;
+    Optional<ConnectionID> m_clientID;
 #endif
 
     RemoteInspector::Client* m_client { nullptr };
@@ -247,7 +249,7 @@ private:
 #if PLATFORM(COCOA)
     dispatch_queue_t m_xpcQueue;
 #endif
-    unsigned m_nextAvailableTargetIdentifier { 1 };
+    TargetID m_nextAvailableTargetIdentifier { 1 };
     int m_notifyToken { 0 };
     bool m_enabled { false };
     bool m_hasActiveDebugSession { false };
@@ -260,7 +262,7 @@ private:
     bool m_shouldSendParentProcessInformation { false };
     bool m_automaticInspectionEnabled { false };
     bool m_automaticInspectionPaused { false };
-    unsigned m_automaticInspectionCandidateTargetIdentifier { 0 };
+    TargetID m_automaticInspectionCandidateTargetIdentifier { 0 };
 };
 
 } // namespace Inspector
index b4740c6..9730db8 100644 (file)
@@ -120,9 +120,9 @@ RemoteConnectionToTarget::~RemoteConnectionToTarget()
     teardownRunLoop();
 }
 
-Optional<unsigned> RemoteConnectionToTarget::targetIdentifier() const
+Optional<TargetID> RemoteConnectionToTarget::targetIdentifier() const
 {
-    return m_target ? Optional<unsigned>(m_target->targetIdentifier()) : WTF::nullopt;
+    return m_target ? Optional<TargetID>(m_target->targetIdentifier()) : WTF::nullopt;
 }
 
 NSString *RemoteConnectionToTarget::connectionIdentifier() const
@@ -159,7 +159,7 @@ bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automatica
     if (!m_target)
         return false;
 
-    unsigned targetIdentifier = this->targetIdentifier().valueOr(0);
+    auto targetIdentifier = this->targetIdentifier().valueOr(0);
     
     ref();
     dispatchAsyncOnTarget(^{
@@ -198,7 +198,7 @@ void RemoteConnectionToTarget::targetClosed()
 
 void RemoteConnectionToTarget::close()
 {
-    unsigned targetIdentifier = m_target ? m_target->targetIdentifier() : 0;
+    auto targetIdentifier = m_target ? m_target->targetIdentifier() : 0;
     
     ref();
     dispatchAsyncOnTarget(^{
index 6466aaa..5bef21c 100644 (file)
@@ -122,7 +122,7 @@ void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget*
     {
         LockHolder lock(m_mutex);
 
-        unsigned targetIdentifier = target->targetIdentifier();
+        auto targetIdentifier = target->targetIdentifier();
         if (!targetIdentifier)
             return;
 
@@ -197,7 +197,7 @@ void RemoteInspector::sendAutomaticInspectionCandidateMessage()
     m_relayConnection->sendMessage(WIRAutomaticInspectionCandidateMessage, details);
 }
 
-void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const String& message)
+void RemoteInspector::sendMessageToRemote(TargetID targetIdentifier, const String& message)
 {
     LockHolder lock(m_mutex);
 
@@ -494,7 +494,7 @@ void RemoteInspector::receivedSetupMessage(NSDictionary *userInfo)
     BAIL_IF_UNEXPECTED_TYPE_ALLOWING_NIL(automaticallyPauseNumber, [NSNumber class]);
     BOOL automaticallyPause = automaticallyPauseNumber.boolValue;
 
-    unsigned targetIdentifier = targetIdentifierNumber.unsignedIntValue;
+    TargetID targetIdentifier = targetIdentifierNumber.unsignedIntValue;
     if (!targetIdentifier)
         return;
 
@@ -537,7 +537,7 @@ void RemoteInspector::receivedDataMessage(NSDictionary *userInfo)
     NSData *data = userInfo[WIRSocketDataKey];
     BAIL_IF_UNEXPECTED_TYPE(data, [NSData class]);
 
-    unsigned targetIdentifier = targetIdentifierNumber.unsignedIntValue;
+    TargetID targetIdentifier = targetIdentifierNumber.unsignedIntValue;
     if (!targetIdentifier)
         return;
 
@@ -557,7 +557,7 @@ void RemoteInspector::receivedDidCloseMessage(NSDictionary *userInfo)
     NSString *connectionIdentifier = userInfo[WIRConnectionIdentifierKey];
     BAIL_IF_UNEXPECTED_TYPE(connectionIdentifier, [NSString class]);
 
-    unsigned targetIdentifier = targetIdentifierNumber.unsignedIntValue;
+    TargetID targetIdentifier = targetIdentifierNumber.unsignedIntValue;
     if (!targetIdentifier)
         return;
 
@@ -588,7 +588,7 @@ void RemoteInspector::receivedIndicateMessage(NSDictionary *userInfo)
     BAIL_IF_UNEXPECTED_TYPE(indicateEnabledNumber, [NSNumber class]);
     BOOL indicateEnabled = indicateEnabledNumber.boolValue;
 
-    unsigned targetIdentifier = targetIdentifierNumber.unsignedIntValue;
+    TargetID targetIdentifier = targetIdentifierNumber.unsignedIntValue;
     if (!targetIdentifier)
         return;
 
@@ -672,7 +672,7 @@ void RemoteInspector::receivedAutomaticInspectionRejectMessage(NSDictionary *use
     NSNumber *targetIdentifierNumber = userInfo[WIRTargetIdentifierKey];
     BAIL_IF_UNEXPECTED_TYPE(targetIdentifierNumber, [NSNumber class]);
 
-    unsigned targetIdentifier = targetIdentifierNumber.unsignedIntValue;
+    TargetID targetIdentifier = targetIdentifierNumber.unsignedIntValue;
     if (!targetIdentifier)
         return;
 
index 9924a7a..5aff8b3 100644 (file)
@@ -245,7 +245,7 @@ void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget*
     LockHolder lock(m_mutex);
 
     ASSERT(target);
-    unsigned targetIdentifier = target->targetIdentifier();
+    auto targetIdentifier = target->targetIdentifier();
     if (!targetIdentifier)
         return;
 
@@ -272,7 +272,7 @@ void RemoteInspector::sendAutomaticInspectionCandidateMessage()
     // FIXME: Implement automatic inspection.
 }
 
-void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const String& message)
+void RemoteInspector::sendMessageToRemote(TargetID targetIdentifier, const String& message)
 {
     LockHolder lock(m_mutex);
     if (!m_dbusConnection)
@@ -291,12 +291,12 @@ void RemoteInspector::receivedGetTargetListMessage()
     pushListingsNow();
 }
 
-void RemoteInspector::receivedSetupMessage(unsigned targetIdentifier)
+void RemoteInspector::receivedSetupMessage(TargetID targetIdentifier)
 {
     setup(targetIdentifier);
 }
 
-void RemoteInspector::receivedDataMessage(unsigned targetIdentifier, const char* message)
+void RemoteInspector::receivedDataMessage(TargetID targetIdentifier, const char* message)
 {
     RefPtr<RemoteConnectionToTarget> connectionToTarget;
     {
@@ -308,7 +308,7 @@ void RemoteInspector::receivedDataMessage(unsigned targetIdentifier, const char*
     connectionToTarget->sendMessageToTarget(String::fromUTF8(message));
 }
 
-void RemoteInspector::receivedCloseMessage(unsigned targetIdentifier)
+void RemoteInspector::receivedCloseMessage(TargetID targetIdentifier)
 {
     RefPtr<RemoteConnectionToTarget> connectionToTarget;
     {
@@ -325,7 +325,7 @@ void RemoteInspector::receivedCloseMessage(unsigned targetIdentifier)
         connectionToTarget->close();
 }
 
-void RemoteInspector::setup(unsigned targetIdentifier)
+void RemoteInspector::setup(TargetID targetIdentifier)
 {
     RemoteControllableTarget* target;
     {
@@ -348,7 +348,7 @@ void RemoteInspector::setup(unsigned targetIdentifier)
     updateHasActiveDebugSession();
 }
 
-void RemoteInspector::sendMessageToTarget(unsigned targetIdentifier, const char* message)
+void RemoteInspector::sendMessageToTarget(TargetID targetIdentifier, const char* message)
 {
     if (auto connectionToTarget = m_targetConnectionMap.get(targetIdentifier))
         connectionToTarget->sendMessageToTarget(String::fromUTF8(message));
index 765c7b4..0e90f18 100644 (file)
@@ -34,7 +34,7 @@
 
 namespace Inspector {
 
-void RemoteInspectorConnectionClient::didReceiveWebInspectorEvent(ClientID clientID, Vector<uint8_t>&& data)
+void RemoteInspectorConnectionClient::didReceiveWebInspectorEvent(ConnectionID clientID, Vector<uint8_t>&& data)
 {
     ASSERT(!isMainThread());
 
@@ -55,14 +55,14 @@ void RemoteInspectorConnectionClient::didReceiveWebInspectorEvent(ClientID clien
     if (!messageObject->getString("event"_s, methodName))
         return;
 
-    struct Event event;
+    Event event;
     event.clientID = clientID;
 
-    uint64_t connectionID;
+    ConnectionID connectionID;
     if (messageObject->getInteger("connectionID"_s, connectionID))
         event.connectionID = connectionID;
 
-    uint64_t targetID;
+    TargetID targetID;
     if (messageObject->getInteger("targetID"_s, targetID))
         event.targetID = targetID;
 
index 7a6a02b..348e391 100644 (file)
@@ -35,18 +35,18 @@ namespace Inspector {
 
 class RemoteInspectorConnectionClient : public CanMakeWeakPtr<RemoteInspectorConnectionClient> {
 public:
-    void didReceiveWebInspectorEvent(ClientID, Vector<uint8_t>&&);
-    virtual void didAccept(ClientID, Socket::Domain) { };
-    virtual void didClose(ClientID) = 0;
+    void didReceiveWebInspectorEvent(ConnectionID, Vector<uint8_t>&&);
+    virtual void didAccept(ConnectionID, Socket::Domain) { };
+    virtual void didClose(ConnectionID) = 0;
 
     struct Event {
-        ClientID clientID;
-        Optional<uint64_t> connectionID;
-        Optional<uint64_t> targetID;
+        ConnectionID clientID { };
+        Optional<ConnectionID> connectionID;
+        Optional<TargetID> targetID;
         Optional<String> message;
     };
 
-    using CallHandler = void (RemoteInspectorConnectionClient::*)(const struct Event&);
+    using CallHandler = void (RemoteInspectorConnectionClient::*)(const Event&);
     virtual HashMap<String, CallHandler>& dispatchMap() = 0;
 };
 
index 0509dca..1bccf9d 100644 (file)
@@ -41,8 +41,8 @@ namespace Inspector {
                | <------------ size ------------> |
 */
 
-MessageParser::MessageParser(ClientID clientID, size_t bufferSize)
-    : m_clientID(clientID)
+MessageParser::MessageParser(ConnectionID id, size_t bufferSize)
+    : m_connectionID(id)
 {
     m_buffer.reserveCapacity(bufferSize);
 }
@@ -104,7 +104,7 @@ bool MessageParser::parse()
         memcpy(&dataBuffer[0], &m_buffer[sizeof(uint32_t)], dataSize);
 
         if (m_didParseMessageListener)
-            m_didParseMessageListener(m_clientID, WTFMove(dataBuffer));
+            m_didParseMessageListener(m_connectionID, WTFMove(dataBuffer));
 
         m_buffer.remove(0, messageSize);
     }
index d5b198e..ae059fd 100644 (file)
@@ -36,18 +36,18 @@ class MessageParser {
 public:
     static Vector<uint8_t> createMessage(const uint8_t*, size_t);
 
-    MessageParser(ClientID, size_t);
+    MessageParser(ConnectionID, size_t);
     void pushReceivedData(const uint8_t*, size_t);
-    void setDidParseMessageListener(Function<void(ClientID, Vector<uint8_t>)>&& listener) { m_didParseMessageListener = WTFMove(listener); }
+    void setDidParseMessageListener(Function<void(ConnectionID, Vector<uint8_t>)>&& listener) { m_didParseMessageListener = WTFMove(listener); }
 
     void clearReceivedData();
 
 private:
     bool parse();
 
-    Function<void(ClientID, Vector<uint8_t>&&)> m_didParseMessageListener;
+    Function<void(ConnectionID, Vector<uint8_t>&&)> m_didParseMessageListener;
     Vector<uint8_t> m_buffer;
-    ClientID m_clientID;
+    ConnectionID m_connectionID;
 };
 
 } // namespace Inspector
index 3a45098..e60fc52 100644 (file)
@@ -44,7 +44,7 @@ void RemoteInspectorServer::addServerConnection(PlatformSocketType identifier)
     }
 }
 
-void RemoteInspectorServer::didAccept(ClientID clientID, Socket::Domain type)
+void RemoteInspectorServer::didAccept(ConnectionID id, Socket::Domain type)
 {
     ASSERT(!isMainThread());
 
@@ -53,18 +53,18 @@ void RemoteInspectorServer::didAccept(ClientID clientID, Socket::Domain type)
             LOG_ERROR("Inspector server can accept only 1 client");
             return;
         }
-        m_clientConnection = clientID;
+        m_clientConnection = id;
     } else if (type == Socket::Domain::Local) {
         LockHolder lock(m_connectionsLock);
-        m_inspectorConnections.append(clientID);
+        m_inspectorConnections.append(id);
     }
 }
 
-void RemoteInspectorServer::didClose(ClientID clientID)
+void RemoteInspectorServer::didClose(ConnectionID id)
 {
     ASSERT(!isMainThread());
 
-    if (clientID == m_clientConnection) {
+    if (id == m_clientConnection) {
         // Connection from the remote client closed.
         callOnMainThread([this] {
             clientConnectionClosed();
@@ -73,29 +73,29 @@ void RemoteInspectorServer::didClose(ClientID clientID)
     }
 
     // Connection from WebProcess closed.
-    callOnMainThread([this, clientID] {
-        connectionClosed(clientID);
+    callOnMainThread([this, id] {
+        connectionClosed(id);
     });
 }
 
 HashMap<String, RemoteInspectorConnectionClient::CallHandler>& RemoteInspectorServer::dispatchMap()
 {
     static NeverDestroyed<HashMap<String, CallHandler>> dispatchMap = HashMap<String, CallHandler>({
-        {"SetTargetList"_s, static_cast<CallHandler>(&RemoteInspectorServer::setTargetList)},
-        {"SetupInspectorClient"_s, static_cast<CallHandler>(&RemoteInspectorServer::setupInspectorClient)},
-        {"Setup"_s, static_cast<CallHandler>(&RemoteInspectorServer::setup)},
-        {"FrontendDidClose"_s, static_cast<CallHandler>(&RemoteInspectorServer::close)},
-        {"SendMessageToFrontend"_s, static_cast<CallHandler>(&RemoteInspectorServer::sendMessageToFrontend)},
-        {"SendMessageToBackend"_s, static_cast<CallHandler>(&RemoteInspectorServer::sendMessageToBackend)},
+        {"SetTargetList"_s, &RemoteInspectorServer::setTargetList},
+        {"SetupInspectorClient"_s, &RemoteInspectorServer::setupInspectorClient},
+        {"Setup"_s, &RemoteInspectorServer::setup},
+        {"FrontendDidClose"_s, &RemoteInspectorServer::close},
+        {"SendMessageToFrontend"_s, &RemoteInspectorServer::sendMessageToFrontend},
+        {"SendMessageToBackend"_s, &RemoteInspectorServer::sendMessageToBackend},
     });
 
     return dispatchMap;
 }
 
-void RemoteInspectorServer::sendWebInspectorEvent(ClientID clientID, const String& event)
+void RemoteInspectorServer::sendWebInspectorEvent(ConnectionID id, const String& event)
 {
     const CString message = event.utf8();
-    m_server->send(clientID, reinterpret_cast<const uint8_t*>(message.data()), message.length());
+    m_server->send(id, reinterpret_cast<const uint8_t*>(message.data()), message.length());
 }
 
 RemoteInspectorServer& RemoteInspectorServer::singleton()
@@ -157,7 +157,7 @@ void RemoteInspectorServer::setup(const Event& event)
     sendWebInspectorEvent(event.connectionID.value(), setupEvent->toJSONString());
 }
 
-void RemoteInspectorServer::sendCloseEvent(uint64_t connectionID, uint64_t targetID)
+void RemoteInspectorServer::sendCloseEvent(ConnectionID connectionID, TargetID targetID)
 {
     ASSERT(isMainThread());
 
@@ -186,7 +186,7 @@ void RemoteInspectorServer::clientConnectionClosed()
     m_clientConnection = WTF::nullopt;
 }
 
-void RemoteInspectorServer::connectionClosed(uint64_t clientID)
+void RemoteInspectorServer::connectionClosed(ConnectionID clientID)
 {
     ASSERT(isMainThread());
 
index e93f8ae..b5080ae 100644 (file)
@@ -46,34 +46,34 @@ public:
     JS_EXPORT_PRIVATE void addServerConnection(PlatformSocketType);
 
 private:
-    void connectionClosed(uint64_t connectionID);
+    void connectionClosed(ConnectionID);
 
-    void setTargetList(const struct Event&);
-    void setupInspectorClient(const struct Event&);
-    void setup(const struct Event&);
-    void close(const struct Event&);
-    void sendMessageToFrontend(const struct Event&);
-    void sendMessageToBackend(const struct Event&);
+    void setTargetList(const Event&);
+    void setupInspectorClient(const Event&);
+    void setup(const Event&);
+    void close(const Event&);
+    void sendMessageToFrontend(const Event&);
+    void sendMessageToBackend(const Event&);
 
-    void sendCloseEvent(uint64_t connectionID, uint64_t targetID);
+    void sendCloseEvent(ConnectionID, TargetID);
     void clientConnectionClosed();
 
-    void didAccept(ClientID, Socket::Domain) override;
-    void didClose(ClientID) override;
+    void didAccept(ConnectionID, Socket::Domain) override;
+    void didClose(ConnectionID) override;
 
-    void sendWebInspectorEvent(ClientID, const String&);
+    void sendWebInspectorEvent(ConnectionID, const String&);
 
-    HashMap<String, CallHandler>& dispatchMap();
+    HashMap<String, CallHandler>& dispatchMap() override;
 
-    HashSet<std::pair<uint64_t, uint64_t>> m_inspectionTargets;
+    HashSet<std::pair<ConnectionID, TargetID>> m_inspectionTargets;
     std::unique_ptr<RemoteInspectorSocketEndpoint> m_server;
 
     // Connections to the WebProcess.
-    Vector<ClientID> m_inspectorConnections;
+    Vector<ConnectionID> m_inspectorConnections;
     Lock m_connectionsLock;
 
     // Connections from RemoteInspectorClient.
-    Optional<ClientID> m_clientConnection;
+    Optional<ConnectionID> m_clientConnection;
 };
 
 } // namespace Inspector
index 75d2484..b431df0 100644 (file)
@@ -51,9 +51,9 @@ RemoteInspector::RemoteInspector()
     start();
 }
 
-void RemoteInspector::didClose(ClientID clientID)
+void RemoteInspector::didClose(ConnectionID id)
 {
-    if (clientID != m_clientID.value())
+    if (id != m_clientID.value())
         return;
 
     RunLoop::current().dispatch([=] {
@@ -192,7 +192,7 @@ void RemoteInspector::sendAutomaticInspectionCandidateMessage()
 {
 }
 
-void RemoteInspector::sendMessageToRemote(unsigned targetIdentifier, const String& message)
+void RemoteInspector::sendMessageToRemote(TargetID targetIdentifier, const String& message)
 {
     LockHolder lock(m_mutex);
     if (!m_socketConnection)
@@ -261,7 +261,7 @@ void RemoteInspector::receivedCloseMessage(const Event& event)
         connectionToTarget->close();
 }
 
-void RemoteInspector::setup(unsigned targetIdentifier)
+void RemoteInspector::setup(TargetID targetIdentifier)
 {
     RemoteControllableTarget* target;
     {
@@ -284,7 +284,7 @@ void RemoteInspector::setup(unsigned targetIdentifier)
     updateHasActiveDebugSession();
 }
 
-void RemoteInspector::sendMessageToTarget(unsigned targetIdentifier, const char* message)
+void RemoteInspector::sendMessageToTarget(TargetID targetIdentifier, const char* message)
 {
     if (auto connectionToTarget = m_targetConnectionMap.get(targetIdentifier))
         connectionToTarget->sendMessageToTarget(String::fromUTF8(message));
index 7bb704e..2f2dadb 100644 (file)
 
 namespace Inspector {
 
+using ConnectionID = uint32_t;
+
 #if OS(WINDOWS)
 
-using ClientID = unsigned;
 using PlatformSocketType = SOCKET;
 using PollingDescriptor = WSAPOLLFD;
 constexpr PlatformSocketType INVALID_SOCKET_VALUE = INVALID_SOCKET;
 
 #else
 
-using ClientID = unsigned;
 using PlatformSocketType = int;
 using PollingDescriptor = struct pollfd;
 constexpr PlatformSocketType INVALID_SOCKET_VALUE = -1;
index 4d339ed..647ff69 100644 (file)
@@ -69,7 +69,7 @@ void RemoteInspectorSocketEndpoint::wakeupWorkerThread()
         Socket::write(m_wakeupSendSocket, "1", 1);
 }
 
-Optional<ClientID> RemoteInspectorSocketEndpoint::connectInet(const char* serverAddress, uint16_t serverPort)
+Optional<ConnectionID> RemoteInspectorSocketEndpoint::connectInet(const char* serverAddress, uint16_t serverPort)
 {
     if (auto socket = Socket::connect(serverAddress, serverPort))
         return createClient(*socket);
@@ -86,7 +86,7 @@ bool RemoteInspectorSocketEndpoint::listenInet(uint16_t port)
     return false;
 }
 
-bool RemoteInspectorSocketEndpoint::isListening(ClientID id)
+bool RemoteInspectorSocketEndpoint::isListening(ConnectionID id)
 {
     LockHolder lock(m_connectionsLock);
     if (const auto& connection = m_connections.get(id))
@@ -100,7 +100,7 @@ void RemoteInspectorSocketEndpoint::workerThread()
 
     while (!m_shouldAbortWorkerThread) {
         Vector<PollingDescriptor> pollfds;
-        Vector<ClientID> ids;
+        Vector<ConnectionID> ids;
         {
             LockHolder lock(m_connectionsLock);
             for (const auto& connection : m_connections) {
@@ -132,14 +132,14 @@ void RemoteInspectorSocketEndpoint::workerThread()
     }
 }
 
-Optional<ClientID> RemoteInspectorSocketEndpoint::createClient(PlatformSocketType socket)
+Optional<ConnectionID> RemoteInspectorSocketEndpoint::createClient(PlatformSocketType socket)
 {
     if (!Socket::isValid(socket))
         return WTF::nullopt;
 
     LockHolder lock(m_connectionsLock);
 
-    ClientID id;
+    ConnectionID id;
     do {
         id = cryptographicallyRandomNumber();
     } while (!id || m_connections.contains(id));
@@ -151,7 +151,7 @@ Optional<ClientID> RemoteInspectorSocketEndpoint::createClient(PlatformSocketTyp
     connection->poll = Socket::preparePolling(socket);
     connection->socket = socket;
     connection->parser = std::make_unique<MessageParser>(id, Socket::BufferSize);
-    connection->parser->setDidParseMessageListener([this](ClientID id, Vector<uint8_t>&& data) {
+    connection->parser->setDidParseMessageListener([this](ConnectionID id, Vector<uint8_t>&& data) {
         if (m_inspectorClient)
             m_inspectorClient->didReceiveWebInspectorEvent(id, WTFMove(data));
     });
@@ -161,10 +161,10 @@ Optional<ClientID> RemoteInspectorSocketEndpoint::createClient(PlatformSocketTyp
     return id;
 }
 
-void RemoteInspectorSocketEndpoint::recvIfEnabled(ClientID clientID)
+void RemoteInspectorSocketEndpoint::recvIfEnabled(ConnectionID id)
 {
     LockHolder lock(m_connectionsLock);
-    if (const auto& connection = m_connections.get(clientID)) {
+    if (const auto& connection = m_connections.get(id)) {
         Vector<uint8_t> recvBuffer(Socket::BufferSize);
         if (auto readSize = Socket::read(connection->socket, recvBuffer.data(), recvBuffer.size())) {
             if (*readSize > 0)
@@ -173,18 +173,18 @@ void RemoteInspectorSocketEndpoint::recvIfEnabled(ClientID clientID)
         }
 
         Socket::close(connection->socket);
-        m_connections.remove(clientID);
+        m_connections.remove(id);
 
         lock.unlockEarly();
         if (m_inspectorClient)
-            m_inspectorClient->didClose(clientID);
+            m_inspectorClient->didClose(id);
     }
 }
 
-void RemoteInspectorSocketEndpoint::sendIfEnabled(ClientID clientID)
+void RemoteInspectorSocketEndpoint::sendIfEnabled(ConnectionID id)
 {
     LockHolder lock(m_connectionsLock);
-    if (const auto& connection = m_connections.get(clientID)) {
+    if (const auto& connection = m_connections.get(id)) {
         Socket::clearWaitingWritable(connection->poll);
 
         auto& buffer = connection->sendBuffer;
@@ -206,10 +206,10 @@ void RemoteInspectorSocketEndpoint::sendIfEnabled(ClientID clientID)
     }
 }
 
-void RemoteInspectorSocketEndpoint::send(ClientID clientID, const uint8_t* data, size_t size)
+void RemoteInspectorSocketEndpoint::send(ConnectionID id, const uint8_t* data, size_t size)
 {
     LockHolder lock(m_connectionsLock);
-    if (const auto& connection = m_connections.get(clientID)) {
+    if (const auto& connection = m_connections.get(id)) {
         auto message = MessageParser::createMessage(data, size);
         if (message.isEmpty())
             return;
@@ -234,7 +234,7 @@ void RemoteInspectorSocketEndpoint::send(ClientID clientID, const uint8_t* data,
     }
 }
 
-void RemoteInspectorSocketEndpoint::acceptInetSocketIfEnabled(ClientID id)
+void RemoteInspectorSocketEndpoint::acceptInetSocketIfEnabled(ConnectionID id)
 {
     if (!isListening(id))
         return;
index 933ab90..669a848 100644 (file)
@@ -52,23 +52,23 @@ public:
     RemoteInspectorSocketEndpoint(RemoteInspectorConnectionClient*, const char*);
     ~RemoteInspectorSocketEndpoint();
 
-    Optional<ClientID> connectInet(const char* serverAddr, uint16_t serverPort);
+    Optional<ConnectionID> connectInet(const char* serverAddr, uint16_t serverPort);
     bool listenInet(uint16_t port);
 
-    void send(ClientID, const uint8_t* data, size_t);
+    void send(ConnectionID, const uint8_t* data, size_t);
 
-    Optional<ClientID> createClient(PlatformSocketType fd);
+    Optional<ConnectionID> createClient(PlatformSocketType fd);
 
 protected:
-    void recvIfEnabled(ClientID);
-    void sendIfEnabled(ClientID);
+    void recvIfEnabled(ConnectionID);
+    void sendIfEnabled(ConnectionID);
     void workerThread();
     void wakeupWorkerThread();
-    void acceptInetSocketIfEnabled(ClientID);
-    bool isListening(ClientID);
+    void acceptInetSocketIfEnabled(ConnectionID);
+    bool isListening(ConnectionID);
 
     Lock m_connectionsLock;
-    HashMap<ClientID, std::unique_ptr<Socket::Connection>> m_connections;
+    HashMap<ConnectionID, std::unique_ptr<Socket::Connection>> m_connections;
 
     PlatformSocketType m_wakeupSendSocket { INVALID_SOCKET_VALUE };
     PlatformSocketType m_wakeupReceiveSocket { INVALID_SOCKET_VALUE };