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

Unified Diff: ipc/ipc_forwarding_message_filter.cc

Issue 10735010: 3D Compositing in <browser>, first draft. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use the correct baseline Created 8 years, 4 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 | « ipc/ipc_forwarding_message_filter.h ('k') | ipc/ipc_sync_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_forwarding_message_filter.cc
diff --git a/ipc/ipc_forwarding_message_filter.cc b/ipc/ipc_forwarding_message_filter.cc
index d886706cc423846b487714b418d1ee5cf1277be3..5acffc3240d54818a64ea53379eb2fb8bc0ad86d 100644
--- a/ipc/ipc_forwarding_message_filter.cc
+++ b/ipc/ipc_forwarding_message_filter.cc
@@ -13,7 +13,8 @@ ForwardingMessageFilter::ForwardingMessageFilter(
const uint32* message_ids_to_filter,
size_t num_message_ids_to_filter,
base::TaskRunner* target_task_runner)
- : target_task_runner_(target_task_runner) {
+ : target_task_runner_(target_task_runner)
+ , id_callback_(base::Bind(&GetMessageRoutingID)) {
DCHECK(target_task_runner_);
for (size_t i = 0; i < num_message_ids_to_filter; i++)
message_ids_to_filter_.insert(message_ids_to_filter[i]);
@@ -30,19 +31,26 @@ void ForwardingMessageFilter::RemoveRoute(int routing_id) {
handlers_.erase(routing_id);
}
+void ForwardingMessageFilter::SetIDCallback(const IDCallback& id_callback) {
+ base::AutoLock locked(handlers_lock_);
+ DCHECK(!id_callback.is_null());
+ id_callback_ = id_callback;
+}
+
bool ForwardingMessageFilter::OnMessageReceived(const Message& message) {
if (message_ids_to_filter_.find(message.type()) ==
message_ids_to_filter_.end())
return false;
-
Handler handler;
{
base::AutoLock locked(handlers_lock_);
- std::map<int, Handler>::iterator it = handlers_.find(message.routing_id());
+ std::map<int, Handler>::iterator it =
+ handlers_.find(id_callback_.Run(message));
if (it == handlers_.end())
return false;
+
handler = it->second;
}
« no previous file with comments | « ipc/ipc_forwarding_message_filter.h ('k') | ipc/ipc_sync_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698