Diff
Modified: trunk/Source/WebCore/ChangeLog (91918 => 91919)
--- trunk/Source/WebCore/ChangeLog 2011-07-28 12:19:13 UTC (rev 91918)
+++ trunk/Source/WebCore/ChangeLog 2011-07-28 12:21:04 UTC (rev 91919)
@@ -1,3 +1,37 @@
+2011-07-28 Yuta Kitamura <yu...@chromium.org>
+
+ 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:
+
2011-07-28 Rob Buis <rb...@rim.com>
REGRESSION (r91125): Google Drawings is broken
Modified: trunk/Source/WebCore/websockets/ThreadableWebSocketChannel.h (91918 => 91919)
--- trunk/Source/WebCore/websockets/ThreadableWebSocketChannel.h 2011-07-28 12:19:13 UTC (rev 91918)
+++ trunk/Source/WebCore/websockets/ThreadableWebSocketChannel.h 2011-07-28 12:21:04 UTC (rev 91919)
@@ -49,6 +49,7 @@
ThreadableWebSocketChannel() { }
static PassRefPtr<ThreadableWebSocketChannel> create(ScriptExecutionContext*, WebSocketChannelClient*, const KURL&, const String& protocol);
+ virtual bool useHixie76Protocol() = 0;
virtual void connect() = 0;
virtual bool send(const String& message) = 0;
virtual unsigned long bufferedAmount() const = 0;
Modified: trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp (91918 => 91919)
--- trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp 2011-07-28 12:19:13 UTC (rev 91918)
+++ trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp 2011-07-28 12:21:04 UTC (rev 91919)
@@ -43,6 +43,7 @@
ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper(WebSocketChannelClient* client)
: m_client(client)
, m_syncMethodDone(false)
+ , m_useHixie76Protocol(true)
, m_sent(false)
, m_bufferedAmount(0)
, m_suspended(false)
@@ -69,6 +70,16 @@
return m_syncMethodDone;
}
+bool ThreadableWebSocketChannelClientWrapper::useHixie76Protocol() const
+{
+ return m_useHixie76Protocol;
+}
+
+void ThreadableWebSocketChannelClientWrapper::setUseHixie76Protocol(bool useHixie76Protocol)
+{
+ m_useHixie76Protocol = useHixie76Protocol;
+}
+
bool ThreadableWebSocketChannelClientWrapper::sent() const
{
return m_sent;
Modified: trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h (91918 => 91919)
--- trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h 2011-07-28 12:19:13 UTC (rev 91918)
+++ trunk/Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h 2011-07-28 12:21:04 UTC (rev 91919)
@@ -53,6 +53,11 @@
void setSyncMethodDone();
bool syncMethodDone() const;
+ // The value of useHixie76Protocol flag is cachable; this value is saved after WebSocketChannel (on the main
+ // thread) is constructed.
+ bool useHixie76Protocol() const;
+ void setUseHixie76Protocol(bool);
+
bool sent() const;
void setSent(bool);
@@ -80,6 +85,7 @@
WebSocketChannelClient* m_client;
bool m_syncMethodDone;
+ bool m_useHixie76Protocol;
bool m_sent;
unsigned long m_bufferedAmount;
bool m_suspended;
Modified: trunk/Source/WebCore/websockets/WebSocketChannel.cpp (91918 => 91919)
--- trunk/Source/WebCore/websockets/WebSocketChannel.cpp 2011-07-28 12:19:13 UTC (rev 91918)
+++ trunk/Source/WebCore/websockets/WebSocketChannel.cpp 2011-07-28 12:21:04 UTC (rev 91919)
@@ -116,6 +116,11 @@
fastFree(m_buffer);
}
+bool WebSocketChannel::useHixie76Protocol()
+{
+ return m_useHixie76Protocol;
+}
+
void WebSocketChannel::connect()
{
LOG(Network, "WebSocketChannel %p connect", this);
Modified: trunk/Source/WebCore/websockets/WebSocketChannel.h (91918 => 91919)
--- trunk/Source/WebCore/websockets/WebSocketChannel.h 2011-07-28 12:19:13 UTC (rev 91918)
+++ trunk/Source/WebCore/websockets/WebSocketChannel.h 2011-07-28 12:21:04 UTC (rev 91919)
@@ -54,6 +54,7 @@
static PassRefPtr<WebSocketChannel> create(ScriptExecutionContext* context, WebSocketChannelClient* client, const KURL& url, const String& protocol) { return adoptRef(new WebSocketChannel(context, client, url, protocol)); }
virtual ~WebSocketChannel();
+ virtual bool useHixie76Protocol();
virtual void connect();
virtual bool send(const String& message);
virtual unsigned long bufferedAmount() const;
Modified: trunk/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp (91918 => 91919)
--- trunk/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp 2011-07-28 12:19:13 UTC (rev 91918)
+++ trunk/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp 2011-07-28 12:21:04 UTC (rev 91919)
@@ -62,6 +62,12 @@
m_bridge->disconnect();
}
+bool WorkerThreadableWebSocketChannel::useHixie76Protocol()
+{
+ ASSERT(m_workerClientWrapper);
+ return m_workerClientWrapper->useHixie76Protocol();
+}
+
void WorkerThreadableWebSocketChannel::connect()
{
if (m_bridge)
@@ -130,6 +136,13 @@
m_mainWebSocketChannel->disconnect();
}
+bool WorkerThreadableWebSocketChannel::Peer::useHixie76Protocol()
+{
+ ASSERT(isMainThread());
+ ASSERT(m_mainWebSocketChannel);
+ return m_mainWebSocketChannel->useHixie76Protocol();
+}
+
void WorkerThreadableWebSocketChannel::Peer::connect()
{
ASSERT(isMainThread());
@@ -258,10 +271,11 @@
m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidClose, m_workerClientWrapper, unhandledBufferedAmount, closingHandshakeCompletion), m_taskMode);
}
-void WorkerThreadableWebSocketChannel::Bridge::setWebSocketChannel(ScriptExecutionContext* context, Bridge* thisPtr, Peer* peer, PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper)
+void WorkerThreadableWebSocketChannel::Bridge::setWebSocketChannel(ScriptExecutionContext* context, Bridge* thisPtr, Peer* peer, PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, bool useHixie76Protocol)
{
ASSERT_UNUSED(context, context->isWorkerContext());
thisPtr->m_peer = peer;
+ workerClientWrapper->setUseHixie76Protocol(useHixie76Protocol);
workerClientWrapper->setSyncMethodDone();
}
@@ -276,7 +290,7 @@
thisPtr->m_loaderProxy.postTaskForModeToWorkerContext(
createCallbackTask(&Bridge::setWebSocketChannel,
AllowCrossThreadAccess(thisPtr),
- AllowCrossThreadAccess(peer), clientWrapper), taskMode);
+ AllowCrossThreadAccess(peer), clientWrapper, peer->useHixie76Protocol()), taskMode);
}
WorkerThreadableWebSocketChannel::Bridge::Bridge(PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, PassRefPtr<WorkerContext> workerContext, const String& taskMode, const KURL& url, const String& protocol)
Modified: trunk/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h (91918 => 91919)
--- trunk/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h 2011-07-28 12:19:13 UTC (rev 91918)
+++ trunk/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h 2011-07-28 12:21:04 UTC (rev 91919)
@@ -60,6 +60,7 @@
}
virtual ~WorkerThreadableWebSocketChannel();
+ virtual bool useHixie76Protocol();
virtual void connect();
virtual bool send(const String& message);
virtual unsigned long bufferedAmount() const;
@@ -88,6 +89,7 @@
}
~Peer();
+ bool useHixie76Protocol();
void connect();
void send(const String& message);
void bufferedAmount();
@@ -134,7 +136,7 @@
private:
Bridge(PassRefPtr<ThreadableWebSocketChannelClientWrapper>, PassRefPtr<WorkerContext>, const String& taskMode, const KURL&, const String& protocol);
- static void setWebSocketChannel(ScriptExecutionContext*, Bridge* thisPtr, Peer*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>);
+ static void setWebSocketChannel(ScriptExecutionContext*, Bridge* thisPtr, Peer*, PassRefPtr<ThreadableWebSocketChannelClientWrapper>, bool useHixie76Protocol);
// Executed on the main thread to create a Peer for this bridge.
static void mainThreadCreateWebSocketChannel(ScriptExecutionContext*, Bridge* thisPtr, PassRefPtr<ThreadableWebSocketChannelClientWrapper>, const String& taskMode, const KURL&, const String& protocol);