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

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: Major changes to clean up deadlock & other issues 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
« ipc/ipc_forwarding_message_filter.h ('K') | « ipc/ipc_forwarding_message_filter.h ('k') | no next file » | 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 48f6e5ff810dbd14fa9afe2f98901098bbb3b986..7bceab7107e580a7ddb301a146978382aafef055 100644
--- a/ipc/ipc_forwarding_message_filter.cc
+++ b/ipc/ipc_forwarding_message_filter.cc
@@ -32,6 +32,12 @@ void ForwardingMessageFilter::RemoveRoute(int routing_id) {
routes_.erase(routing_id);
}
+void ForwardingMessageFilter::SetPredicate(
+ base::Callback<bool(const Message&)> predicate) {
+ base::AutoLock locked(routes_lock_);
+ predicate_ = predicate;
+}
+
bool ForwardingMessageFilter::OnMessageReceived(const Message& message) {
if (message_ids_to_filter_.find(message.type()) ==
message_ids_to_filter_.end())
@@ -41,6 +47,9 @@ bool ForwardingMessageFilter::OnMessageReceived(const Message& message) {
base::AutoLock locked(routes_lock_);
if (routes_.find(message.routing_id()) == routes_.end())
return false;
+
+ if (!predicate_.is_null() && !predicate_.Run(message))
+ return false;
}
target_task_runner_->PostTask(
« ipc/ipc_forwarding_message_filter.h ('K') | « ipc/ipc_forwarding_message_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698