Changeset 244919 in webkit


Ignore:
Timestamp:
May 3, 2019 2:03:34 PM (5 years ago)
Author:
Basuke Suzuki
Message:

[WinCairo] Implement and enable RemoteInspector Server.
https://bugs.webkit.org/show_bug.cgi?id=197432

Reviewed by Ross Kirsling.

.:

Add new build flag USE_INSPECTOR_SOCKET_SERVER to indicate using Socket implementation for RemoteInspector
protocol. Currently PlayStation is the only platform which uses this. WinCairo is the second one.

  • Source/cmake/OptionsPlayStation.cmake:
  • Source/cmake/OptionsWin.cmake:
  • Source/cmake/OptionsWinCairo.cmake:

Source/JavaScriptCore:

Implement Windows implementation for Socket Backend of RemoteInspector and enable it on WinCairo
for experimental feature.

Also add listener interface for connection between RemoteInspector and RemoteInspectorServer
for flexible configuration.

  • PlatformWin.cmake:
  • inspector/remote/RemoteInspector.h:
  • inspector/remote/socket/RemoteInspectorConnectionClient.h:

(Inspector::RemoteInspectorConnectionClient::didAccept):

  • inspector/remote/socket/RemoteInspectorServer.cpp:

(Inspector::RemoteInspectorServer::connect):
(Inspector::RemoteInspectorServer::listenForTargets):
(Inspector::RemoteInspectorServer::didAccept):
(Inspector::RemoteInspectorServer::dispatchMap):
(Inspector::RemoteInspectorServer::start):
(Inspector::RemoteInspectorServer::addServerConnection): Deleted.

  • inspector/remote/socket/RemoteInspectorServer.h:

(Inspector::RemoteInspectorServer::RemoteInspectorServer):

  • inspector/remote/socket/RemoteInspectorSocket.cpp:

(Inspector::RemoteInspector::RemoteInspector):
(Inspector::RemoteInspector::dispatchMap):
(Inspector::RemoteInspector::start):
(Inspector::RemoteInspector::stopInternal):
(Inspector::RemoteInspector::setServerPort):

  • inspector/remote/socket/RemoteInspectorSocket.h:
  • inspector/remote/socket/RemoteInspectorSocketEndpoint.cpp:

(Inspector::RemoteInspectorSocketEndpoint::listenInet):
(Inspector::RemoteInspectorSocketEndpoint::getPort const):
(Inspector::RemoteInspectorSocketEndpoint::acceptInetSocketIfEnabled):

  • inspector/remote/socket/RemoteInspectorSocketEndpoint.h:
  • inspector/remote/socket/posix/RemoteInspectorSocketPOSIX.cpp:

(Inspector::Socket::init): Added.
(Inspector::Socket::listen): Signature changed.
(Inspector::Socket::getPort): Added.

  • inspector/remote/socket/win/RemoteInspectorSocketWin.cpp: Added.

(Inspector::Socket::init):
(Inspector::Socket::Socket::Socket):
(Inspector::Socket::Socket::~Socket):
(Inspector::Socket::Socket::close):
(Inspector::Socket::Socket::operator PlatformSocketType const):
(Inspector::Socket::Socket::operator bool const):
(Inspector::Socket::Socket::leak):
(Inspector::Socket::Socket::create):
(Inspector::Socket::setOpt):
(Inspector::Socket::setOptEnabled):
(Inspector::Socket::enableOpt):
(Inspector::Socket::connectTo):
(Inspector::Socket::bindAndListen):
(Inspector::Socket::connect):
(Inspector::Socket::listen):
(Inspector::Socket::accept):
(Inspector::Socket::createPair):
(Inspector::Socket::setup):
(Inspector::Socket::isValid):
(Inspector::Socket::isListening):
(Inspector::Socket::getPort):
(Inspector::Socket::read):
(Inspector::Socket::write):
(Inspector::Socket::close):
(Inspector::Socket::preparePolling):
(Inspector::Socket::poll):
(Inspector::Socket::isReadable):
(Inspector::Socket::isWritable):
(Inspector::Socket::markWaitingWritable):
(Inspector::Socket::clearWaitingWritable):

