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

Unified Diff: ipc/ipc_forwarding_message_filter.h

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
Index: ipc/ipc_forwarding_message_filter.h
diff --git a/ipc/ipc_forwarding_message_filter.h b/ipc/ipc_forwarding_message_filter.h
index 919a44d75994588f222f6136077a4f14ac7a972b..fe850522b09883788d7272934becd5ef9dd5f6fa 100644
--- a/ipc/ipc_forwarding_message_filter.h
+++ b/ipc/ipc_forwarding_message_filter.h
@@ -30,6 +30,8 @@ class IPC_EXPORT ForwardingMessageFilter : public ChannelProxy::MessageFilter {
// |target_task_runner| with messages that were intercepted by this filter.
typedef base::Callback<void(const Message&)> Handler;
+ typedef base::Callback<int(const Message&)> IDCallback;
+
// This filter will intercept |message_ids_to_filter| and post
// them to the provided |target_task_runner|, where they will be given
// to |handler|.
@@ -40,13 +42,23 @@ class IPC_EXPORT ForwardingMessageFilter : public ChannelProxy::MessageFilter {
size_t num_message_ids_to_filter,
base::TaskRunner* target_task_runner);
- // Define the message routes to be filtered.
+ // Define the message IDs to be filtered. By default, the ID is the message's
+ // routing ID but this can be changed with SetIDCallback.
void AddRoute(int routing_id, const Handler& handler);
void RemoveRoute(int routing_id);
+ // Set the function used to extract an ID from a message.
+ void SetIDCallback(const IDCallback& function);
+
// ChannelProxy::MessageFilter methods:
virtual bool OnMessageReceived(const Message& message) OVERRIDE;
+ // Extract the routing ID. Can be used to reset the ID function to the
+ // default.
+ static int GetMessageRoutingID(const Message& message) {
+ return message.routing_id();
+ }
+
private:
friend class ChannelProxy::MessageFilter;
virtual ~ForwardingMessageFilter();
@@ -63,6 +75,9 @@ class IPC_EXPORT ForwardingMessageFilter : public ChannelProxy::MessageFilter {
// Indicates the routing_ids for which messages should be filtered.
std::map<int, Handler> handlers_;
+ // The function used for extracting IDs.
+ IDCallback id_callback_;
+
DISALLOW_COPY_AND_ASSIGN(ForwardingMessageFilter);
};
« no previous file with comments | « content/renderer/browser_plugin/mock_browser_plugin_texture_provider.cc ('k') | ipc/ipc_forwarding_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698