Title: [257795] trunk/Source/_javascript_Core
Revision
257795
Author
basuke.suz...@sony.com
Date
2020-03-03 12:24:10 -0800 (Tue, 03 Mar 2020)

Log Message

[WinCairo][PlayStation] Add interface to get listening port of RemoteInspectorServer
https://bugs.webkit.org/show_bug.cgi?id=208391

Reviewed by Don Olmstead.

When passing zero as a port argument, system will pick an available port for it.
Without this method, client cannot get which port is listening.

* inspector/remote/socket/RemoteInspectorServer.cpp:
(Inspector::RemoteInspectorServer::start):
(Inspector::RemoteInspectorServer::getPort):
* inspector/remote/socket/RemoteInspectorServer.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (257794 => 257795)


--- trunk/Source/_javascript_Core/ChangeLog	2020-03-03 20:08:10 UTC (rev 257794)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-03-03 20:24:10 UTC (rev 257795)
@@ -1,3 +1,18 @@
+2020-03-03  Basuke Suzuki  <basuke.suz...@sony.com>
+
+        [WinCairo][PlayStation] Add interface to get listening port of RemoteInspectorServer
+        https://bugs.webkit.org/show_bug.cgi?id=208391
+
+        Reviewed by Don Olmstead.
+
+        When passing zero as a port argument, system will pick an available port for it.
+        Without this method, client cannot get which port is listening.
+
+        * inspector/remote/socket/RemoteInspectorServer.cpp:
+        (Inspector::RemoteInspectorServer::start):
+        (Inspector::RemoteInspectorServer::getPort):
+        * inspector/remote/socket/RemoteInspectorServer.h:
+
 2020-03-03  Yusuke Suzuki  <ysuz...@apple.com>
 
         [JSC] @hasOwnLengthProperty returns wrong value if "length" is attempted to be modified

Modified: trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.cpp (257794 => 257795)


--- trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.cpp	2020-03-03 20:08:10 UTC (rev 257794)
+++ trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.cpp	2020-03-03 20:24:10 UTC (rev 257795)
@@ -47,11 +47,23 @@
 
 bool RemoteInspectorServer::start(const char* address, uint16_t port)
 {
+    if (isRunning())
+        return false;
+
     auto& endpoint = Inspector::RemoteInspectorSocketEndpoint::singleton();
     m_server = endpoint.listenInet(address, port, *this, RemoteInspector::singleton());
     return isRunning();
 }
 
+Optional<uint16_t> RemoteInspectorServer::getPort() const
+{
+    if (!isRunning())
+        return WTF::nullopt;
+
+    const auto& endpoint = Inspector::RemoteInspectorSocketEndpoint::singleton();
+    return endpoint.getPort(m_server.value());
+}
+
 bool RemoteInspectorServer::didAccept(ConnectionID acceptedID, ConnectionID, Socket::Domain)
 {
     ASSERT(!isMainThread());

Modified: trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.h (257794 => 257795)


--- trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.h	2020-03-03 20:08:10 UTC (rev 257794)
+++ trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.h	2020-03-03 20:24:10 UTC (rev 257795)
@@ -39,6 +39,7 @@
     JS_EXPORT_PRIVATE static RemoteInspectorServer& singleton();
 
     JS_EXPORT_PRIVATE bool start(const char* address, uint16_t port);
+    JS_EXPORT_PRIVATE Optional<uint16_t> getPort() const;
     bool isRunning() const { return !!m_server; }
 
 private:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to