Changeset 84281 in webkit


Ignore:
Timestamp:
Apr 19, 2011 12:28:29 PM (13 years ago)
Author:
andersca@apple.com
Message:

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

Reviewed by Sam Weinig.

Add a way to set the default sync message timeout for a CoreIPC connection
https://bugs.webkit.org/show_bug.cgi?id=58908

  • Platform/CoreIPC/Connection.cpp: (CoreIPC::Connection::Connection): Initialize m_defaultSyncMessageTimeout.

(CoreIPC::Connection::setDefaultSyncMessageTimeout):
Set the m_defaultSyncMessageTimeout member variable.

(CoreIPC::Connection::waitForSyncReply):
Handle the timeout being one of our two special magic values.

  • Platform/CoreIPC/Connection.h: Add a DefaultTimeout constant and change the NoTimeout constant to be -1.
Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r84260 r84281  
     12011-04-19  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Add a way to set the default sync message timeout for a CoreIPC connection
     6        https://bugs.webkit.org/show_bug.cgi?id=58908
     7
     8        * Platform/CoreIPC/Connection.cpp:
     9        (CoreIPC::Connection::Connection):
     10        Initialize m_defaultSyncMessageTimeout.
     11
     12        (CoreIPC::Connection::setDefaultSyncMessageTimeout):
     13        Set the m_defaultSyncMessageTimeout member variable.
     14
     15        (CoreIPC::Connection::waitForSyncReply):
     16        Handle the timeout being one of our two special magic values.
     17
     18        * Platform/CoreIPC/Connection.h:
     19        Add a DefaultTimeout constant and change the NoTimeout constant to be -1.
     20
    1212011-04-19  Vsevolod Vlasov  <vsevik@chromium.org>
    222
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp

    r83498 r84281  
    205205    , m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount(0)
    206206    , m_didReceiveInvalidMessage(false)
     207    , m_defaultSyncMessageTimeout(NoTimeout)
    207208    , m_syncMessageState(SyncMessageState::getOrCreate(clientRunLoop))
    208209    , m_shouldWaitForSyncReplies(true)
     
    253254
    254255    m_didReceiveInvalidMessage = true;
     256}
     257
     258void Connection::setDefaultSyncMessageTimeout(double defaultSyncMessageTimeout)
     259{
     260    ASSERT(defaultSyncMessageTimeout != DefaultTimeout);
     261
     262    m_defaultSyncMessageTimeout = defaultSyncMessageTimeout;
    255263}
    256264
     
    388396PassOwnPtr<ArgumentDecoder> Connection::waitForSyncReply(uint64_t syncRequestID, double timeout)
    389397{
     398    if (timeout == DefaultTimeout)
     399        timeout = m_defaultSyncMessageTimeout;
     400
     401    // Use a really long timeout.
     402    if (timeout == NoTimeout)
     403        timeout = 1e10;
     404
    390405    double absoluteTime = currentTime() + timeout;
    391406
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.h

    r83498 r84281  
    134134    void markCurrentlyDispatchedMessageAsInvalid();
    135135
    136     static const unsigned long long NoTimeout = 10000000000ULL;
     136    void setDefaultSyncMessageTimeout(double);
     137
     138    static const int DefaultTimeout = 0;
     139    static const int NoTimeout = -1;
    137140
    138141    template<typename T> bool send(const T& message, uint64_t destinationID, unsigned messageSendFlags = 0);
    139     template<typename T> bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout = NoTimeout);
     142    template<typename T> bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout = DefaultTimeout);
    140143    template<typename T> bool waitForAndDispatchImmediately(uint64_t destinationID, double timeout);
    141144
     
    232235    unsigned m_inDispatchMessageMarkedDispatchWhenWaitingForSyncReplyCount;
    233236    bool m_didReceiveInvalidMessage;
     237
     238    double m_defaultSyncMessageTimeout;
    234239
    235240    // Incoming messages.
Note: See TracChangeset for help on using the changeset viewer.