diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-20 18:39:08 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-20 18:39:08 +0000 |
commit | 510e854f122deaedd5ba31af188105131a4c3b7d (patch) | |
tree | 03e6cbdeafa6529ab491fb85f05f6955ba713a70 /chrome | |
parent | 8f1915d7a94456f029a25abdc64f9a5f6bdd1711 (diff) | |
download | chromium_src-510e854f122deaedd5ba31af188105131a4c3b7d.zip chromium_src-510e854f122deaedd5ba31af188105131a4c3b7d.tar.gz chromium_src-510e854f122deaedd5ba31af188105131a4c3b7d.tar.bz2 |
Add a FieldTrial and histograms for measuring impact of http prioritization.
Currently this FieldTrial is measuring the transaction latencies of requests, separated into frame/subframe requests vs subresource requests. We run a 2% holdback experiment where the people in the holdback don't have http prioritization enabled. Add class static method to ResourceDispatcherHost to disable http prioritization.
BUG=10486
Review URL: http://codereview.chromium.org/67119
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser_main.cc | 9 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host.cc | 44 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host.h | 10 |
3 files changed, 42 insertions, 21 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 9e9d656..83422e6 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -478,6 +478,15 @@ int BrowserMain(const MainFunctionParams& parameters) { net::HttpNetworkSession::set_max_sockets_per_group(4); } + scoped_refptr<FieldTrial> http_prioritization_trial = + new FieldTrial("HttpPrioritization", 100); + // Put 10% of people in the fallback experiment with the http prioritization + // code disabled. + const int holdback_group = + http_prioritization_trial->AppendGroup("_no_http_prioritization", 10); + if (http_prioritization_trial->group() == holdback_group) { + ResourceDispatcherHost::DisableHttpPrioritization(); + } #if defined(OS_WIN) // Init common control sex. diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index db852b4..a4cd3ba 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -68,17 +68,7 @@ using base::TimeTicks; // ---------------------------------------------------------------------------- -// The interval for calls to ResourceDispatcherHost::UpdateLoadStates -static const int kUpdateLoadStatesIntervalMsec = 100; - -// Maximum number of pending data messages sent to the renderer at any -// given time for a given request. -static const int kMaxPendingDataMessages = 20; - -// Maximum byte "cost" of all the outstanding requests for a renderer. -// See delcaration of |max_outstanding_requests_cost_per_process_| for details. -// This bound is 25MB, which allows for around 6000 outstanding requests. -static const int kMaxOutstandingRequestsCostPerProcess = 26214400; +bool ResourceDispatcherHost::g_is_http_prioritization_enabled = true; // A ShutdownTask proxies a shutdown task from the UI thread to the IO thread. // It should be constructed on the UI thread and run in the IO thread. @@ -97,6 +87,18 @@ class ResourceDispatcherHost::ShutdownTask : public Task { namespace { +// The interval for calls to ResourceDispatcherHost::UpdateLoadStates +const int kUpdateLoadStatesIntervalMsec = 100; + +// Maximum number of pending data messages sent to the renderer at any +// given time for a given request. +const int kMaxPendingDataMessages = 20; + +// Maximum byte "cost" of all the outstanding requests for a renderer. +// See delcaration of |max_outstanding_requests_cost_per_process_| for details. +// This bound is 25MB, which allows for around 6000 outstanding requests. +const int kMaxOutstandingRequestsCostPerProcess = 26214400; + // Consults the RendererSecurity policy to determine whether the // ResourceDispatcherHost should service this request. A request might be // disallowed if the renderer is not authorized to restrive the request URL or @@ -340,16 +342,16 @@ void ResourceDispatcherHost::BeginRequest( request->set_context(context); request->set_origin_pid(request_data.origin_pid); - // If the request is for the top level page or a frame/iframe, then we should - // prioritize it higher than other resource types. Currently, we just use - // priorities 1 and 0. - // TODO(willchan): Revisit the actual priorities when looking at considering - // boosting priorities for requests for the foreground tab. - if (request_data.resource_type == ResourceType::MAIN_FRAME || - request_data.resource_type == ResourceType::SUB_FRAME) { - request->set_priority(1); - } else { - request->set_priority(0); + if (IsHttpPrioritizationEnabled()) { + // If the request is for the top level page or a frame/iframe, then we + // should prioritize it higher than other resource types. Currently, we + // just use priorities 1 and 0. + if (request_data.resource_type == ResourceType::MAIN_FRAME || + request_data.resource_type == ResourceType::SUB_FRAME) { + request->set_priority(1); + } else { + request->set_priority(0); + } } // Set upload data. diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h index ba699bc..fd6e06c 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.h +++ b/chrome/browser/renderer_host/resource_dispatcher_host.h @@ -370,6 +370,14 @@ class ResourceDispatcherHost : public URLRequest::Delegate { return false; } + static void DisableHttpPrioritization() { + g_is_http_prioritization_enabled = false; + } + + static bool IsHttpPrioritizationEnabled() { + return g_is_http_prioritization_enabled; + } + private: FRIEND_TEST(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies); FRIEND_TEST(ResourceDispatcherHostTest, @@ -556,6 +564,8 @@ class ResourceDispatcherHost : public URLRequest::Delegate { // to the source of the message. Receiver* receiver_; + static bool g_is_http_prioritization_enabled; + DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); }; |