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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 11270027: Add a ResourceScheduler to ResourceDispatcherHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move Client back to .h -- broke Win Created 7 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
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/loader/resource_scheduler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 37891cb2bc672e2fc35321de022a5539728e50e7..de3c2d85ae44909773f54b30687d39c02f461b1f 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -205,31 +205,6 @@ void RemoveDownloadFileFromChildSecurityPolicy(int child_id,
#pragma warning(default: 4748)
#endif
-net::RequestPriority DetermineRequestPriority(
- const ResourceHostMsg_Request& request_data) {
- switch (request_data.priority) {
- case WebKit::WebURLRequest::PriorityVeryHigh:
- return net::HIGHEST;
-
- case WebKit::WebURLRequest::PriorityHigh:
- return net::MEDIUM;
-
- case WebKit::WebURLRequest::PriorityMedium:
- return net::LOW;
-
- case WebKit::WebURLRequest::PriorityLow:
- return net::LOWEST;
-
- case WebKit::WebURLRequest::PriorityVeryLow:
- return net::IDLE;
-
- case WebKit::WebURLRequest::PriorityUnresolved:
- default:
- NOTREACHED();
- return net::LOW;
- }
-}
-
void OnSwapOutACKHelper(int render_process_id,
int render_view_id,
bool timed_out) {
@@ -339,9 +314,10 @@ ResourceDispatcherHostImpl::ResourceDispatcherHostImpl()
&last_user_gesture_time_,
"We don't care about the precise value, see http://crbug.com/92889");
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&appcache::AppCacheInterceptor::EnsureRegistered));
+ BrowserThread::PostTask(BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(&ResourceDispatcherHostImpl::OnInit,
+ base::Unretained(this)));
update_load_states_timer_.reset(
new base::RepeatingTimer<ResourceDispatcherHostImpl>());
@@ -750,6 +726,11 @@ bool ResourceDispatcherHostImpl::RenderViewForRequest(
return info->GetAssociatedRenderView(render_process_id, render_view_id);
}
+void ResourceDispatcherHostImpl::OnInit() {
+ scheduler_.reset(new ResourceScheduler);
+ appcache::AppCacheInterceptor::EnsureRegistered();
+}
+
void ResourceDispatcherHostImpl::OnShutdown() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -777,6 +758,8 @@ void ResourceDispatcherHostImpl::OnShutdown() {
iter != ids.end(); ++iter) {
CancelBlockedRequestsForRoute(iter->first, iter->second);
}
+
+ scheduler_.reset();
}
bool ResourceDispatcherHostImpl::OnMessageReceived(
@@ -939,8 +922,7 @@ void ResourceDispatcherHostImpl::BeginRequest(
// transferred navigation case?
request->set_load_flags(load_flags);
-
- request->set_priority(DetermineRequestPriority(request_data));
+ request->set_priority(request_data.priority);
// Resolve elements from request_body and prepare upload data.
if (request_data.request_body) {
@@ -1049,11 +1031,12 @@ void ResourceDispatcherHostImpl::BeginRequest(
new TransferNavigationResourceThrottle(request));
}
- if (!throttles.empty()) {
- handler.reset(
- new ThrottlingResourceHandler(handler.Pass(), child_id, request_id,
- throttles.Pass()));
- }
+ throttles.push_back(
+ scheduler_->ScheduleRequest(child_id, route_id, request).release());
+
+ handler.reset(
+ new ThrottlingResourceHandler(handler.Pass(), child_id, request_id,
+ throttles.Pass()));
if (deferred_loader.get()) {
pending_loaders_[extra_info->GetGlobalRequestID()] = deferred_loader;
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/loader/resource_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698