Changeset 91919 in webkit


Ignore:
Timestamp:
Jul 28, 2011 5:21:04 AM (13 years ago)
Author:
yutak@chromium.org
Message:

WebSocket: Pass the value of useHixie76Protocol flag to WebSocket object
https://bugs.webkit.org/show_bug.cgi?id=65250

Reviewed by Alexey Proskuryakov.

Add useHixie76Protocol() method to WebSocketChannel and its family. To implement hybi-specific
attributes in WebSocket object, WebSocket class needs to be able to get the value of
useHixie76Protocol flag of WebSocketChannel.

If the WebSocket object is created in a worker thread, the flag value must be obtained from
WebSocketChannel which resides in the loader thread (through WorkerThreadableWebSocketChannel).
Since the value does not change after creation of WebSocketChannel, it can be cached in
the worker thread.

There is no change in behavior, thus no new tests.

  • websockets/ThreadableWebSocketChannel.h:
  • websockets/ThreadableWebSocketChannelClientWrapper.cpp:

(WebCore::ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper):
(WebCore::ThreadableWebSocketChannelClientWrapper::useHixie76Protocol):
(WebCore::ThreadableWebSocketChannelClientWrapper::setUseHixie76Protocol):

  • websockets/ThreadableWebSocketChannelClientWrapper.h:
  • websockets/WebSocketChannel.cpp:

(WebCore::WebSocketChannel::useHixie76Protocol):

  • websockets/WebSocketChannel.h:
  • websockets/WorkerThreadableWebSocketChannel.cpp:

