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

Unified Diff: content/child/websocket_bridge.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/websocket_bridge.h ('k') | content/child/websocket_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/websocket_bridge.cc
diff --git a/content/child/websocket_bridge.cc b/content/child/websocket_bridge.cc
index 7cfff1ad50a942960024e79ac8d98377e363642d..e0eac5ab01ac9bac05eb1adaddbd4044b115b29f 100644
--- a/content/child/websocket_bridge.cc
+++ b/content/child/websocket_bridge.cc
@@ -41,6 +41,21 @@ namespace {
const unsigned short kAbnormalShutdownOpCode = 1006;
+WebSocketBinaryType BlinkBinaryTypeToContentWebSocketBinaryType(
+ WebSocketHandle::BinaryType binary_type) {
+ static_assert(
+ static_cast<WebSocketBinaryType>(WebSocketHandle::BinaryTypeBlob) ==
+ WebSocketBinaryType::BLOB,
+ "enum types must match");
+ static_assert(static_cast<WebSocketBinaryType>(
+ WebSocketHandle::BinaryTypeArrayBuffer) ==
+ WebSocketBinaryType::ARRAY_BUFFER,
+ "enum types must match");
+ DCHECK(binary_type == WebSocketHandle::BinaryTypeBlob ||
+ binary_type == WebSocketHandle::BinaryTypeArrayBuffer);
+ return static_cast<WebSocketBinaryType>(binary_type);
+}
+
} // namespace
WebSocketBridge::WebSocketBridge()
@@ -71,6 +86,7 @@ bool WebSocketBridge::OnMessageReceived(const IPC::Message& msg) {
DidFinishOpeningHandshake)
IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyFailure, DidFail)
IPC_MESSAGE_HANDLER(WebSocketMsg_SendFrame, DidReceiveData)
+ IPC_MESSAGE_HANDLER(WebSocketMsg_BlobReceived, DidReceiveBlob)
IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, DidReceiveFlowControl)
IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, DidClose)
IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyClosing,
@@ -168,6 +184,12 @@ void WebSocketBridge::DidReceiveData(bool fin,
// |this| can be deleted here.
}
+void WebSocketBridge::DidReceiveBlob(const std::string& uuid, uint64_t size) {
+ DVLOG(1) << "WebSocketBridge::DidReceiveBlob(" << uuid << "," << size << ")";
+
+ client_->didReceiveBlob(this, WebString::fromLatin1(uuid), size);
+}
+
void WebSocketBridge::DidReceiveFlowControl(int64_t quota) {
DVLOG(1) << "WebSocketBridge::DidReceiveFlowControl(" << quota << ")";
if (!client_)
@@ -279,6 +301,26 @@ void WebSocketBridge::close(unsigned short code,
new WebSocketMsg_DropChannel(channel_id_, true, code, reason_to_pass));
}
+void WebSocketBridge::changeBinaryType(BinaryType new_binary_type) {
+ if (channel_id_ == kInvalidChannelId)
+ return;
+
+ DVLOG(1) << "Bridge #" << channel_id_ << " ChangeBinaryType("
+ << new_binary_type << ")";
+ ChildThreadImpl::current()->Send(new WebSocketHostMsg_BinaryTypeChanged(
+ channel_id_,
+ BlinkBinaryTypeToContentWebSocketBinaryType(new_binary_type)));
+}
+
+void WebSocketBridge::confirmBlob() {
+ if (channel_id_ == kInvalidChannelId)
+ return;
+
+ DVLOG(1) << "Bridge #" << channel_id_ << " ConfirmBlob()";
+ ChildThreadImpl::current()->Send(
+ new WebSocketHostMsg_BlobConfirmed(channel_id_));
+}
+
void WebSocketBridge::Disconnect() {
if (channel_id_ == kInvalidChannelId)
return;
« 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