Changeset 136770 in webkit


Ignore:
Timestamp:
Dec 5, 2012 3:28:31 PM (11 years ago)
Author:
ap@apple.com
Message:

[WK2] Would like to queue messages while NetworkProcess is launching
https://bugs.webkit.org/show_bug.cgi?id=104143

Reviewed by Anders Carlsson.

Factored out process launching and message sending code to a ChildProcessProxy class.
Process closing and crashing code should be moved once we better understand common
requirements for the processes.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebKit2.xcodeproj/project.pbxproj:
  • win/WebKit2.vcproj: Added ChildProcessProxy files.
  • Shared/ChildProcessProxy.cpp: Added. (WebKit::ChildProcessProxy::ChildProcessProxy): (WebKit::ChildProcessProxy::~ChildProcessProxy): (WebKit::ChildProcessProxy::fromConnection): (WebKit::ChildProcessProxy::connect): (WebKit::ChildProcessProxy::terminate): (WebKit::ChildProcessProxy::sendMessage): (WebKit::ChildProcessProxy::isLaunching): (WebKit::ChildProcessProxy::didFinishLaunching): (WebKit::ChildProcessProxy::clearConnection):
  • Shared/ChildProcessProxy.h: Added. (WebKit::ChildProcessProxy::connection): (WebKit::ChildProcessProxy::isValid): (WebKit::ChildProcessProxy::canSendMessage): (WebKit::ChildProcessProxy::processIdentifier): (WebKit::ChildProcessProxy::send): (WebKit::ChildProcessProxy::sendSync): Moved code from WebProcessProxy. Every ChildProcessProxy is a connection client, but every one is a connection queue client, so that latter is passed as an argument.
  • UIProcess/Network/NetworkProcessProxy.h:
  • UIProcess/Network/NetworkProcessProxy.cpp: Removed unused syncMessageSendTimedOut(), thank you OVERRIDE.
  • UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::NetworkProcessProxy): (WebKit::NetworkProcessProxy::getLaunchOptions): (WebKit::NetworkProcessProxy::~NetworkProcessProxy): (WebKit::NetworkProcessProxy::getNetworkProcessConnection): (WebKit::NetworkProcessProxy::didFinishLaunching):
  • UIProcess/Network/NetworkProcessProxy.h:
  • UIProcess/Network/mac/NetworkProcessProxyMac.mm: (WebKit::NetworkProcessProxy::setApplicationIsOccluded):
  • UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::WebProcessProxy): (WebKit::WebProcessProxy::~WebProcessProxy): (WebKit::WebProcessProxy::getLaunchOptions): (WebKit::WebProcessProxy::disconnect): (WebKit::WebProcessProxy::didFinishLaunching): Use shared code.
  • UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::fromConnection): NetworkProcess inherits from conneciton client privately, so we need to do most of the work in ClientProcessProxy, and further upcast here.
  • UIProcess/efl/WebProcessProxyEfl.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions):
  • UIProcess/gtk/WebProcessProxyGtk.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions):
  • UIProcess/mac/WebProcessProxyMac.mm: (WebKit::WebProcessProxy::platformGetLaunchOptions):
  • UIProcess/qt/WebProcessProxyQt.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions):
  • UIProcess/win/WebProcessProxyWin.cpp: (WebKit::WebProcessProxy::platformGetLaunchOptions): Updated for renaming, platformConnect -> platformGetLaunchOptions().