Location:
trunk
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r244907 r244919  
     12019-05-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
     2
     3        [WinCairo] Implement and enable RemoteInspector Server.
     4        https://bugs.webkit.org/show_bug.cgi?id=197432
     5
     6        Reviewed by Ross Kirsling.
     7
     8        Add new build flag USE_INSPECTOR_SOCKET_SERVER to indicate using Socket implementation for RemoteInspector
     9        protocol. Currently PlayStation is the only platform which uses this. WinCairo is the second one.
     10
     11        * Source/cmake/OptionsPlayStation.cmake:
     12        * Source/cmake/OptionsWin.cmake:
     13        * Source/cmake/OptionsWinCairo.cmake:
     14
    1152019-05-03  Commit Queue  <commit-queue@webkit.org>
    216
  • trunk/Source/JavaScriptCore/ChangeLog

    r244915 r244919  
     12019-05-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
     2
     3        [WinCairo] Implement and enable RemoteInspector Server.
     4        https://bugs.webkit.org/show_bug.cgi?id=197432
     5
     6        Reviewed by Ross Kirsling.
     7
     8        Implement Windows implementation for Socket Backend of RemoteInspector and enable it on WinCairo
     9        for experimental feature.
     10
     11        Also add listener interface for connection between RemoteInspector and RemoteInspectorServer
     12        for flexible configuration.
     13
     14        * PlatformWin.cmake:
     15        * inspector/remote/RemoteInspector.h:
     16        * inspector/remote/socket/RemoteInspectorConnectionClient.h:
     17        (Inspector::RemoteInspectorConnectionClient::didAccept):
     18        * inspector/remote/socket/RemoteInspectorServer.cpp:
     19        (Inspector::RemoteInspectorServer::connect):
     20        (Inspector::RemoteInspectorServer::listenForTargets):
     21        (Inspector::RemoteInspectorServer::didAccept):
     22        (Inspector::RemoteInspectorServer::dispatchMap):
     23        (Inspector::RemoteInspectorServer::start):
     24        (Inspector::RemoteInspectorServer::addServerConnection): Deleted.
     25        * inspector/remote/socket/RemoteInspectorServer.h:
     26        (Inspector::RemoteInspectorServer::RemoteInspectorServer):
     27        * inspector/remote/socket/RemoteInspectorSocket.cpp:
     28        (Inspector::RemoteInspector::RemoteInspector):
     29        (Inspector::RemoteInspector::dispatchMap):
     30        (Inspector::RemoteInspector::start):
     31        (Inspector::RemoteInspector::stopInternal):
     32        (Inspector::RemoteInspector::setServerPort):
     33        * inspector/remote/socket/RemoteInspectorSocket.h:
     34        * inspector/remote/socket/RemoteInspectorSocketEndpoint.cpp:
     35        (Inspector::RemoteInspectorSocketEndpoint::listenInet):
     36        (Inspector::RemoteInspectorSocketEndpoint::getPort const):
     37        (Inspector::RemoteInspectorSocketEndpoint::acceptInetSocketIfEnabled):
     38        * inspector/remote/socket/RemoteInspectorSocketEndpoint.h:
     39        * inspector/remote/socket/posix/RemoteInspectorSocketPOSIX.cpp:
     40        (Inspector::Socket::init): Added.
     41        (Inspector::Socket::listen): Signature changed.
     42        (Inspector::Socket::getPort): Added.
     43        * inspector/remote/socket/win/RemoteInspectorSocketWin.cpp: Added.
     44        (Inspector::Socket::init):
     45        (Inspector::Socket::Socket::Socket):
     46        (Inspector::Socket::Socket::~Socket):
     47        (Inspector::Socket::Socket::close):
     48        (Inspector::Socket::Socket::operator PlatformSocketType const):
     49        (Inspector::Socket::Socket::operator bool const):
     50        (Inspector::Socket::Socket::leak):
     51        (Inspector::Socket::Socket::create):
     52        (Inspector::Socket::setOpt):
     53        (Inspector::Socket::setOptEnabled):
     54        (Inspector::Socket::enableOpt):
     55        (Inspector::Socket::connectTo):
     56        (Inspector::Socket::bindAndListen):
     57        (Inspector::Socket::connect):
     58        (Inspector::Socket::listen):
     59        (Inspector::Socket::accept):
     60        (Inspector::Socket::createPair):
     61        (Inspector::Socket::setup):
     62        (Inspector::Socket::isValid):
     63        (Inspector::Socket::isListening):
     64        (Inspector::Socket::getPort):
     65        (Inspector::Socket::read):
     66        (Inspector::Socket::write):
     67        (Inspector::Socket::close):
     68        (Inspector::Socket::preparePolling):
     69        (Inspector::Socket::poll):
     70        (Inspector::Socket::isReadable):
     71        (Inspector::Socket::isWritable):
     72        (Inspector::Socket::markWaitingWritable):
     73        (Inspector::Socket::clearWaitingWritable):
     74
    1752019-05-03  Yusuke Suzuki  <ysuzuki@apple.com>
    276
  • trunk/Source/JavaScriptCore/PlatformWin.cmake

    r228898 r244919  
    3333endif ()
    3434
    35 list(REMOVE_ITEM JavaScriptCore_SOURCES
    36     inspector/JSGlobalObjectInspectorController.cpp
    37 )
     35if (ENABLE_REMOTE_INSPECTOR)
     36    list(APPEND JavaScriptCore_PRIVATE_INCLUDE_DIRECTORIES
     37        "${JAVASCRIPTCORE_DIR}/inspector/remote/socket"
     38    )
     39
     40    list(APPEND JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS
     41        inspector/remote/RemoteAutomationTarget.h
     42        inspector/remote/RemoteConnectionToTarget.h
     43        inspector/remote/RemoteControllableTarget.h
     44        inspector/remote/RemoteInspectionTarget.h
     45        inspector/remote/RemoteInspector.h
     46
     47        inspector/remote/socket/RemoteInspectorConnectionClient.h
     48        inspector/remote/socket/RemoteInspectorMessageParser.h
     49        inspector/remote/socket/RemoteInspectorServer.h
     50        inspector/remote/socket/RemoteInspectorSocket.h
     51        inspector/remote/socket/RemoteInspectorSocketEndpoint.h
     52    )
     53
     54    list(APPEND JavaScriptCore_SOURCES
     55        API/JSRemoteInspector.cpp
     56
     57        inspector/remote/RemoteAutomationTarget.cpp
     58        inspector/remote/RemoteConnectionToTarget.cpp
     59        inspector/remote/RemoteControllableTarget.cpp
     60        inspector/remote/RemoteInspectionTarget.cpp
     61        inspector/remote/RemoteInspector.cpp
     62
     63        inspector/remote/socket/RemoteInspectorConnectionClient.cpp
     64        inspector/remote/socket/RemoteInspectorMessageParser.cpp
     65        inspector/remote/socket/RemoteInspectorServer.cpp
     66        inspector/remote/socket/RemoteInspectorSocket.cpp
     67        inspector/remote/socket/RemoteInspectorSocketEndpoint.cpp
     68
     69        inspector/remote/socket/win/RemoteInspectorSocketWin.cpp
     70    )
     71
     72    list(APPEND JavaScriptCore_LIBRARIES
     73        wsock32 ws2_32
     74    )
     75else ()
     76    list(REMOVE_ITEM JavaScriptCore_SOURCES
     77        inspector/JSGlobalObjectInspectorController.cpp
     78    )
     79endif ()
    3880
    3981file(COPY
  • trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.h

    r244861 r244919  
    5454#endif
    5555
    56 #if PLATFORM(PLAYSTATION)
     56#if USE(INSPECTOR_SOCKET_SERVER)
    5757#include "RemoteConnectionToTarget.h"
    5858#include "RemoteInspectorConnectionClient.h"
     
    7878#if PLATFORM(COCOA)
    7979    : public RemoteInspectorXPCConnection::Client
    80 #elif PLATFORM(PLAYSTATION)
     80#elif USE(INSPECTOR_SOCKET_SERVER)
    8181    : public RemoteInspectorConnectionClient
    8282#endif
     
    147147    void requestAutomationSession(const char* sessionID, const Client::SessionCapabilities&);
    148148#endif
    149 #if USE(GLIB) || PLATFORM(PLAYSTATION)
     149#if USE(GLIB) || USE(INSPECTOR_SOCKET_SERVER)
    150150    void setup(TargetID);
    151151    void sendMessageToTarget(TargetID, const char* message);
    152152#endif
    153 #if PLATFORM(PLAYSTATION)
     153#if USE(INSPECTOR_SOCKET_SERVER)
    154154    static void setConnectionIdentifier(PlatformSocketType);
     155    static void setServerPort(uint16_t);
    155156#endif
    156157
     
    209210    void receivedAutomationSessionRequestMessage(NSDictionary *userInfo);
    210211#endif
    211 #if PLATFORM(PLAYSTATION)
     212#if USE(INSPECTOR_SOCKET_SERVER)
    212213    HashMap<String, CallHandler>& dispatchMap() override;
    213214    void didClose(ConnectionID) override;
     
    240241#endif
    241242
    242 #if PLATFORM(PLAYSTATION)
     243#if USE(INSPECTOR_SOCKET_SERVER)
    243244    std::unique_ptr<RemoteInspectorSocketEndpoint> m_socketConnection;
    244245    static PlatformSocketType s_connectionIdentifier;
     246    static uint16_t s_serverPort;
    245247    Optional<ConnectionID> m_clientID;
    246248#endif
  • trunk/Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorConnectionClient.h

    r244657 r244919  
    2828#if ENABLE(REMOTE_INSPECTOR)
    2929
     30#include "RemoteControllableTarget.h"
    3031#include "RemoteInspectorSocketEndpoint.h"
    3132#include <wtf/WeakPtr.h>
     
    3738public:
    3839    void didReceiveWebInspectorEvent(ConnectionID, Vector<uint8_t>&&);
    39     virtual void didAccept(ConnectionID, Socket::Domain) { };
     40    virtual void didAccept(ConnectionID acceptedID, ConnectionID listenerID, Socket::Domain) { };
    4041    virtual void didClose(ConnectionID) = 0;
    4142
  • trunk/Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp

    r244657 r244919  
    3434namespace Inspector {
    3535
    36 void RemoteInspectorServer::addServerConnection(PlatformSocketType identifier)
    37 {
    38     if (!m_server)
    39         return;
    40 
    41     if (auto id = m_server->createClient(identifier)) {
     36Optional<PlatformSocketType> RemoteInspectorServer::connect()
     37{
     38    if (!m_server) {
     39        LOG_ERROR("Inspector server is not running");
     40        return WTF::nullopt;
     41    }
     42
     43    if (auto sockets = Socket::createPair()) {
     44        if (auto id = m_server->createClient(sockets->at(0))) {
     45            LockHolder lock(m_connectionsLock);
     46            m_inspectorConnections.append(id.value());
     47
     48            return sockets->at(1);
     49        }
     50    }
     51
     52    return WTF::nullopt;
     53}
     54
     55Optional<uint16_t> RemoteInspectorServer::listenForTargets()
     56{
     57    if (!m_server) {
     58        LOG_ERROR("Inspector server is not running");
     59        return WTF::nullopt;
     60    }
     61
     62    if (m_inspectorListener) {
     63        LOG_ERROR("Inspector server is already listening for targets.");
     64        return WTF::nullopt;
     65    }
     66
     67    if (auto connection = m_server->listenInet("127.0.0.1", 0)) {
     68        m_inspectorListener = connection;
     69        return m_server->getPort(*connection);
     70    }
     71
     72    return WTF::nullopt;
     73}
     74
     75void RemoteInspectorServer::didAccept(ConnectionID acceptedID, ConnectionID listenerID, Socket::Domain type)
     76{
     77    ASSERT(!isMainThread());
     78
     79    if (type == Socket::Domain::Local || (m_inspectorListener && listenerID == *m_inspectorListener)) {
    4280        LockHolder lock(m_connectionsLock);
    43         m_inspectorConnections.append(id.value());
    44     }
    45 }
    46 
    47 void RemoteInspectorServer::didAccept(ConnectionID id, Socket::Domain type)
    48 {
    49     ASSERT(!isMainThread());
    50 
    51     if (type == Socket::Domain::Network) {
     81        m_inspectorConnections.append(acceptedID);
     82    } else if (type == Socket::Domain::Network) {
    5283        if (m_clientConnection) {
    5384            LOG_ERROR("Inspector server can accept only 1 client");
    5485            return;
    5586        }
    56         m_clientConnection = id;
    57     } else if (type == Socket::Domain::Local) {
    58         LockHolder lock(m_connectionsLock);
    59         m_inspectorConnections.append(id);
     87        m_clientConnection = acceptedID;
    6088    }
    6189}
     
    82110{
    83111    static NeverDestroyed<HashMap<String, CallHandler>> dispatchMap = HashMap<String, CallHandler>({
    84         {"SetTargetList"_s, &RemoteInspectorServer::setTargetList},
    85         {"SetupInspectorClient"_s, &RemoteInspectorServer::setupInspectorClient},
    86         {"Setup"_s, &RemoteInspectorServer::setup},
    87         {"FrontendDidClose"_s, &RemoteInspectorServer::close},
    88         {"SendMessageToFrontend"_s, &RemoteInspectorServer::sendMessageToFrontend},
    89         {"SendMessageToBackend"_s, &RemoteInspectorServer::sendMessageToBackend},
     112        { "SetTargetList"_s, reinterpret_cast<CallHandler>(&RemoteInspectorServer::setTargetList) },
     113        { "SetupInspectorClient"_s, reinterpret_cast<CallHandler>(&RemoteInspectorServer::setupInspectorClient) },
     114        { "Setup"_s, reinterpret_cast<CallHandler>(&RemoteInspectorServer::setup) },
     115        { "FrontendDidClose"_s, reinterpret_cast<CallHandler>(&RemoteInspectorServer::close) },
     116        { "SendMessageToFrontend"_s, reinterpret_cast<CallHandler>(&RemoteInspectorServer::sendMessageToFrontend) },
     117        { "SendMessageToBackend"_s, reinterpret_cast<CallHandler>(&RemoteInspectorServer::sendMessageToBackend) },
    90118    });
    91119
     
    109137    m_server = RemoteInspectorSocketEndpoint::create(this, "RemoteInspectorServer");
    110138
    111     if (!m_server->listenInet(port)) {
     139    if (!m_server->listenInet(nullptr, port)) {
    112140        m_server = nullptr;
    113141        return false;
  • trunk/Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.h

    r244657 r244919  
    4444    bool isRunning() const { return !!m_server; }
    4545
    46     JS_EXPORT_PRIVATE void addServerConnection(PlatformSocketType);
     46    JS_EXPORT_PRIVATE Optional<uint16_t> listenForTargets();
     47    JS_EXPORT_PRIVATE Optional<PlatformSocketType> connect();
    4748
    4849private:
     50    friend class NeverDestroyed<RemoteInspectorServer>;
     51    RemoteInspectorServer() { Socket::init(); }
     52
    4953    void connectionClosed(ConnectionID);
    5054
     
    5963    void clientConnectionClosed();
    6064
    61     void didAccept(ConnectionID, Socket::Domain) override;
     65    void didAccept(ConnectionID acceptedID, ConnectionID listenerID, Socket::Domain) override;
    6266    void didClose(ConnectionID) override;
    6367
     
    7377    Lock m_connectionsLock;
    7478
     79    // Listener for targets.
     80    Optional<ConnectionID> m_inspectorListener;
     81
    7582    // Connections from RemoteInspectorClient.
    7683    Optional<ConnectionID> m_clientConnection;
  • trunk/Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorSocket.cpp

    r244861 r244919  
    4040
    4141PlatformSocketType RemoteInspector::s_connectionIdentifier = INVALID_SOCKET_VALUE;
     42uint16_t RemoteInspector::s_serverPort = 0;
    4243
    4344RemoteInspector& RemoteInspector::singleton()
     
    4950RemoteInspector::RemoteInspector()
    5051{
    51     start();
     52    Socket::init();
    5253}
    5354
     
    6667{
    6768    static NeverDestroyed<HashMap<String, CallHandler>> methods = HashMap<String, CallHandler>({
    68         {"GetTargetList"_s, static_cast<CallHandler>(&RemoteInspector::receivedGetTargetListMessage)},
    69         {"Setup"_s, static_cast<CallHandler>(&RemoteInspector::receivedSetupMessage)},
    70         {"SendMessageToTarget"_s, static_cast<CallHandler>(&RemoteInspector::receivedDataMessage)},
    71         {"FrontendDidClose"_s, static_cast<CallHandler>(&RemoteInspector::receivedCloseMessage)},
     69        { "GetTargetList"_s, static_cast<CallHandler>(&RemoteInspector::receivedGetTargetListMessage) },
     70        { "Setup"_s, static_cast<CallHandler>(&RemoteInspector::receivedSetupMessage) },
     71        { "SendMessageToTarget"_s, static_cast<CallHandler>(&RemoteInspector::receivedDataMessage) },
     72        { "FrontendDidClose"_s, static_cast<CallHandler>(&RemoteInspector::receivedCloseMessage) },
    7273    });
    7374
     
    8889    LockHolder lock(m_mutex);
    8990
    90     if (m_enabled || s_connectionIdentifier == INVALID_SOCKET_VALUE)
     91    if (m_enabled || (s_connectionIdentifier == INVALID_SOCKET_VALUE && !s_serverPort))
    9192        return;
    9293
     
    9596    m_socketConnection = RemoteInspectorSocketEndpoint::create(this, "RemoteInspector");
    9697
    97     m_clientID = m_socketConnection->createClient(s_connectionIdentifier);
     98    if (s_connectionIdentifier) {
     99        m_clientID = m_socketConnection->createClient(s_connectionIdentifier);
     100        s_connectionIdentifier = INVALID_SOCKET_VALUE;
     101    } else
     102        m_clientID = m_socketConnection->connectInet("127.0.0.1", s_serverPort);
    98103
    99104    if (!m_targetMap.isEmpty())
     
    118123    m_socketConnection = nullptr;
    119124    m_clientID = WTF::nullopt;
    120     s_connectionIdentifier = INVALID_SOCKET_VALUE;
    121125}
    122126
     
    292296}
    293297
     298void RemoteInspector::setServerPort(uint16_t port)
     299{
     300    RemoteInspector::s_serverPort = port;
     301}
     302
    294303} // namespace Inspector
    295304
  • trunk/Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorSocket.h

    r244657 r244919  
    6767};
    6868
     69void init();
     70
    6971Optional<PlatformSocketType> connect(const char* serverAddress, uint16_t serverPort);
    70 Optional<PlatformSocketType> listen(uint16_t port);
     72Optional<PlatformSocketType> listen(const char* address, uint16_t port);
    7173Optional<PlatformSocketType> accept(PlatformSocketType);
    7274Optional<std::array<PlatformSocketType, 2>> createPair();
     
    7577bool isValid(PlatformSocketType);
    7678bool isListening(PlatformSocketType);
     79uint16_t getPort(PlatformSocketType);
    7780
    7881Optional<size_t> read(PlatformSocketType, void* buffer, int bufferSize);
  • trunk/Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorSocketEndpoint.cpp

    r244657 r244919  
    7777}
    7878
    79 bool RemoteInspectorSocketEndpoint::listenInet(uint16_t port)
    80 {
    81     if (auto socket = Socket::listen(port)) {
    82         if (createClient(*socket))
    83             return true;
    84     }
    85 
    86     return false;
     79Optional<ConnectionID> RemoteInspectorSocketEndpoint::listenInet(const char* address, uint16_t port)
     80{
     81    if (auto socket = Socket::listen(address, port))
     82        return createClient(*socket);
     83
     84    return WTF::nullopt;
    8785}
    8886
     
    162160}
    163161
     162Optional<uint16_t> RemoteInspectorSocketEndpoint::getPort(ConnectionID id) const
     163{
     164    LockHolder lock(m_connectionsLock);
     165    if (const auto& connection = m_connections.get(id))
     166        return Socket::getPort(connection->socket);
     167
     168    return WTF::nullopt;
     169}
     170
    164171void RemoteInspectorSocketEndpoint::recvIfEnabled(ConnectionID id)
    165172{
     
    247254            if (auto newID = createClient(*socket)) {
    248255                if (m_inspectorClient) {
    249                     m_inspectorClient->didAccept(newID.value(), Socket::Domain::Network);
     256                    m_inspectorClient->didAccept(newID.value(), id, Socket::Domain::Network);
    250257                    return;
    251258                }
  • trunk/Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorSocketEndpoint.h

    r244657 r244919  
    5454
    5555    Optional<ConnectionID> connectInet(const char* serverAddr, uint16_t serverPort);
    56     bool listenInet(uint16_t port);
     56    Optional<ConnectionID> listenInet(const char* address, uint16_t port);
    5757
    5858    void send(ConnectionID, const uint8_t* data, size_t);
    5959
    6060    Optional<ConnectionID> createClient(PlatformSocketType fd);
     61
     62    Optional<uint16_t> getPort(ConnectionID) const;
    6163
    6264protected:
     
    6870    bool isListening(ConnectionID);
    6971
    70     Lock m_connectionsLock;
     72    mutable Lock m_connectionsLock;
    7173    HashMap<ConnectionID, std::unique_ptr<Socket::Connection>> m_connections;
    7274
  • trunk/Source/JavaScriptCore/inspector/remote/socket/posix/RemoteInspectorSocketPOSIX.cpp

    r244501 r244919  
    4040namespace Socket {
    4141
     42void init()
     43{
     44}
     45
    4246Optional<PlatformSocketType> connect(const char* serverAddress, uint16_t serverPort)
    4347{
     
    6468}
    6569
    66 Optional<PlatformSocketType> listen(uint16_t port)
     70Optional<PlatformSocketType> listen(const char* addressStr, uint16_t port)
    6771{
    6872    struct sockaddr_in address = { };
     
    8892    // FIXME: Support AF_INET6 connections.
    8993    address.sin_family = AF_INET;
    90     address.sin_addr.s_addr = htonl(INADDR_ANY);
     94    if (addressStr)
     95        inet_aton(addressStr, &address.sin_addr);
     96    else
     97        address.sin_addr.s_addr = htonl(INADDR_ANY);
    9198    address.sin_port = htons(port);
    9299    error = ::bind(fdListen, (struct sockaddr*)&address, sizeof(address));
     
    156163}
    157164
     165uint16_t getPort(PlatformSocketType socket)
     166{
     167    ASSERT(isValid(socket));
     168
     169    struct sockaddr_in address = { };
     170    int len = sizeof(address);
     171    getsockname(socket, reinterpret_cast<struct sockaddr*>(&address), &len);
     172    return address.sin_port;
     173}
     174
    158175Optional<size_t> read(PlatformSocketType socket, void* buffer, int bufferSize)
    159176{
  • trunk/Source/cmake/OptionsPlayStation.cmake

    r244859 r244919  
    109109SET_AND_EXPOSE_TO_BUILD(USE_HARFBUZZ ON)
    110110SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE ON)
     111SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ENABLE_REMOTE_INSPECTOR)
    111112
    112113# Rendering options
  • trunk/Source/cmake/OptionsWin.cmake

    r244741 r244919  
    6868WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
    6969
    70 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE OFF)
    7170WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE OFF)
    7271WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE OFF)
     
    9392    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
    9493    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VARIATION_FONTS PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
     94    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
    9595
    9696    # FIXME: Implement plugin process on Modern WebKit. https://bugs.webkit.org/show_bug.cgi?id=185313
     
    101101    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE OFF)
    102102    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC OFF)
     103    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE OFF)
    103104    WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_VERSION_STAMPER PRIVATE ON)
    104105endif ()
  • trunk/Source/cmake/OptionsWinCairo.cmake

    r244541 r244919  
    2929SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL ON)
    3030SET_AND_EXPOSE_TO_BUILD(USE_MEDIA_FOUNDATION ON)
     31SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ENABLE_REMOTE_INSPECTOR)
    3132
    3233set(ENABLE_GRAPHICS_CONTEXT_3D ON)
Note: See TracChangeset for help on using the changeset viewer.