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

Unified Diff: content/browser/renderer_host/websocket_host.cc

Issue 1461283002: [DO NOT COMMIT] mojo datapipe performance measurement Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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/browser/renderer_host/websocket_host.h ('k') | content/child/websocket_bridge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/websocket_host.cc
diff --git a/content/browser/renderer_host/websocket_host.cc b/content/browser/renderer_host/websocket_host.cc
index cce4485b3d4d67801e5037ee042d88fd5aaaaa41..710f640096af6fcd4427f21cf4aeb2b1d3f40a22 100644
--- a/content/browser/renderer_host/websocket_host.cc
+++ b/content/browser/renderer_host/websocket_host.cc
@@ -371,6 +371,7 @@ WebSocketHost::WebSocketHost(int routing_id,
delay_(delay),
pending_flow_control_quota_(0),
handshake_succeeded_(false),
+ loader_test_num_read_bytes_(0),
weak_ptr_factory_(this) {
DVLOG(1) << "WebSocketHost: created routing_id=" << routing_id;
}
@@ -390,6 +391,12 @@ bool WebSocketHost::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(WebSocketMsg_SendFrame, OnSendFrame)
IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, OnFlowControl)
IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, OnDropChannel)
+ IPC_MESSAGE_HANDLER(WebSocketHostMsg_LoaderTransferTest_Setup,
+ OnLoaderTransferTest_Setup)
+ IPC_MESSAGE_HANDLER(WebSocketHostMsg_LoaderTransferTest_Send,
+ OnLoaderTransferTest_Send)
+ IPC_MESSAGE_HANDLER(WebSocketHostMsg_LoaderTransferTest_Close,
+ OnLoaderTransferTest_Close)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -580,4 +587,32 @@ void WebSocketHost::BlobSendComplete(int result) {
}
}
+void WebSocketHost::OnLoaderTransferTest_Setup(int buffer_size) {
+ // fprintf(stderr, "%s\n", __PRETTY_FUNCTION__);
+ loader_test_num_read_bytes_ = 0;
+ base::SharedMemoryHandle handle;
+ shared_memory_.reset(new base::SharedMemory);
+ shared_memory_->CreateAndMapAnonymous(buffer_size);
+ shared_memory_->ShareToProcess(dispatcher_->PeerHandle(), &handle);
+ dispatcher_->SendLoaderTransferTest_SetDataBuffer(routing_id_, handle);
+}
+
+void WebSocketHost::OnLoaderTransferTest_Send(int offset, int size) {
+ // fprintf(stderr, "%s offset = %d, size = %d\n", __PRETTY_FUNCTION__, offset, size);
+ loader_test_num_read_bytes_ += size;
+ dispatcher_->SendLoaderTransferTest_Ack(routing_id_);
+
+ // const char* p = static_cast<const char*>(shared_memory_->memory()) + offset;
+ // fprintf(stderr, "*p = 0x%02x\n", *p);
+}
+
+void WebSocketHost::OnLoaderTransferTest_Close() {
+ // fprintf(stderr, "%s\n", __PRETTY_FUNCTION__);
+ shared_memory_ = nullptr;
+ dispatcher_->SendLoaderTransferTest_Done(routing_id_);
+ fprintf(stderr, "%s done: read %zu bytes\n", __PRETTY_FUNCTION__,
+ loader_test_num_read_bytes_);
+}
+
+
} // namespace content
« no previous file with comments | « content/browser/renderer_host/websocket_host.h ('k') | content/child/websocket_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698