Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2711)

Unified Diff: Source/web/WebSocketImpl.cpp

Issue 419973007: Decouple WebSocketChannelClient from WebSocketImpl (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/WebSocketImpl.cpp
diff --git a/Source/web/WebSocketImpl.cpp b/Source/web/WebSocketImpl.cpp
index ba573540a48967f577296d54eec7ee67fd8c4d54..6d40e335803ef23ed1f1055c62043785cd48a0fb 100644
--- a/Source/web/WebSocketImpl.cpp
+++ b/Source/web/WebSocketImpl.cpp
@@ -41,6 +41,7 @@
#include "public/platform/WebString.h"
#include "public/platform/WebURL.h"
#include "public/web/WebDocument.h"
+#include "web/WebSocketChannelClientProxy.h"
#include "wtf/ArrayBuffer.h"
#include "wtf/text/CString.h"
#include "wtf/text/WTFString.h"
@@ -51,6 +52,7 @@ namespace blink {
WebSocketImpl::WebSocketImpl(const WebDocument& document, WebSocketClient* client)
: m_client(client)
+ , m_channelProxy(WebSocketChannelClientProxy::create(this))
, m_binaryType(BinaryTypeBlob)
, m_isClosingOrClosed(false)
, m_bufferedAmount(0)
@@ -58,9 +60,9 @@ WebSocketImpl::WebSocketImpl(const WebDocument& document, WebSocketClient* clien
{
RefPtrWillBeRawPtr<Document> coreDocument = PassRefPtrWillBeRawPtr<Document>(document);
if (RuntimeEnabledFeatures::experimentalWebSocketEnabled()) {
- m_private = NewWebSocketChannelImpl::create(coreDocument.get(), this);
+ m_private = NewWebSocketChannelImpl::create(coreDocument.get(), m_channelProxy.get());
} else {
- m_private = MainThreadWebSocketChannel::create(coreDocument.get(), this);
+ m_private = MainThreadWebSocketChannel::create(coreDocument.get(), m_channelProxy.get());
}
}
@@ -201,7 +203,7 @@ void WebSocketImpl::didStartClosingHandshake()
m_client->didStartClosingHandshake();
}
-void WebSocketImpl::didClose(ClosingHandshakeCompletionStatus status, unsigned short code, const String& reason)
+void WebSocketImpl::didClose(WebSocketChannelClient::ClosingHandshakeCompletionStatus status, unsigned short code, const String& reason)
{
m_isClosingOrClosed = true;
m_client->didClose(static_cast<WebSocketClient::ClosingHandshakeCompletionStatus>(status), code, WebString(reason));
@@ -210,10 +212,4 @@ void WebSocketImpl::didClose(ClosingHandshakeCompletionStatus status, unsigned s
m_client->didClose(m_bufferedAmount - m_bufferedAmountAfterClose, static_cast<WebSocketClient::ClosingHandshakeCompletionStatus>(status), code, WebString(reason));
}
-void WebSocketImpl::trace(blink::Visitor* visitor)
-{
- visitor->trace(m_private);
- blink::WebSocketChannelClient::trace(visitor);
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698