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

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

Issue 12321055: Revert 183382 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1418/src/
Patch Set: 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
===================================================================
--- content/browser/loader/resource_dispatcher_host_impl.cc (revision 183842)
+++ content/browser/loader/resource_dispatcher_host_impl.cc (working copy)
@@ -205,6 +205,31 @@
#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) {
@@ -314,10 +339,9 @@
&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(&ResourceDispatcherHostImpl::OnInit,
- base::Unretained(this)));
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&appcache::AppCacheInterceptor::EnsureRegistered));
update_load_states_timer_.reset(
new base::RepeatingTimer<ResourceDispatcherHostImpl>());
@@ -726,11 +750,6 @@
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));
@@ -758,8 +777,6 @@
iter != ids.end(); ++iter) {
CancelBlockedRequestsForRoute(iter->first, iter->second);
}
-
- scheduler_.reset();
}
bool ResourceDispatcherHostImpl::OnMessageReceived(
@@ -922,8 +939,9 @@
// transferred navigation case?
request->set_load_flags(load_flags);
- request->set_priority(request_data.priority);
+ request->set_priority(DetermineRequestPriority(request_data));
+
// Resolve elements from request_body and prepare upload data.
if (request_data.request_body) {
request->set_upload(make_scoped_ptr(
@@ -1031,13 +1049,12 @@
new TransferNavigationResourceThrottle(request));
}
- throttles.push_back(
- scheduler_->ScheduleRequest(child_id, route_id, request).release());
+ if (!throttles.empty()) {
+ handler.reset(
+ new ThrottlingResourceHandler(handler.Pass(), child_id, request_id,
+ throttles.Pass()));
+ }
- handler.reset(
- new ThrottlingResourceHandler(handler.Pass(), child_id, request_id,
- throttles.Pass()));
-
if (deferred_loader.get()) {
pending_loaders_[extra_info->GetGlobalRequestID()] = deferred_loader;
deferred_loader->CompleteTransfer(handler.Pass());
« 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