(WebCore::WorkerThreadableWebSocketChannel::useHixie76Protocol):
(WebCore::WorkerThreadableWebSocketChannel::Peer::useHixie76Protocol):
(WebCore::WorkerThreadableWebSocketChannel::Bridge::setWebSocketChannel):
(WebCore::WorkerThreadableWebSocketChannel::Bridge::mainThreadCreateWebSocketChannel):

  • websockets/WorkerThreadableWebSocketChannel.h:
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r91915 r91919  
     12011-07-28  Yuta Kitamura  <yutak@chromium.org>
     2
     3        WebSocket: Pass the value of useHixie76Protocol flag to WebSocket object
     4        https://bugs.webkit.org/show_bug.cgi?id=65250
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Add useHixie76Protocol() method to WebSocketChannel and its family. To implement hybi-specific
     9        attributes in WebSocket object, WebSocket class needs to be able to get the value of
     10        useHixie76Protocol flag of WebSocketChannel.
     11
     12        If the WebSocket object is created in a worker thread, the flag value must be obtained from
     13        WebSocketChannel which resides in the loader thread (through WorkerThreadableWebSocketChannel).
     14        Since the value does not change after creation of WebSocketChannel, it can be cached in
     15        the worker thread.
     16
     17        There is no change in behavior, thus no new tests.
     18
     19        * websockets/ThreadableWebSocketChannel.h:
     20        * websockets/ThreadableWebSocketChannelClientWrapper.cpp:
     21        (WebCore::ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper):
     22        (WebCore::ThreadableWebSocketChannelClientWrapper::useHixie76Protocol):
     23        (WebCore::ThreadableWebSocketChannelClientWrapper::setUseHixie76Protocol):
     24        * websockets/ThreadableWebSocketChannelClientWrapper.h:
     25        * websockets/WebSocketChannel.cpp:
     26        (WebCore::WebSocketChannel::useHixie76Protocol):
     27        * websockets/WebSocketChannel.h:
     28        * websockets/WorkerThreadableWebSocketChannel.cpp:
     29        (WebCore::WorkerThreadableWebSocketChannel::useHixie76Protocol):
     30        (WebCore::WorkerThreadableWebSocketChannel::Peer::useHixie76Protocol):
     31        (WebCore::WorkerThreadableWebSocketChannel::Bridge::setWebSocketChannel):
     32        (WebCore::WorkerThreadableWebSocketChannel::Bridge::mainThreadCreateWebSocketChannel):
     33        * websockets/WorkerThreadableWebSocketChannel.h:
     34
    1352011-07-28  Rob Buis  <rbuis@rim.com>
    236
  • trunk/Source/WebCore/websockets/ThreadableWebSocketChannel.h

    r87139 r91919  
    5050    static PassRefPtr<ThreadableWebSocketChannel> create(ScriptExecutionContext*, WebSocketChannelClient*, const KURL&, const String& protocol);
    5151
     52    virtual bool useHixie76Protocol() = 0;
    5253    virtual void connect() = 0;
    5354    virtual bool send(const String& message) = 0;
  • trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp

    r89707 r91919  
    4444    : m_client(client)
    4545    , m_syncMethodDone(false)
     46    , m_useHixie76Protocol(true)
    4647    , m_sent(false)
    4748    , m_bufferedAmount(0)
     
    6869{
    6970    return m_syncMethodDone;
     71}
     72
     73bool ThreadableWebSocketChannelClientWrapper::useHixie76Protocol() const
     74{
     75    return m_useHixie76Protocol;
     76}
     77
     78void ThreadableWebSocketChannelClientWrapper::setUseHixie76Protocol(bool useHixie76Protocol)
     79{
     80    m_useHixie76Protocol = useHixie76Protocol;
    7081}
    7182
  • trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h

    r89707 r91919  
    5454    bool syncMethodDone() const;
    5555
     56    // The value of useHixie76Protocol flag is cachable; this value is saved after WebSocketChannel (on the main
     57    // thread) is constructed.
     58    bool useHixie76Protocol() const;
     59    void setUseHixie76Protocol(bool);
     60
    5661    bool sent() const;
    5762    void setSent(bool);
     
    8186    WebSocketChannelClient* m_client;
    8287    bool m_syncMethodDone;
     88    bool m_useHixie76Protocol;
    8389    bool m_sent;
    8490    unsigned long m_bufferedAmount;
  • trunk/Source/WebCore/websockets/WebSocketChannel.cpp

    r91243 r91919  
    117117}
    118118
     119bool WebSocketChannel::useHixie76Protocol()
     120{
     121    return m_useHixie76Protocol;
     122}
     123
    119124void WebSocketChannel::connect()
    120125{
  • trunk/Source/WebCore/websockets/WebSocketChannel.h

    r91243 r91919  
    5555        virtual ~WebSocketChannel();
    5656
     57        virtual bool useHixie76Protocol();
    5758        virtual void connect();
    5859        virtual bool send(const String& message);
  • trunk/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp

    r89613 r91919  
    6363}
    6464
     65bool WorkerThreadableWebSocketChannel::useHixie76Protocol()
     66{
     67    ASSERT(m_workerClientWrapper);
     68    return m_workerClientWrapper->useHixie76Protocol();
     69}
     70
    6571void WorkerThreadableWebSocketChannel::connect()
    6672{
     
    131137}
    132138
     139bool WorkerThreadableWebSocketChannel::Peer::useHixie76Protocol()
     140{
     141    ASSERT(isMainThread());
     142    ASSERT(m_mainWebSocketChannel);
     143    return m_mainWebSocketChannel->useHixie76Protocol();
     144}
     145
    133146void WorkerThreadableWebSocketChannel::Peer::connect()
    134147{
     
    259272}
    260273
    261 void WorkerThreadableWebSocketChannel::Bridge::setWebSocketChannel(ScriptExecutionContext* context, Bridge* thisPtr, Peer* peer, PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper)
     274void WorkerThreadableWebSocketChannel::Bridge::setWebSocketChannel(ScriptExecutionContext* context, Bridge* thisPtr, Peer* peer, PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, bool useHixie76Protocol)
    262275{
    263276    ASSERT_UNUSED(context, context->isWorkerContext());
    264277    thisPtr->m_peer = peer;
     278    workerClientWrapper->setUseHixie76Protocol(useHixie76Protocol);
    265279    workerClientWrapper->setSyncMethodDone();
    266280}
     
    277291        createCallbackTask(&Bridge::setWebSocketChannel,
    278292                           AllowCrossThreadAccess(thisPtr),
    279                            AllowCrossThreadAccess(peer), clientWrapper), taskMode);
     293                           AllowCrossThreadAccess(peer), clientWrapper, peer->useHixie76Protocol()), taskMode);
    280294}
    281295
  • trunk/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h

    r89613 r91919  
    6161    virtual ~WorkerThreadableWebSocketChannel();
    6262
     63    virtual bool useHixie76Protocol();
    6364    virtual void connect();
    6465    virtual bool send(const String& message);
     
    8990        ~Peer();
    9091
     92        bool useHixie76Protocol();
    9193        void connect();
    9294        void send(const String& message);
     
    135137        Bridge(PassRefPtr<ThreadableWebSocketChannelClientWrapper>, PassRefPtr<WorkerContext>, const String& taskMode, const KURL&, const String& protocol);
    136138
    137         static void setWebSocketChannel(ScriptExecutionContext*, Bridge* thisPtr, Peer*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>);
     139        static void setWebSocketChannel(ScriptExecutionContext*, Bridge* thisPtr, Peer*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>, bool useHixie76Protocol);
    138140
    139141        // Executed on the main thread to create a Peer for this bridge.
Note: See TracChangeset for help on using the changeset viewer.