Chromium Code Reviews| Index: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h |
| diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h |
| index 90eb1f2ce555da3e8a36938d50a62190decfb3a3..d68db47fa6c1a8f091e5043ac8b6a975e1a5715a 100644 |
| --- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h |
| +++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h |
| @@ -36,6 +36,7 @@ |
| #include "bindings/core/v8/SourceLocation.h" |
| #include "core/fileapi/Blob.h" |
| #include "core/fileapi/FileError.h" |
| +#include "core/loader/LoadingContext.h" |
| #include "modules/ModulesExport.h" |
| #include "modules/websockets/WebSocketChannel.h" |
| #include "modules/websockets/WebSocketHandle.h" |
| @@ -52,7 +53,7 @@ |
| namespace blink { |
| -class Document; |
| +class LoadingContext; |
| class WebSocketHandshakeRequest; |
| // This class is a WebSocketChannel subclass that works with a Document in a |
| @@ -71,8 +72,17 @@ class MODULES_EXPORT DocumentWebSocketChannel final |
| WebSocketChannelClient* client, |
| std::unique_ptr<SourceLocation> location, |
| WebSocketHandle* handle = 0) { |
| - return new DocumentWebSocketChannel(document, client, std::move(location), |
| - handle); |
| + DCHECK(document); |
| + return create(LoadingContext::create(*document), client, |
| + std::move(location), handle); |
| + } |
| + static DocumentWebSocketChannel* create( |
| + LoadingContext* loadingContext, |
| + WebSocketChannelClient* client, |
| + std::unique_ptr<SourceLocation> location, |
| + WebSocketHandle* handle = 0) { |
| + return new DocumentWebSocketChannel(loadingContext, client, |
| + std::move(location), handle); |
| } |
| ~DocumentWebSocketChannel() override; |
| @@ -113,7 +123,7 @@ class MODULES_EXPORT DocumentWebSocketChannel final |
| Vector<char> data; |
| }; |
| - DocumentWebSocketChannel(Document*, |
| + DocumentWebSocketChannel(LoadingContext*, |
| WebSocketChannelClient*, |
| std::unique_ptr<SourceLocation>, |
| WebSocketHandle*); |
| @@ -128,6 +138,10 @@ class MODULES_EXPORT DocumentWebSocketChannel final |
| } |
| void abortAsyncOperations(); |
| void handleDidClose(bool wasClean, unsigned short code, const String& reason); |
| + LoadingContext* loadingContext(); |
| + |
| + // This may return non-null. |
|
Nate Chapin
2017/02/28 20:47:18
s/non-null/null/ ?
kinuko
2017/03/01 15:08:29
D'oh. Done.
|
| + // TODO(kinuko): Remove dependency to document. |
| Document* document(); |
| // WebSocketHandleClient functions. |
| @@ -168,7 +182,7 @@ class MODULES_EXPORT DocumentWebSocketChannel final |
| Member<BlobLoader> m_blobLoader; |
| HeapDeque<Member<Message>> m_messages; |
| Vector<char> m_receivingMessageData; |
| - Member<Document> m_document; |
| + Member<LoadingContext> m_loadingContext; |
| bool m_receivingMessageTypeIsText; |
| uint64_t m_sendingQuota; |