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

Unified Diff: ipc/ipc_channel_proxy.h

Issue 142923005: Allow MessageFilters to restrict listening to specific message classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 10 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_channel_proxy.h
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h
index 1f5ecf450df7f7c6d8a486a3d4efb76a95e1f81e..b326b6740fae4589ebb4dd7e70e4a7874a82ec24 100644
--- a/ipc/ipc_channel_proxy.h
+++ b/ipc/ipc_channel_proxy.h
@@ -14,6 +14,7 @@
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_listener.h"
+#include "ipc/ipc_message_start.h"
#include "ipc/ipc_sender.h"
namespace base {
@@ -88,6 +89,13 @@ class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe {
// the message be handled in the default way.
virtual bool OnMessageReceived(const Message& message);
+ // Called to query the Message classes supported by the filter. Return
+ // false to indicate that all message types should reach the filter, or true
+ // if the resulting contents of |supported_message_classes| may be used to
+ // selectively offer messages of a particular class to the filter.
+ virtual bool GetSupportedMessageClasses(
+ std::vector<uint32>* supported_message_classes) const;
+
protected:
virtual ~MessageFilter();
@@ -224,12 +232,22 @@ class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe {
Listener* listener_;
// List of filters. This is only accessed on the IPC thread.
- std::vector<scoped_refptr<MessageFilter> > filters_;
+ std::vector<scoped_refptr<MessageFilter> > all_filters_;
scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_;
scoped_ptr<Channel> channel_;
std::string channel_id_;
bool channel_connected_called_;
+ // List of global and selective filters; a given filter from |all_filters_|
+ // will exists in either |message_global_filters_| OR
+ // |message_class_filters_|, but not both.
+ // Note that |message_global_filters_| will be given first offering of any
+ // given message. It's the filter implementer and installer's
+ // responsibility to ensure that a filter is either global or selective to
+ // ensure proper message filtering order.
+ std::vector<MessageFilter*> message_global_filters_;
+ std::vector<MessageFilter*> message_class_filters_[LastIPCMsgStart];
+
// Holds filters between the AddFilter call on the listerner thread and the
// IPC thread when they're added to filters_.
std::vector<scoped_refptr<MessageFilter> > pending_filters_;

Powered by Google App Engine
This is Rietveld 408576698