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

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

Issue 1666893003: [ABANDONED] WebSocket Blob receive in the browser process: renderer changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@websocket_blob_receive_host_merged
Patch Set: Created 4 years, 10 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void send(PassRefPtr<BlobDataHandle>) override; 69 void send(PassRefPtr<BlobDataHandle>) override;
70 void sendTextAsCharVector(PassOwnPtr<Vector<char>>) override 70 void sendTextAsCharVector(PassOwnPtr<Vector<char>>) override
71 { 71 {
72 ASSERT_NOT_REACHED(); 72 ASSERT_NOT_REACHED();
73 } 73 }
74 void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>) override 74 void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>) override
75 { 75 {
76 ASSERT_NOT_REACHED(); 76 ASSERT_NOT_REACHED();
77 } 77 }
78 void close(int code, const String& reason) override; 78 void close(int code, const String& reason) override;
79 void changeBinaryType(BinaryType) override;
79 void fail(const String& reason, MessageLevel, const String&, unsigned) overr ide; 80 void fail(const String& reason, MessageLevel, const String&, unsigned) overr ide;
80 void disconnect() override; // Will suppress didClose(). 81 void disconnect() override; // Will suppress didClose().
81 82
82 DECLARE_VIRTUAL_TRACE(); 83 DECLARE_VIRTUAL_TRACE();
83 84
84 class Bridge; 85 class Bridge;
85 // Allocated in the worker thread, but used in the main thread. 86 // Allocated in the worker thread, but used in the main thread.
86 class Peer final : public GarbageCollectedFinalized<Peer>, public WebSocketC hannelClient { 87 class Peer final : public GarbageCollectedFinalized<Peer>, public WebSocketC hannelClient {
87 USING_GARBAGE_COLLECTED_MIXIN(Peer); 88 USING_GARBAGE_COLLECTED_MIXIN(Peer);
88 WTF_MAKE_NONCOPYABLE(Peer); 89 WTF_MAKE_NONCOPYABLE(Peer);
89 public: 90 public:
90 Peer(Bridge*, PassRefPtr<WorkerLoaderProxy>, WebSocketChannelSyncHelper* ); 91 Peer(Bridge*, PassRefPtr<WorkerLoaderProxy>, WebSocketChannelSyncHelper* );
91 ~Peer() override; 92 ~Peer() override;
92 93
93 // sourceURLAtConnection and lineNumberAtConnection parameters may 94 // sourceURLAtConnection and lineNumberAtConnection parameters may
94 // be shown when the connection fails. 95 // be shown when the connection fails.
95 void initialize(const String& sourceURLAtConnection, unsigned lineNumber AtConnection, ExecutionContext*); 96 void initialize(const String& sourceURLAtConnection, unsigned lineNumber AtConnection, ExecutionContext*);
96 97
97 void connect(const KURL&, const String& protocol); 98 void connect(const KURL&, const String& protocol);
98 void sendTextAsCharVector(PassOwnPtr<Vector<char>>); 99 void sendTextAsCharVector(PassOwnPtr<Vector<char>>);
99 void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>); 100 void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>);
100 void sendBlob(PassRefPtr<BlobDataHandle>); 101 void sendBlob(PassRefPtr<BlobDataHandle>);
101 void close(int code, const String& reason); 102 void close(int code, const String& reason);
103 void changeBinaryType(BinaryType);
102 void fail(const String& reason, MessageLevel, const String& sourceURL, u nsigned lineNumber); 104 void fail(const String& reason, MessageLevel, const String& sourceURL, u nsigned lineNumber);
103 void disconnect(); 105 void disconnect();
104 106
105 DECLARE_VIRTUAL_TRACE(); 107 DECLARE_VIRTUAL_TRACE();
106 108
107 // WebSocketChannelClient functions. 109 // WebSocketChannelClient functions.
108 void didConnect(const String& subprotocol, const String& extensions) ove rride; 110 void didConnect(const String& subprotocol, const String& extensions) ove rride;
109 void didReceiveTextMessage(const String& payload) override; 111 void didReceiveTextMessage(const String& payload) override;
110 void didReceiveBinaryMessage(PassOwnPtr<Vector<char>>) override; 112 void didReceiveArrayBuffer(PassOwnPtr<Vector<char>>) override;
113 void didReceiveBlob(PassRefPtr<blink::BlobDataHandle>) override;
111 void didConsumeBufferedAmount(uint64_t) override; 114 void didConsumeBufferedAmount(uint64_t) override;
112 void didStartClosingHandshake() override; 115 void didStartClosingHandshake() override;
113 void didClose(ClosingHandshakeCompletionStatus, unsigned short code, con st String& reason) override; 116 void didClose(ClosingHandshakeCompletionStatus, unsigned short code, con st String& reason) override;
114 void didError() override; 117 void didError() override;
115 118
116 private: 119 private:
117 Member<Bridge> m_bridge; 120 Member<Bridge> m_bridge;
118 RefPtr<WorkerLoaderProxy> m_loaderProxy; 121 RefPtr<WorkerLoaderProxy> m_loaderProxy;
119 Member<WebSocketChannel> m_mainWebSocketChannel; 122 Member<WebSocketChannel> m_mainWebSocketChannel;
120 Member<WebSocketChannelSyncHelper> m_syncHelper; 123 Member<WebSocketChannelSyncHelper> m_syncHelper;
121 }; 124 };
122 125
123 // Bridge for Peer. Running on the worker thread. 126 // Bridge for Peer. Running on the worker thread.
124 class Bridge final : public GarbageCollectedFinalized<Bridge> { 127 class Bridge final : public GarbageCollectedFinalized<Bridge> {
125 WTF_MAKE_NONCOPYABLE(Bridge); 128 WTF_MAKE_NONCOPYABLE(Bridge);
126 public: 129 public:
127 Bridge(WebSocketChannelClient*, WorkerGlobalScope&); 130 Bridge(WebSocketChannelClient*, WorkerGlobalScope&);
128 ~Bridge(); 131 ~Bridge();
129 // sourceURLAtConnection and lineNumberAtConnection parameters may 132 // sourceURLAtConnection and lineNumberAtConnection parameters may
130 // be shown when the connection fails. 133 // be shown when the connection fails.
131 void initialize(const String& sourceURLAtConnection, unsigned lineNumber AtConnection); 134 void initialize(const String& sourceURLAtConnection, unsigned lineNumber AtConnection);
132 bool connect(const KURL&, const String& protocol); 135 bool connect(const KURL&, const String& protocol);
133 void send(const CString& message); 136 void send(const CString& message);
134 void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteLengt h); 137 void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteLengt h);
135 void send(PassRefPtr<BlobDataHandle>); 138 void send(PassRefPtr<BlobDataHandle>);
136 void close(int code, const String& reason); 139 void close(int code, const String& reason);
140 void changeBinaryType(BinaryType);
137 void fail(const String& reason, MessageLevel, const String& sourceURL, u nsigned lineNumber); 141 void fail(const String& reason, MessageLevel, const String& sourceURL, u nsigned lineNumber);
138 void disconnect(); 142 void disconnect();
139 143
140 // Returns null when |disconnect| has already been called. 144 // Returns null when |disconnect| has already been called.
141 WebSocketChannelClient* client() { return m_client; } 145 WebSocketChannelClient* client() { return m_client; }
142 146
143 DECLARE_TRACE(); 147 DECLARE_TRACE();
144 148
145 private: 149 private:
146 // Returns false if shutdown event is received before method completion. 150 // Returns false if shutdown event is received before method completion.
(...skipping 10 matching lines...) Expand all
157 WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, const St ring& sourceURL, unsigned lineNumber); 161 WorkerWebSocketChannel(WorkerGlobalScope&, WebSocketChannelClient*, const St ring& sourceURL, unsigned lineNumber);
158 162
159 Member<Bridge> m_bridge; 163 Member<Bridge> m_bridge;
160 String m_sourceURLAtConnection; 164 String m_sourceURLAtConnection;
161 unsigned m_lineNumberAtConnection; 165 unsigned m_lineNumberAtConnection;
162 }; 166 };
163 167
164 } // namespace blink 168 } // namespace blink
165 169
166 #endif // WorkerWebSocketChannel_h 170 #endif // WorkerWebSocketChannel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698