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

Unified Diff: content/child/websocket_dispatcher.cc

Issue 2000113002: Delegate WebSocket message handlers to the loading task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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_dispatcher.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/websocket_dispatcher.cc
diff --git a/content/child/websocket_dispatcher.cc b/content/child/websocket_dispatcher.cc
index 9fc3370bb65d8bcc1b380761dba11efcf43103f9..54d9c1a18e84392ae123937c06ddc35f29950e11 100644
--- a/content/child/websocket_dispatcher.cc
+++ b/content/child/websocket_dispatcher.cc
@@ -7,6 +7,7 @@
#include <stdint.h>
#include <map>
+#include "base/bind.h"
#include "base/logging.h"
#include "content/child/websocket_bridge.h"
#include "content/common/websocket_messages.h"
@@ -15,7 +16,8 @@
namespace content {
-WebSocketDispatcher::WebSocketDispatcher() : channel_id_max_(0) {}
+WebSocketDispatcher::WebSocketDispatcher() : channel_id_max_(0) {
+}
WebSocketDispatcher::~WebSocketDispatcher() {}
@@ -49,10 +51,22 @@ bool WebSocketDispatcher::OnMessageReceived(const IPC::Message& msg) {
return false;
}
+ loading_task_runner_->PostTask(FROM_HERE,
Sami 2016/05/23 09:56:07 I guess what will end up happening here is that On
+ base::Bind(&WebSocketDispatcher::OnMessageReceivedOnLoadingTaskRunner,
+ base::Unretained(this), msg));
+ return true;
+}
+
+void WebSocketDispatcher::SetLoadingTaskRunner(
+ scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner) {
+ loading_task_runner_ = loading_task_runner;
+}
+
+void WebSocketDispatcher::OnMessageReceivedOnLoadingTaskRunner(
+ IPC::Message msg) {
WebSocketBridge* bridge = GetBridge(msg.routing_id(), msg.type());
- if (!bridge)
- return true;
- return bridge->OnMessageReceived(msg);
+ if (bridge)
+ bridge->OnMessageReceived(msg);
}
WebSocketBridge* WebSocketDispatcher::GetBridge(int channel_id, uint32_t type) {
« no previous file with comments | « content/child/websocket_dispatcher.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698