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

Side by Side Diff: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h

Issue 2284473002: Move WebSocketHandleImpl into Blink (take 2) (Closed)
Patch Set: Rebase Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 19 matching lines...) Expand all
30 30
31 #ifndef DocumentWebSocketChannel_h 31 #ifndef DocumentWebSocketChannel_h
32 #define DocumentWebSocketChannel_h 32 #define DocumentWebSocketChannel_h
33 33
34 #include "bindings/core/v8/SourceLocation.h" 34 #include "bindings/core/v8/SourceLocation.h"
35 #include "core/dom/ContextLifecycleObserver.h" 35 #include "core/dom/ContextLifecycleObserver.h"
36 #include "core/fileapi/Blob.h" 36 #include "core/fileapi/Blob.h"
37 #include "core/fileapi/FileError.h" 37 #include "core/fileapi/FileError.h"
38 #include "modules/ModulesExport.h" 38 #include "modules/ModulesExport.h"
39 #include "modules/websockets/WebSocketChannel.h" 39 #include "modules/websockets/WebSocketChannel.h"
40 #include "modules/websockets/WebSocketHandle.h"
41 #include "modules/websockets/WebSocketHandleClient.h"
40 #include "platform/heap/Handle.h" 42 #include "platform/heap/Handle.h"
41 #include "platform/weborigin/KURL.h" 43 #include "platform/weborigin/KURL.h"
42 #include "public/platform/modules/websockets/WebSocketHandle.h"
43 #include "public/platform/modules/websockets/WebSocketHandleClient.h"
44 #include "wtf/Deque.h" 44 #include "wtf/Deque.h"
45 #include "wtf/PassRefPtr.h" 45 #include "wtf/PassRefPtr.h"
46 #include "wtf/RefPtr.h" 46 #include "wtf/RefPtr.h"
47 #include "wtf/Vector.h" 47 #include "wtf/Vector.h"
48 #include "wtf/text/CString.h" 48 #include "wtf/text/CString.h"
49 #include "wtf/text/WTFString.h" 49 #include "wtf/text/WTFString.h"
50 #include <memory> 50 #include <memory>
51 #include <stdint.h> 51 #include <stdint.h>
52 52
53 namespace blink { 53 namespace blink {
54 54
55 class Document; 55 class Document;
56 class WebSocketHandshakeRequest; 56 class WebSocketHandshakeRequest;
57 class WebSocketHandshakeRequestInfo;
58 class WebSocketHandshakeResponseInfo;
59 57
60 // This class is a WebSocketChannel subclass that works with a Document in a 58 // This class is a WebSocketChannel subclass that works with a Document in a
61 // DOMWindow (i.e. works in the main thread). 59 // DOMWindow (i.e. works in the main thread).
62 class MODULES_EXPORT DocumentWebSocketChannel final : public WebSocketChannel, p ublic WebSocketHandleClient, public ContextLifecycleObserver { 60 class MODULES_EXPORT DocumentWebSocketChannel final : public WebSocketChannel, p ublic WebSocketHandleClient, public ContextLifecycleObserver {
63 USING_GARBAGE_COLLECTED_MIXIN(DocumentWebSocketChannel); 61 USING_GARBAGE_COLLECTED_MIXIN(DocumentWebSocketChannel);
64 public: 62 public:
65 // You can specify the source file and the line number information 63 // You can specify the source file and the line number information
66 // explicitly by passing the last parameter. 64 // explicitly by passing the last parameter.
67 // In the usual case, they are set automatically and you don't have to 65 // In the usual case, they are set automatically and you don't have to
68 // pass it. 66 // pass it.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 DocumentWebSocketChannel(Document*, WebSocketChannelClient*, std::unique_ptr <SourceLocation>, WebSocketHandle*); 107 DocumentWebSocketChannel(Document*, WebSocketChannelClient*, std::unique_ptr <SourceLocation>, WebSocketHandle*);
110 void sendInternal(WebSocketHandle::MessageType, const char* data, size_t tot alSize, uint64_t* consumedBufferedAmount); 108 void sendInternal(WebSocketHandle::MessageType, const char* data, size_t tot alSize, uint64_t* consumedBufferedAmount);
111 void processSendQueue(); 109 void processSendQueue();
112 void flowControlIfNecessary(); 110 void flowControlIfNecessary();
113 void failAsError(const String& reason) { fail(reason, ErrorMessageLevel, m_l ocationAtConstruction->clone()); } 111 void failAsError(const String& reason) { fail(reason, ErrorMessageLevel, m_l ocationAtConstruction->clone()); }
114 void abortAsyncOperations(); 112 void abortAsyncOperations();
115 void handleDidClose(bool wasClean, unsigned short code, const String& reason ); 113 void handleDidClose(bool wasClean, unsigned short code, const String& reason );
116 Document* document(); 114 Document* document();
117 115
118 // WebSocketHandleClient functions. 116 // WebSocketHandleClient functions.
119 void didConnect(WebSocketHandle*, const WebString& selectedProtocol, const W ebString& extensions) override; 117 void didConnect(WebSocketHandle*, const String& selectedProtocol, const Stri ng& extensions) override;
120 void didStartOpeningHandshake(WebSocketHandle*, const WebSocketHandshakeRequ estInfo&) override; 118 void didStartOpeningHandshake(WebSocketHandle*, PassRefPtr<WebSocketHandshak eRequest>) override;
121 void didFinishOpeningHandshake(WebSocketHandle*, const WebSocketHandshakeRes ponseInfo&) override; 119 void didFinishOpeningHandshake(WebSocketHandle*, const WebSocketHandshakeRes ponse*) override;
122 void didFail(WebSocketHandle*, const WebString& message) override; 120 void didFail(WebSocketHandle*, const String& message) override;
123 void didReceiveData(WebSocketHandle*, bool fin, WebSocketHandle::MessageType , const char* data, size_t /* size */) override; 121 void didReceiveData(WebSocketHandle*, bool fin, WebSocketHandle::MessageType , const char* data, size_t) override;
124 void didClose(WebSocketHandle*, bool wasClean, unsigned short code, const We bString& reason) override; 122 void didClose(WebSocketHandle*, bool wasClean, unsigned short code, const St ring& reason) override;
125 void didReceiveFlowControl(WebSocketHandle*, int64_t quota) override; 123 void didReceiveFlowControl(WebSocketHandle*, int64_t quota) override;
126 void didStartClosingHandshake(WebSocketHandle*) override; 124 void didStartClosingHandshake(WebSocketHandle*) override;
127 125
128 // Methods for BlobLoader. 126 // Methods for BlobLoader.
129 void didFinishLoadingBlob(DOMArrayBuffer*); 127 void didFinishLoadingBlob(DOMArrayBuffer*);
130 void didFailLoadingBlob(FileError::ErrorCode); 128 void didFailLoadingBlob(FileError::ErrorCode);
131 129
132 // m_handle is a handle of the connection. 130 // m_handle is a handle of the connection.
133 // m_handle == 0 means this channel is closed. 131 // m_handle == 0 means this channel is closed.
134 std::unique_ptr<WebSocketHandle> m_handle; 132 std::unique_ptr<WebSocketHandle> m_handle;
(...skipping 17 matching lines...) Expand all
152 RefPtr<WebSocketHandshakeRequest> m_handshakeRequest; 150 RefPtr<WebSocketHandshakeRequest> m_handshakeRequest;
153 151
154 static const uint64_t receivedDataSizeForFlowControlHighWaterMark = 1 << 15; 152 static const uint64_t receivedDataSizeForFlowControlHighWaterMark = 1 << 15;
155 }; 153 };
156 154
157 std::ostream& operator<<(std::ostream&, const DocumentWebSocketChannel*); 155 std::ostream& operator<<(std::ostream&, const DocumentWebSocketChannel*);
158 156
159 } // namespace blink 157 } // namespace blink
160 158
161 #endif // DocumentWebSocketChannel_h 159 #endif // DocumentWebSocketChannel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698