Changeset 84288 in webkit


Ignore:
Timestamp:
Apr 19, 2011 1:47:21 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-04-19 Anders Carlsson <andersca@apple.com>

Reviewed by Alexey Proskuryakov.

Replace the didFailToSendSyncMessage Connection::Client function with a flag
https://bugs.webkit.org/show_bug.cgi?id=58923

  • Platform/CoreIPC/Connection.cpp: (CoreIPC::Connection::Connection): Initialize m_shouldExitOnSyncMessageSendFailure to false.

(CoreIPC::Connection::setShouldExitOnSyncMessageSendFailure):
Set m_didCloseOnConnectionWorkQueueCallback.

(CoreIPC::Connection::sendSyncMessage):
Call didFailToSendSyncMessage if we fail to send the sync message for some reason.

(CoreIPC::Connection::didFailToSendSyncMessage):
if m_shouldExitOnSyncMessageSendFailure is true, exit.

  • Platform/CoreIPC/Connection.h: Remove didFailToSendSyncMessage from Connection::Client.
  • PluginProcess/PluginProcess.cpp:
  • PluginProcess/PluginProcess.h: Remove didFailToSendSyncMessage.
  • WebProcess/WebProcess.cpp: (WebKit::WebProcess::initialize):
  • WebProcess/WebProcess.h: Remove didFailToSendSyncMessage. Call setShouldExitOnSyncMessageSendFailure on our UI process connection.
Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r84281 r84288  
     12011-04-19  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Replace the didFailToSendSyncMessage Connection::Client function with a flag
     6        https://bugs.webkit.org/show_bug.cgi?id=58923
     7
     8        * Platform/CoreIPC/Connection.cpp:
     9        (CoreIPC::Connection::Connection):
     10        Initialize m_shouldExitOnSyncMessageSendFailure to false.
     11
     12        (CoreIPC::Connection::setShouldExitOnSyncMessageSendFailure):
     13        Set m_didCloseOnConnectionWorkQueueCallback.
     14
     15        (CoreIPC::Connection::sendSyncMessage):
     16        Call didFailToSendSyncMessage if we fail to send the sync message for some reason.
     17
     18        (CoreIPC::Connection::didFailToSendSyncMessage):
     19        if m_shouldExitOnSyncMessageSendFailure is true, exit.
     20
     21        * Platform/CoreIPC/Connection.h:
     22        Remove didFailToSendSyncMessage from Connection::Client.
     23
     24        * PluginProcess/PluginProcess.cpp:
     25        * PluginProcess/PluginProcess.h:
     26        Remove didFailToSendSyncMessage.
     27
     28        * WebProcess/WebProcess.cpp:
     29        (WebKit::WebProcess::initialize):
     30        * WebProcess/WebProcess.h:
     31        Remove didFailToSendSyncMessage. Call setShouldExitOnSyncMessageSendFailure on our
     32        UI process connection.
     33
    1342011-04-19  Anders Carlsson  <andersca@apple.com>
    235
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp

    r84281 r84288  
    198198    , m_syncRequestID(0)
    199199    , m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(false)
     200    , m_shouldExitOnSyncMessageSendFailure(false)
    200201    , m_didCloseOnConnectionWorkQueueCallback(0)
    201202    , m_isConnected(false)
     
    228229}
    229230
     231void Connection::setShouldExitOnSyncMessageSendFailure(bool shouldExitOnSyncMessageSendFailure)
     232{
     233    ASSERT(!m_isConnected);
     234
     235    m_shouldExitOnSyncMessageSendFailure = shouldExitOnSyncMessageSendFailure;
     236}
     237
    230238void Connection::setDidCloseOnConnectionWorkQueueCallback(DidCloseOnConnectionWorkQueueCallback callback)
    231239{
     
    359367    ASSERT(RunLoop::current() == m_clientRunLoop);
    360368
    361     if (!isValid())
     369    if (!isValid()) {
     370        didFailToSendSyncMessage();
    362371        return 0;
    363    
     372    }
     373
    364374    // Push the pending sync reply information on our stack.
    365375    {
    366376        MutexLocker locker(m_syncReplyStateMutex);
    367377        if (!m_shouldWaitForSyncReplies) {
    368             m_client->didFailToSendSyncMessage(this);
     378            didFailToSendSyncMessage();
    369379            return 0;
    370380        }
     
    388398    }
    389399
    390     if (!reply && m_client)
    391         m_client->didFailToSendSyncMessage(this);
     400    if (!reply)
     401        didFailToSendSyncMessage();
    392402
    393403    return reply.release();
     
    593603}
    594604
     605void Connection::didFailToSendSyncMessage()
     606{
     607    if (!m_shouldExitOnSyncMessageSendFailure)
     608        return;
     609
     610    exit(0);
     611}
     612
    595613void Connection::enqueueIncomingMessage(IncomingMessage& incomingMessage)
    596614{
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.h

    r84281 r84288  
    9494        virtual void didClose(Connection*) = 0;
    9595        virtual void didReceiveInvalidMessage(Connection*, MessageID) = 0;
    96         virtual void didFailToSendSyncMessage(Connection*) { }
    9796
    9897#if PLATFORM(WIN)
     
    121120
    122121    void setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(bool);
     122    void setShouldExitOnSyncMessageSendFailure(bool shouldExitOnSyncMessageSendFailure);
    123123
    124124    // The set callback will be called on the connection work queue when the connection is closed,
     
    217217    void dispatchMessages();
    218218    void dispatchSyncMessage(MessageID, ArgumentDecoder*);
     219    void didFailToSendSyncMessage();
    219220
    220221    // Can be called on any thread.
     
    226227
    227228    bool m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage;
     229    bool m_shouldExitOnSyncMessageSendFailure;
    228230    DidCloseOnConnectionWorkQueueCallback m_didCloseOnConnectionWorkQueueCallback;
    229231
  • trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp

    r83842 r84288  
    125125}
    126126
    127 NO_RETURN void PluginProcess::didFailToSendSyncMessage(CoreIPC::Connection*)
    128 {
    129     // We were making a synchronous call to a web process that doesn't exist any more.
    130     // Callers are unlikely to be prepared for an error like this, so it's best to exit immediately.
    131     exit(0);
    132 }
    133    
    134127void PluginProcess::initializePluginProcess(const PluginProcessCreationParameters& parameters)
    135128{
  • trunk/Source/WebKit2/PluginProcess/PluginProcess.h

    r83767 r84288  
    7272    virtual void didClose(CoreIPC::Connection*);
    7373    virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID);
    74     virtual void didFailToSendSyncMessage(CoreIPC::Connection*);
    7574
    7675    // Message handlers.
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r84091 r84288  
    149149    m_connection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, runLoop);
    150150    m_connection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue);
     151    m_connection->setShouldExitOnSyncMessageSendFailure(true);
    151152
    152153    m_connection->open();
     
    666667}
    667668
    668 NO_RETURN void WebProcess::didFailToSendSyncMessage(CoreIPC::Connection*)
    669 {
    670     // We were making a synchronous call to a UI process that doesn't exist any more.
    671     // Callers are unlikely to be prepared for an error like this, so it's best to exit immediately.
    672     exit(0);
    673 }
    674 
    675669WebFrame* WebProcess::webFrame(uint64_t frameID) const
    676670{
  • trunk/Source/WebKit2/WebProcess/WebProcess.h

    r83774 r84288  
    173173    void didClose(CoreIPC::Connection*);
    174174    void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID);
    175     NO_RETURN void didFailToSendSyncMessage(CoreIPC::Connection*);
    176175#if PLATFORM(WIN)
    177176    Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply();
Note: See TracChangeset for help on using the changeset viewer.