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

Side by Side Diff: content/child/websocket_bridge.cc

Issue 1574213003: [ABANDONED] Use new Websocket SendBlob IPC from renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@websocket_blob_send_sender
Patch Set: Comment that bufferedAmount may be temporarily too low. 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
« no previous file with comments | « content/child/websocket_bridge.h ('k') | content/child/websocket_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/websocket_bridge.h" 5 #include "content/child/websocket_bridge.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 bool WebSocketBridge::OnMessageReceived(const IPC::Message& msg) { 64 bool WebSocketBridge::OnMessageReceived(const IPC::Message& msg) {
65 bool handled = true; 65 bool handled = true;
66 IPC_BEGIN_MESSAGE_MAP(WebSocketBridge, msg) 66 IPC_BEGIN_MESSAGE_MAP(WebSocketBridge, msg)
67 IPC_MESSAGE_HANDLER(WebSocketMsg_AddChannelResponse, DidConnect) 67 IPC_MESSAGE_HANDLER(WebSocketMsg_AddChannelResponse, DidConnect)
68 IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyStartOpeningHandshake, 68 IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyStartOpeningHandshake,
69 DidStartOpeningHandshake) 69 DidStartOpeningHandshake)
70 IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyFinishOpeningHandshake, 70 IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyFinishOpeningHandshake,
71 DidFinishOpeningHandshake) 71 DidFinishOpeningHandshake)
72 IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyFailure, DidFail) 72 IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyFailure, DidFail)
73 IPC_MESSAGE_HANDLER(WebSocketMsg_BlobSendComplete, DidCompleteSendingBlob)
73 IPC_MESSAGE_HANDLER(WebSocketMsg_SendFrame, DidReceiveData) 74 IPC_MESSAGE_HANDLER(WebSocketMsg_SendFrame, DidReceiveData)
74 IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, DidReceiveFlowControl) 75 IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, DidReceiveFlowControl)
75 IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, DidClose) 76 IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, DidClose)
76 IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyClosing, 77 IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyClosing,
77 DidStartClosingHandshake) 78 DidStartClosingHandshake)
78 IPC_MESSAGE_UNHANDLED(handled = false) 79 IPC_MESSAGE_UNHANDLED(handled = false)
79 IPC_END_MESSAGE_MAP() 80 IPC_END_MESSAGE_MAP()
80 return handled; 81 return handled;
81 } 82 }
82 83
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 WebSocketHandleClient* client = client_; 134 WebSocketHandleClient* client = client_;
134 Disconnect(); 135 Disconnect();
135 if (!client) 136 if (!client)
136 return; 137 return;
137 138
138 WebString message_to_pass = WebString::fromUTF8(message); 139 WebString message_to_pass = WebString::fromUTF8(message);
139 client->didFail(this, message_to_pass); 140 client->didFail(this, message_to_pass);
140 // |this| can be deleted here. 141 // |this| can be deleted here.
141 } 142 }
142 143
144 void WebSocketBridge::DidCompleteSendingBlob() {
145 DVLOG(1) << "WebSocketBridge::DidCompleteSendingBlob()";
146 if (client_)
147 client_->didCompleteSendingBlob(this);
148 // |this| can be deleted here.
149 }
150
143 void WebSocketBridge::DidReceiveData(bool fin, 151 void WebSocketBridge::DidReceiveData(bool fin,
144 WebSocketMessageType type, 152 WebSocketMessageType type,
145 const std::vector<char>& data) { 153 const std::vector<char>& data) {
146 DVLOG(1) << "WebSocketBridge::DidReceiveData(" 154 DVLOG(1) << "WebSocketBridge::DidReceiveData("
147 << fin << ", " 155 << fin << ", "
148 << type << ", " 156 << type << ", "
149 << "(data size = " << data.size() << "))"; 157 << "(data size = " << data.size() << "))";
150 if (!client_) 158 if (!client_)
151 return; 159 return;
152 160
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 << fin << ", " << type_to_pass << ", " 257 << fin << ", " << type_to_pass << ", "
250 << "(data size = " << size << "))"; 258 << "(data size = " << size << "))";
251 259
252 ChildThreadImpl::current()->Send( 260 ChildThreadImpl::current()->Send(
253 new WebSocketMsg_SendFrame(channel_id_, 261 new WebSocketMsg_SendFrame(channel_id_,
254 fin, 262 fin,
255 type_to_pass, 263 type_to_pass,
256 std::vector<char>(data, data + size))); 264 std::vector<char>(data, data + size)));
257 } 265 }
258 266
267 void WebSocketBridge::sendBlob(const blink::WebString& uuid,
268 uint64_t expected_size) {
269 if (channel_id_ == kInvalidChannelId)
270 return;
271
272 DVLOG(1) << "Bridge #" << channel_id_ << " SendBlob(" << uuid.utf8() << ", "
273 << expected_size << ")";
274
275 ChildThreadImpl::current()->Send(
276 new WebSocketHostMsg_SendBlob(channel_id_, uuid.utf8(), expected_size));
277 }
278
259 void WebSocketBridge::flowControl(int64_t quota) { 279 void WebSocketBridge::flowControl(int64_t quota) {
260 if (channel_id_ == kInvalidChannelId) 280 if (channel_id_ == kInvalidChannelId)
261 return; 281 return;
262 282
263 DVLOG(1) << "Bridge #" << channel_id_ << " FlowControl(" << quota << ")"; 283 DVLOG(1) << "Bridge #" << channel_id_ << " FlowControl(" << quota << ")";
264 284
265 ChildThreadImpl::current()->Send( 285 ChildThreadImpl::current()->Send(
266 new WebSocketMsg_FlowControl(channel_id_, quota)); 286 new WebSocketMsg_FlowControl(channel_id_, quota));
267 } 287 }
268 288
(...skipping 15 matching lines...) Expand all
284 return; 304 return;
285 WebSocketDispatcher* dispatcher = 305 WebSocketDispatcher* dispatcher =
286 ChildThreadImpl::current()->websocket_dispatcher(); 306 ChildThreadImpl::current()->websocket_dispatcher();
287 dispatcher->RemoveBridge(channel_id_); 307 dispatcher->RemoveBridge(channel_id_);
288 308
289 channel_id_ = kInvalidChannelId; 309 channel_id_ = kInvalidChannelId;
290 client_ = NULL; 310 client_ = NULL;
291 } 311 }
292 312
293 } // namespace content 313 } // namespace content
OLDNEW
« no previous file with comments | « content/child/websocket_bridge.h ('k') | content/child/websocket_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698