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

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: Working patch 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..3feb13778575b9357f161fd1a50d3ee81f349fa8 100644
--- a/ipc/ipc_channel_proxy.h
+++ b/ipc/ipc_channel_proxy.h
@@ -88,6 +88,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 +231,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_;
piman 2014/02/11 21:48:46 Do we need this? Can't we just iterate over messag
jdduke (slow) 2014/02/11 23:01:48 Well, there are a few operations where we iterate
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.
+ std::vector<MessageFilter*> message_global_filters_;
+ // TODO(jdduke): Determine if base::SmallMap is a sensible choice here,
+ // or simply an array of length (LastIPCMsgStart + 1).
epennerAtGoogle 2014/02/10 23:55:47 +1 to just a resized-vector, or something equivale
piman 2014/02/11 21:48:46 An array sg. Generally, hash_maps are preferred to
jdduke (slow) 2014/02/11 23:01:48 Done.
epennerAtGoogle 2014/02/12 02:34:09 Just FYI, I mentioned vector since it typically ha
+ typedef std::map<uint32, std::vector<MessageFilter*> >
+ MessageClassFilterMap;
+ MessageClassFilterMap message_class_filters_;
+
// 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