summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_channel_proxy.h
diff options
context:
space:
mode:
authorjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-16 22:11:26 +0000
committerjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-16 22:11:26 +0000
commit2955e4e3c747fd4aa3c227d6c4e4c698cf31b3c4 (patch)
tree4653406477771c82a78bb65092cbc252a789b2f6 /ipc/ipc_channel_proxy.h
parentbaf64d069a6bbc6e87f3ce9eaf7ed5bb775f0965 (diff)
downloadchromium_src-2955e4e3c747fd4aa3c227d6c4e4c698cf31b3c4.zip
chromium_src-2955e4e3c747fd4aa3c227d6c4e4c698cf31b3c4.tar.gz
chromium_src-2955e4e3c747fd4aa3c227d6c4e4c698cf31b3c4.tar.bz2
Allow MessageFilters to restrict listening to specific message classes
ChannelProxy currently offers messages to all member MessageFilters. It turns out that a good portion of the most common message types will never be filtered, making the O(N) filter walk an unnecessary affair. To prevent this, allow MessageFilters to indicate which (if any) subset of message classes they may filter, allowing the ChannelProxy to refine the list of filters that are offered a particular message. This saves ~35us per message received on the browser IO thread for a typical Android device. BUG=340881 TBR=asargent@chromium.org Review URL: https://codereview.chromium.org/142923005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251622 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_proxy.h')
-rw-r--r--ipc/ipc_channel_proxy.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h
index 1f5ecf4..dca8c97 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();
@@ -230,6 +237,11 @@ class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe {
std::string channel_id_;
bool channel_connected_called_;
+ // Routes a given message to a proper subset of |filters_|, depending
+ // on which message classes a filter might support.
+ class MessageFilterRouter;
+ scoped_ptr<MessageFilterRouter> message_filter_router_;
+
// 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_;