Location:
trunk/Source/WebKit2
Files:
2 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/CMakeLists.txt

    r136760 r136770  
    138138    Shared/APIObject.cpp
    139139    Shared/ChildProcess.cpp
     140    Shared/ChildProcessProxy.cpp
    140141    Shared/ConnectionStack.cpp
    141142    Shared/DictionaryPopupInfo.cpp
  • trunk/Source/WebKit2/ChangeLog

    r136766 r136770  
     12012-12-05  Alexey Proskuryakov  <ap@apple.com>
     2
     3        [WK2] Would like to queue messages while NetworkProcess is launching
     4        https://bugs.webkit.org/show_bug.cgi?id=104143
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Factored out process launching and message sending code to a ChildProcessProxy class.
     9        Process closing and crashing code should be moved once we better understand common
     10        requirements for the processes.
     11
     12        * CMakeLists.txt:
     13        * GNUmakefile.list.am:
     14        * Target.pri:
     15        * WebKit2.xcodeproj/project.pbxproj:
     16        * win/WebKit2.vcproj:
     17        Added ChildProcessProxy files.
     18
     19        * Shared/ChildProcessProxy.cpp: Added.
     20        (WebKit::ChildProcessProxy::ChildProcessProxy):
     21        (WebKit::ChildProcessProxy::~ChildProcessProxy):
     22        (WebKit::ChildProcessProxy::fromConnection):
     23        (WebKit::ChildProcessProxy::connect):
     24        (WebKit::ChildProcessProxy::terminate):
     25        (WebKit::ChildProcessProxy::sendMessage):
     26        (WebKit::ChildProcessProxy::isLaunching):
     27        (WebKit::ChildProcessProxy::didFinishLaunching):
     28        (WebKit::ChildProcessProxy::clearConnection):
     29        * Shared/ChildProcessProxy.h: Added.
     30        (WebKit::ChildProcessProxy::connection):
     31        (WebKit::ChildProcessProxy::isValid):
     32        (WebKit::ChildProcessProxy::canSendMessage):
     33        (WebKit::ChildProcessProxy::processIdentifier):
     34        (WebKit::ChildProcessProxy::send):
     35        (WebKit::ChildProcessProxy::sendSync):
     36        Moved code from WebProcessProxy. Every ChildProcessProxy is a connection client,
     37        but every one is a connection queue client, so that latter is passed as an argument.
     38
     39        * UIProcess/Network/NetworkProcessProxy.h:
     40        * UIProcess/Network/NetworkProcessProxy.cpp:
     41        Removed unused syncMessageSendTimedOut(), thank you OVERRIDE.
     42
     43        * UIProcess/Network/NetworkProcessProxy.cpp:
     44        (WebKit::NetworkProcessProxy::NetworkProcessProxy):
     45        (WebKit::NetworkProcessProxy::getLaunchOptions):
     46        (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
     47        (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
     48        (WebKit::NetworkProcessProxy::didFinishLaunching):
     49        * UIProcess/Network/NetworkProcessProxy.h:
     50        * UIProcess/Network/mac/NetworkProcessProxyMac.mm:
     51        (WebKit::NetworkProcessProxy::setApplicationIsOccluded):
     52        * UIProcess/WebProcessProxy.cpp:
     53        (WebKit::WebProcessProxy::WebProcessProxy):
     54        (WebKit::WebProcessProxy::~WebProcessProxy):
     55        (WebKit::WebProcessProxy::getLaunchOptions):
     56        (WebKit::WebProcessProxy::disconnect):
     57        (WebKit::WebProcessProxy::didFinishLaunching):
     58        Use shared code.
     59
     60        * UIProcess/WebProcessProxy.h: (WebKit::WebProcessProxy::fromConnection):
     61        NetworkProcess inherits from conneciton client privately, so we need to do most
     62        of the work in ClientProcessProxy, and further upcast here.
     63
     64        * UIProcess/efl/WebProcessProxyEfl.cpp:
     65        (WebKit::WebProcessProxy::platformGetLaunchOptions):
     66        * UIProcess/gtk/WebProcessProxyGtk.cpp:
     67        (WebKit::WebProcessProxy::platformGetLaunchOptions):
     68        * UIProcess/mac/WebProcessProxyMac.mm:
     69        (WebKit::WebProcessProxy::platformGetLaunchOptions):
     70        * UIProcess/qt/WebProcessProxyQt.cpp:
     71        (WebKit::WebProcessProxy::platformGetLaunchOptions):
     72        * UIProcess/win/WebProcessProxyWin.cpp:
     73        (WebKit::WebProcessProxy::platformGetLaunchOptions):
     74        Updated for renaming, platformConnect -> platformGetLaunchOptions().
     75
    1762012-12-05  Kiran Muppala  <cmuppala@apple.com>
    277
  • trunk/Source/WebKit2/GNUmakefile.list.am

    r136354 r136770  
    370370        Source/WebKit2/Shared/ChildProcess.cpp \
    371371        Source/WebKit2/Shared/ChildProcess.h \
     372        Source/WebKit2/Shared/ChildProcessProxy.cpp \
     373        Source/WebKit2/Shared/ChildProcessProxy.h \
    372374        Source/WebKit2/Shared/CommandLine.h \
    373375        Source/WebKit2/Shared/ConnectionStack.cpp \
     
    12751277        Source/WebKit2/Shared/ChildProcess.cpp \
    12761278        Source/WebKit2/Shared/ChildProcess.h \
     1279        Source/WebKit2/Shared/ChildProcessProxy.cpp \
     1280        Source/WebKit2/Shared/ChildProcessProxy.h \
    12771281        Source/WebKit2/Shared/ConnectionStack.cpp \
    12781282        Source/WebKit2/Shared/ConnectionStack.h \
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp

    r133045 r136770  
    9393}
    9494
    95 void NetworkProcess::syncMessageSendTimedOut(CoreIPC::Connection*)
    96 {
    97 }
    98 
    9995void NetworkProcess::initializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
    10096{
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h

    r133045 r136770  
    6060
    6161    // ChildProcess
    62     virtual bool shouldTerminate();
     62    virtual bool shouldTerminate() OVERRIDE;
    6363
    6464    // CoreIPC::Connection::Client
    65     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
    66     virtual void didClose(CoreIPC::Connection*);
    67     virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName);
    68     virtual void syncMessageSendTimedOut(CoreIPC::Connection*);
     65    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
     66    virtual void didClose(CoreIPC::Connection*) OVERRIDE;
     67    virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE;
    6968
    7069    // Message Handlers
  • trunk/Source/WebKit2/Target.pri

    r136760 r136770  
    7575    Shared/CacheModel.h \
    7676    Shared/ChildProcess.h \
     77    Shared/ChildProcessProxy.h \
    7778    Shared/ConnectionStack.h \
    7879    Shared/DictionaryPopupInfo.h \
     
    451452    Shared/Plugins/PluginProcessCreationParameters.cpp \
    452453    Shared/ChildProcess.cpp \
     454    Shared/ChildProcessProxy.cpp \
    453455    Shared/ConnectionStack.cpp \
    454456    Shared/DictionaryPopupInfo.cpp \
  • trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp

    r133699 r136770  
    4949    , m_numPendingConnectionRequests(0)
    5050{
    51     ProcessLauncher::LaunchOptions launchOptions;
     51    connect();
     52}
     53
     54void NetworkProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
     55{
    5256    launchOptions.processType = ProcessLauncher::NetworkProcess;
    5357
     
    5963#endif
    6064#endif
    61 
    62     m_processLauncher = ProcessLauncher::create(this, launchOptions);
    6365}
    6466
    6567NetworkProcessProxy::~NetworkProcessProxy()
    6668{
    67 
    6869}
    6970
     
    7273    m_pendingConnectionReplies.append(reply);
    7374
    74     if (m_processLauncher->isLaunching()) {
     75    if (isLaunching()) {
    7576        m_numPendingConnectionRequests++;
    7677        return;
    7778    }
    7879
    79     m_connection->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
     80    connection()->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
    8081}
    8182
     
    115116void NetworkProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference)
    116117{
    117 
    118 }
    119 
    120 void NetworkProcessProxy::syncMessageSendTimedOut(CoreIPC::Connection*)
    121 {
    122 
    123118}
    124119
     
    137132}
    138133
    139 void NetworkProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier connectionIdentifier)
     134void NetworkProcessProxy::didFinishLaunching(ProcessLauncher* launcher, CoreIPC::Connection::Identifier connectionIdentifier)
    140135{
    141     ASSERT(!m_connection);
     136    ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
    142137
    143138    if (CoreIPC::Connection::identifierIsNull(connectionIdentifier)) {
     
    146141    }
    147142
    148     m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main());
    149 #if PLATFORM(MAC)
    150     m_connection->setShouldCloseConnectionOnMachExceptions();
    151 #endif
    152 
    153     m_connection->open();
    154 
    155143    NetworkProcessCreationParameters parameters;
    156144    platformInitializeNetworkProcess(parameters);
    157145
    158146    // Initialize the network host process.
    159     m_connection->send(Messages::NetworkProcess::InitializeNetworkProcess(parameters), 0);
     147    connection()->send(Messages::NetworkProcess::InitializeNetworkProcess(parameters), 0);
    160148
    161149    for (unsigned i = 0; i < m_numPendingConnectionRequests; ++i)
    162         m_connection->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0);
     150        connection()->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0);
    163151   
    164152    m_numPendingConnectionRequests = 0;
     
    166154#if PLATFORM(MAC)
    167155    if (WebContext::applicationIsOccluded())
    168         m_connection->send(Messages::NetworkProcess::SetApplicationIsOccluded(true), 0);
     156        connection()->send(Messages::NetworkProcess::SetApplicationIsOccluded(true), 0);
    169157#endif
    170158}
  • trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h

    r133699 r136770  
    2929#if ENABLE(NETWORK_PROCESS)
    3030
     31#include "ChildProcessProxy.h"
    3132#include "Connection.h"
    3233#include "ProcessLauncher.h"
     
    3940struct NetworkProcessCreationParameters;
    4041
    41 class NetworkProcessProxy : public RefCounted<NetworkProcessProxy>, CoreIPC::Connection::Client, ProcessLauncher::Client {
     42class NetworkProcessProxy : public RefCounted<NetworkProcessProxy>, public ChildProcessProxy {
    4243public:
    4344    static PassRefPtr<NetworkProcessProxy> create(NetworkProcessManager*);
     
    4546
    4647    void getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>);
    47 
    48     bool isValid() const { return m_connection; }
    4948
    5049#if PLATFORM(MAC)
     
    5554    NetworkProcessProxy(NetworkProcessManager*);
    5655
     56    virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) OVERRIDE;
    5757    void platformInitializeNetworkProcess(NetworkProcessCreationParameters&);
    5858
     
    6060
    6161    // CoreIPC::Connection::Client
    62     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
    63     virtual void didClose(CoreIPC::Connection*);
    64     virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName);
    65     virtual void syncMessageSendTimedOut(CoreIPC::Connection*);
     62    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
     63    virtual void didClose(CoreIPC::Connection*) OVERRIDE;
     64    virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE;
    6665
    6766    // Message handlers
     
    7170    // ProcessLauncher::Client
    7271    virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier);
    73 
    74     // The connection to the network process.
    75     RefPtr<CoreIPC::Connection> m_connection;
    76 
    77     // The process launcher for the network process.
    78     RefPtr<ProcessLauncher> m_processLauncher;
    7972
    8073    NetworkProcessManager* m_networkProcessManager;
  • trunk/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm

    r133699 r136770  
    4646        return;
    4747   
    48     m_connection->send(Messages::NetworkProcess::SetApplicationIsOccluded(applicationIsOccluded), 0);
     48    connection()->send(Messages::NetworkProcess::SetApplicationIsOccluded(applicationIsOccluded), 0);
    4949}
    5050
  • trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp

    r136193 r136770  
    9191
    9292WebProcessProxy::WebProcessProxy(PassRefPtr<WebContext> context)
    93     : m_responsivenessTimer(this)
     93    : ChildProcessProxy(this)
     94    , m_responsivenessTimer(this)
    9495    , m_context(context)
    9596    , m_mayHaveUniversalFileReadSandboxExtension(false)
     
    103104WebProcessProxy::~WebProcessProxy()
    104105{
    105     if (m_connection)
    106         m_connection->invalidate();
    107 
    108106    if (m_webConnection)
    109107        m_webConnection->invalidate();
    110 
    111     for (size_t i = 0; i < m_pendingMessages.size(); ++i)
    112         m_pendingMessages[i].first.releaseArguments();
    113 
    114     if (m_processLauncher) {
    115         m_processLauncher->invalidate();
    116         m_processLauncher = 0;
    117     }
    118 }
    119 
    120 WebProcessProxy* WebProcessProxy::fromConnection(CoreIPC::Connection* connection)
    121 {
    122     ASSERT(connection);
    123 
    124     WebProcessProxy* webProcessProxy = static_cast<WebProcessProxy*>(connection->client());
    125     ASSERT(webProcessProxy->connection() == connection);
    126 
    127     return webProcessProxy;
    128 }
    129 
    130 void WebProcessProxy::connect()
    131 {
    132     ASSERT(!m_processLauncher);
    133 
    134     ProcessLauncher::LaunchOptions launchOptions;
     108}
     109
     110void WebProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
     111{
    135112    launchOptions.processType = ProcessLauncher::WebProcess;
    136     platformConnect(launchOptions);
    137    
    138     m_processLauncher = ProcessLauncher::create(this, launchOptions);
     113    platformGetLaunchOptions(launchOptions);
    139114}
    140115
    141116void WebProcessProxy::disconnect()
    142117{
    143     if (m_connection) {
    144         m_connection->removeQueueClient(this);
    145         m_connection->invalidate();
    146         m_connection = nullptr;
    147     }
     118    clearConnection();
    148119
    149120    if (m_webConnection) {
     
    162133
    163134    m_context->disconnectProcess(this);
    164 }
    165 
    166 bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreIPC::MessageEncoder> encoder, unsigned messageSendFlags)
    167 {
    168     // If we're waiting for the web process to launch, we need to stash away the messages so we can send them once we have
    169     // a CoreIPC connection.
    170     if (isLaunching()) {
    171         m_pendingMessages.append(make_pair(CoreIPC::Connection::OutgoingMessage(messageID, encoder), messageSendFlags));
    172         return true;
    173     }
    174 
    175     // If the web process has exited, m_connection will be null here.
    176     if (!m_connection)
    177         return false;
    178 
    179     return connection()->sendMessage(messageID, encoder, messageSendFlags);
    180 }
    181 
    182 bool WebProcessProxy::isLaunching() const
    183 {
    184     if (m_processLauncher)
    185         return m_processLauncher->isLaunching();
    186 
    187     return false;
    188 }
    189 
    190 void WebProcessProxy::terminate()
    191 {
    192     if (m_processLauncher)
    193         m_processLauncher->terminateProcess();
    194135}
    195136
     
    555496}
    556497
    557 void WebProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier connectionIdentifier)
    558 {
    559     didFinishLaunching(connectionIdentifier);
    560 }
    561 
    562 void WebProcessProxy::didFinishLaunching(CoreIPC::Connection::Identifier connectionIdentifier)
    563 {
    564     ASSERT(!m_connection);
    565 
    566     m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main());
    567 #if OS(DARWIN)
    568     m_connection->setShouldCloseConnectionOnMachExceptions();
    569 #elif PLATFORM(QT) && !OS(WINDOWS)
    570     m_connection->setShouldCloseConnectionOnProcessTermination(processIdentifier());
    571 #endif
    572 
    573     m_connection->addQueueClient(this);
    574     m_connection->open();
     498void WebProcessProxy::didFinishLaunching(ProcessLauncher* launcher, CoreIPC::Connection::Identifier connectionIdentifier)
     499{
     500    ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
    575501
    576502    m_webConnection = WebConnectionToWebProcess::create(this);
    577 
    578     for (size_t i = 0; i < m_pendingMessages.size(); ++i) {
    579         CoreIPC::Connection::OutgoingMessage& outgoingMessage = m_pendingMessages[i].first;
    580         unsigned messageSendFlags = m_pendingMessages[i].second;
    581         connection()->sendMessage(outgoingMessage.messageID(), adoptPtr(outgoingMessage.arguments()), messageSendFlags);
    582     }
    583 
    584     m_pendingMessages.clear();
    585503
    586504    // Tell the context that we finished launching.
  • trunk/Source/WebKit2/UIProcess/WebProcessProxy.h

    r136612 r136770  
    2727#define WebProcessProxy_h
    2828
     29#include "ChildProcessProxy.h"
    2930#include "MessageReceiverMap.h"
    3031#include "PlatformProcessIdentifier.h"
     
    6162struct WebNavigationDataStore;
    6263
    63 class WebProcessProxy : public ThreadSafeRefCounted<WebProcessProxy>, CoreIPC::Connection::Client, ResponsivenessTimer::Client, ProcessLauncher::Client, CoreIPC::Connection::QueueClient {
     64class WebProcessProxy : public ThreadSafeRefCounted<WebProcessProxy>, public ChildProcessProxy, ResponsivenessTimer::Client, CoreIPC::Connection::QueueClient {
    6465public:
    6566    typedef HashMap<uint64_t, RefPtr<WebFrameProxy> > WebFrameProxyMap;
     
    6970    ~WebProcessProxy();
    7071
    71     static WebProcessProxy* fromConnection(CoreIPC::Connection*);
    72 
    73     void terminate();
    74 
    75     template<typename T> bool send(const T& message, uint64_t destinationID, unsigned messageSendFlags = 0);
    76     template<typename U> bool sendSync(const U& message, const typename U::Reply& reply, uint64_t destinationID, double timeout = 1);
    77    
    78     CoreIPC::Connection* connection() const
    79     {
    80         ASSERT(m_connection);
    81         return m_connection.get();
     72    static WebProcessProxy* fromConnection(CoreIPC::Connection* connection)
     73    {
     74        return static_cast<WebProcessProxy*>(ChildProcessProxy::fromConnection(connection));
    8275    }
    8376
     
    8982
    9083    WebContext* context() const { return m_context.get(); }
    91 
    92     PlatformProcessIdentifier processIdentifier() const { return m_processLauncher->processIdentifier(); }
    9384
    9485    WebPageProxy* webPage(uint64_t pageID) const;
     
    10697    ResponsivenessTimer* responsivenessTimer() { return &m_responsivenessTimer; }
    10798
    108     bool isValid() const { return m_connection; }
    109     bool isLaunching() const;
    110     bool canSendMessage() const { return isValid() || isLaunching(); }
    111 
    11299    WebFrameProxy* webFrame(uint64_t) const;
    113100    bool canCreateFrame(uint64_t frameID) const;
     
    131118    explicit WebProcessProxy(PassRefPtr<WebContext>);
    132119
    133     // Initializes the process launcher which will begin launching the process.
    134     void connect();
    135     void platformConnect(ProcessLauncher::LaunchOptions&);
     120    void getLaunchOptions(ProcessLauncher::LaunchOptions&);
     121    void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&);
    136122
    137123    // Called when the web process has crashed or we know that it will terminate soon.
    138124    // Will potentially cause the WebProcessProxy object to be freed.
    139125    void disconnect();
    140 
    141     bool sendMessage(CoreIPC::MessageID, PassOwnPtr<CoreIPC::MessageEncoder>, unsigned messageSendFlags);
    142126
    143127    // CoreIPC message handlers.
     
    173157    // CoreIPC::Connection::Client
    174158    friend class WebConnectionToWebProcess;
    175     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
    176     virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&);
    177     virtual void didClose(CoreIPC::Connection*);
    178     virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName);
     159    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
     160    virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&) OVERRIDE;
     161    virtual void didClose(CoreIPC::Connection*) OVERRIDE;
     162    virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE;
    179163#if PLATFORM(WIN)
    180     virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply();
     164    virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply() OVERRIDE;
    181165#endif
    182166
     
    190174
    191175    // ProcessLauncher::Client
    192     virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier);
    193 
    194     void didFinishLaunching(CoreIPC::Connection::Identifier);
     176    virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier) OVERRIDE;
    195177
    196178    // History client
     
    207189    ResponsivenessTimer m_responsivenessTimer;
    208190   
    209 
    210     RefPtr<CoreIPC::Connection> m_connection;
    211191    RefPtr<WebConnectionToWebProcess> m_webConnection;
    212192    CoreIPC::MessageReceiverMap m_messageReceiverMap;
    213 
    214     Vector<std::pair<CoreIPC::Connection::OutgoingMessage, unsigned> > m_pendingMessages;
    215     RefPtr<ProcessLauncher> m_processLauncher;
    216193
    217194    RefPtr<WebContext> m_context;
     
    228205#endif
    229206};
    230 
    231 template<typename T>
    232 bool WebProcessProxy::send(const T& message, uint64_t destinationID, unsigned messageSendFlags)
    233 {
    234     COMPILE_ASSERT(!T::isSync, AsyncMessageExpected);
    235 
    236     OwnPtr<CoreIPC::MessageEncoder> encoder = CoreIPC::MessageEncoder::create(T::receiverName(), T::name(), destinationID);
    237     encoder->encode(message);
    238 
    239     return sendMessage(CoreIPC::MessageID(T::messageID), encoder.release(), messageSendFlags);
    240 }
    241 
    242 template<typename U>
    243 bool WebProcessProxy::sendSync(const U& message, const typename U::Reply& reply, uint64_t destinationID, double timeout)
    244 {
    245     COMPILE_ASSERT(U::isSync, SyncMessageExpected);
    246 
    247     if (!m_connection)
    248         return false;
    249 
    250     return connection()->sendSync(message, reply, destinationID, timeout);
    251 }
    252207   
    253208} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/efl/WebProcessProxyEfl.cpp

    r129451 r136770  
    2929namespace WebKit {
    3030
    31 void WebProcessProxy::platformConnect(ProcessLauncher::LaunchOptions& launchOptions)
     31void WebProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
    3232{
    3333#ifndef NDEBUG
  • trunk/Source/WebKit2/UIProcess/gtk/WebProcessProxyGtk.cpp

    r129451 r136770  
    2929namespace WebKit {
    3030
    31 void WebProcessProxy::platformConnect(ProcessLauncher::LaunchOptions&)
     31void WebProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions&)
    3232{
    3333}
  • trunk/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm

    r136612 r136770  
    113113#endif
    114114
    115 void WebProcessProxy::platformConnect(ProcessLauncher::LaunchOptions& launchOptions)
     115void WebProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
    116116{
    117117    // We want the web process to match the architecture of the UI process.
  • trunk/Source/WebKit2/UIProcess/qt/WebProcessProxyQt.cpp

    r129451 r136770  
    2929namespace WebKit {
    3030
    31 void WebProcessProxy::platformConnect(ProcessLauncher::LaunchOptions&)
     31void WebProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions&)
    3232{
    3333}
  • trunk/Source/WebKit2/UIProcess/win/WebProcessProxyWin.cpp

    r129451 r136770  
    3434}
    3535
    36 void WebProcessProxy::platformConnect(ProcessLauncher::LaunchOptions&)
     36void WebProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions&)
    3737{
    3838}
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r136612 r136770  
    10181018                E134F01A12EA5D99004EC58D /* WKPrintingView.mm in Sources */ = {isa = PBXBuildFile; fileRef = E134F01912EA5D99004EC58D /* WKPrintingView.mm */; };
    10191019                E13A8A30162879AC00392929 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E13A8A2F162879AC00392929 /* Cocoa.framework */; };
     1020                E1513C66166EABB200149FCB /* ChildProcessProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */; };
     1021                E1513C67166EABB200149FCB /* ChildProcessProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = E1513C65166EABB200149FCB /* ChildProcessProxy.h */; };
    10201022                E179FD9C134D38060015B883 /* ArgumentCodersMac.h in Headers */ = {isa = PBXBuildFile; fileRef = E179FD9B134D38060015B883 /* ArgumentCodersMac.h */; };
    10211023                E179FD9F134D38250015B883 /* ArgumentCodersMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E179FD9E134D38250015B883 /* ArgumentCodersMac.mm */; };
     
    23092311                E14E99F814D879B4001D221F /* PluginProcess.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PluginProcess.entitlements; sourceTree = "<group>"; };
    23102312                E14E99F914D879C9001D221F /* add-entitlements.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "add-entitlements.sh"; sourceTree = "<group>"; };
     2313                E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChildProcessProxy.cpp; sourceTree = "<group>"; };
     2314                E1513C65166EABB200149FCB /* ChildProcessProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcessProxy.h; sourceTree = "<group>"; };
    23112315                E179FD9B134D38060015B883 /* ArgumentCodersMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentCodersMac.h; sourceTree = "<group>"; };
    23122316                E179FD9E134D38250015B883 /* ArgumentCodersMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ArgumentCodersMac.mm; sourceTree = "<group>"; };
     
    27572761                                1A2D956E12848564001EB962 /* ChildProcess.cpp */,
    27582762                                1A2D956D12848564001EB962 /* ChildProcess.h */,
     2763                                E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */,
     2764                                E1513C65166EABB200149FCB /* ChildProcessProxy.h */,
    27592765                                1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
    27602766                                5136183B163126DA00A99DDE /* ConnectionStack.cpp */,
     
    49965002                                BC8ACA1316670D89004C1941 /* ObjCObjectGraph.h in Headers */,
    49975003                                BC8ACA1516670D89004C1941 /* ObjCObjectGraphCoders.h in Headers */,
     5004                                E1513C67166EABB200149FCB /* ChildProcessProxy.h in Headers */,
    49985005                        );
    49995006                        runOnlyForDeploymentPostprocessing = 0;
     
    59495956                                BC8ACA1416670D89004C1941 /* ObjCObjectGraph.mm in Sources */,
    59505957                                BC8ACA1616670D89004C1941 /* ObjCObjectGraphCoders.mm in Sources */,
     5958                                E1513C66166EABB200149FCB /* ChildProcessProxy.cpp in Sources */,
    59515959                        );
    59525960                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebKit2/win/WebKit2.vcproj

    r132085 r136770  
    424424                        </File>
    425425                        <File
     426                                RelativePath="..\Shared\ChildProcessProxy.cpp"
     427                                >
     428                        </File>
     429                        <File
     430                                RelativePath="..\Shared\ChildProcessProxy.h"
     431                                >
     432                        </File>
     433                        <File
    426434                                RelativePath="..\Shared\CommandLine.h"
    427435                                >
Note: See TracChangeset for help on using the changeset viewer.