summaryrefslogtreecommitdiffstats
path: root/content/browser/loader
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 /content/browser/loader
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 'content/browser/loader')
-rw-r--r--content/browser/loader/resource_message_filter.cc4
-rw-r--r--content/browser/loader/resource_scheduler_filter.cc10
2 files changed, 12 insertions, 2 deletions
diff --git a/content/browser/loader/resource_message_filter.cc b/content/browser/loader/resource_message_filter.cc
index c3f30ff..bd7e078 100644
--- a/content/browser/loader/resource_message_filter.cc
+++ b/content/browser/loader/resource_message_filter.cc
@@ -7,6 +7,7 @@
#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/fileapi/chrome_blob_storage_context.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
+#include "content/common/resource_messages.h"
#include "content/public/browser/resource_context.h"
#include "webkit/browser/fileapi/file_system_context.h"
@@ -19,7 +20,8 @@ ResourceMessageFilter::ResourceMessageFilter(
ChromeBlobStorageContext* blob_storage_context,
fileapi::FileSystemContext* file_system_context,
const GetContextsCallback& get_contexts_callback)
- : child_id_(child_id),
+ : BrowserMessageFilter(ResourceMsgStart),
+ child_id_(child_id),
process_type_(process_type),
appcache_service_(appcache_service),
blob_storage_context_(blob_storage_context),
diff --git a/content/browser/loader/resource_scheduler_filter.cc b/content/browser/loader/resource_scheduler_filter.cc
index 2cf32e6..97e219e 100644
--- a/content/browser/loader/resource_scheduler_filter.cc
+++ b/content/browser/loader/resource_scheduler_filter.cc
@@ -11,9 +11,17 @@
#include "content/public/common/page_transition_types.h"
namespace content {
+namespace {
+const uint32 kFilteredMessageClasses[] = {
+ FrameMsgStart,
+ ViewMsgStart,
+};
+} // namespace
ResourceSchedulerFilter::ResourceSchedulerFilter(int child_id)
- : child_id_(child_id) {
+ : BrowserMessageFilter(
+ kFilteredMessageClasses, arraysize(kFilteredMessageClasses)),
+ child_id_(child_id) {
}
ResourceSchedulerFilter::~ResourceSchedulerFilter() {