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

Unified Diff: content/child/bluetooth/bluetooth_message_filter.cc

Issue 892543002: workers: Introduce a WorkerMessageFilter to ease routing/processing worker messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 11 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/bluetooth/bluetooth_message_filter.h ('k') | content/child/child_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/bluetooth/bluetooth_message_filter.cc
diff --git a/content/child/bluetooth/bluetooth_message_filter.cc b/content/child/bluetooth/bluetooth_message_filter.cc
index b33967408a6e1bbeaf8244153a36732f5cca2394..554e3c30711dd56d7791adbbd1a643953b800d31 100644
--- a/content/child/bluetooth/bluetooth_message_filter.cc
+++ b/content/child/bluetooth/bluetooth_message_filter.cc
@@ -4,40 +4,34 @@
#include "content/child/bluetooth/bluetooth_message_filter.h"
-#include "base/message_loop/message_loop_proxy.h"
#include "content/child/bluetooth/bluetooth_dispatcher.h"
#include "content/child/thread_safe_sender.h"
-#include "content/child/worker_thread_task_runner.h"
#include "ipc/ipc_message_macros.h"
namespace content {
BluetoothMessageFilter::BluetoothMessageFilter(ThreadSafeSender* sender)
- : main_thread_loop_proxy_(base::MessageLoopProxy::current()),
- thread_safe_sender_(sender) {
+ : WorkerThreadMessageFilter(sender) {
}
BluetoothMessageFilter::~BluetoothMessageFilter() {
}
-base::TaskRunner* BluetoothMessageFilter::OverrideTaskRunnerForMessage(
+bool BluetoothMessageFilter::ShouldHandleMessage(
+ const IPC::Message& msg) const {
+ return IPC_MESSAGE_CLASS(msg) == BluetoothMsgStart;
+}
+
+void BluetoothMessageFilter::OnFilteredMessageReceived(
const IPC::Message& msg) {
- if (IPC_MESSAGE_CLASS(msg) != BluetoothMsgStart)
- return NULL;
- int ipc_thread_id = 0;
- const bool success = PickleIterator(msg).ReadInt(&ipc_thread_id);
- DCHECK(success);
- if (!ipc_thread_id)
- return main_thread_loop_proxy_.get();
- return new WorkerThreadTaskRunner(ipc_thread_id);
+ BluetoothDispatcher::GetOrCreateThreadSpecificInstance(thread_safe_sender())
+ ->OnMessageReceived(msg);
}
-bool BluetoothMessageFilter::OnMessageReceived(const IPC::Message& msg) {
- if (IPC_MESSAGE_CLASS(msg) != BluetoothMsgStart)
- return false;
- BluetoothDispatcher::GetOrCreateThreadSpecificInstance(
- thread_safe_sender_.get())->OnMessageReceived(msg);
- return true;
+bool BluetoothMessageFilter::GetWorkerThreadIdForMessage(
+ const IPC::Message& msg,
+ int* ipc_thread_id) {
+ return PickleIterator(msg).ReadInt(ipc_thread_id);
}
} // namespace content
« no previous file with comments | « content/child/bluetooth/bluetooth_message_filter.h ('k') | content/child/child_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698