summaryrefslogtreecommitdiffstats
path: root/content/child/resource_dispatcher.h
diff options
context:
space:
mode:
authorjdduke <jdduke@chromium.org>2015-02-04 19:47:15 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-05 03:48:16 +0000
commitacfb4199abf841a1577c3968579c43b0232a53b7 (patch)
treed1152d77cb4c20309f44895fbde784ffdba41199 /content/child/resource_dispatcher.h
parent072ef39848b879faa486c76568c1b023524f0fb3 (diff)
downloadchromium_src-acfb4199abf841a1577c3968579c43b0232a53b7.zip
chromium_src-acfb4199abf841a1577c3968579c43b0232a53b7.tar.gz
chromium_src-acfb4199abf841a1577c3968579c43b0232a53b7.tar.bz2
Throttle resource message requests during user interaction
Resource message requests can be relatively expensive, particularly in the induced work on the browser IO thread. Currently, there is no bound on the rate with which such requests are dispatched from the renderer. This leads to situations where the browser IO thread is flooded with requests, potentially causing scroll jank and otherwise undesirable stalls in the browser pipeline. Introduce a ResourceMessageThrottler which intercepts and defers a given resource message stream, depending on the state of the RendererScheduler. When the RendererScheduler indicates that high priority work is imminent/likely, requests will be throttled according to a configurable dispatch rate. Hook this throttling mechanism up to the ResourceDispatcher, limiting the number of resource message requests/second during user interaction to 180 (3 per frame at 60 fps) on Android, and 480 on desktop. See goo.gl/H42AgQ for more design details. BUG=440037,402136 Review URL: https://codereview.chromium.org/847883002 Cr-Commit-Position: refs/heads/master@{#314739}
Diffstat (limited to 'content/child/resource_dispatcher.h')
-rw-r--r--content/child/resource_dispatcher.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/content/child/resource_dispatcher.h b/content/child/resource_dispatcher.h
index 1e646fb..ce21c3b 100644
--- a/content/child/resource_dispatcher.h
+++ b/content/child/resource_dispatcher.h
@@ -99,6 +99,12 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
const ResourceMsg_RequestCompleteData& request_complete_data,
const base::TimeTicks& renderer_completion_time);
+ void set_message_sender(IPC::Sender* sender) {
+ DCHECK(sender);
+ DCHECK(pending_requests_.empty());
+ message_sender_ = sender;
+ }
+
IPC::Sender* message_sender() const { return message_sender_; }
// This does not take ownership of the delegate. It is expected that the