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

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

Issue 1285863003: ResourceScheduler: remove dependency on ResourceRequestInfo and request_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: DCHECK that there isn't an existing ScheduledResourceRequest attached to the URLRequest. Created 5 years, 4 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
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 5600a23455fc80f8f2a6592077a78be2babcb165..2fe2443130d966e1b97051833d6322879646cdfd 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -978,6 +978,7 @@ bool ResourceDispatcherHostImpl::OnMessageReceived(
IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK)
IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK)
IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest)
+ IPC_MESSAGE_HANDLER(ResourceHostMsg_DidChangePriority, OnDidChangePriority)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -1435,8 +1436,10 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::AddStandardHandlers(
throttles.push_back(new PowerSaveBlockResourceThrottle());
}
- throttles.push_back(
- scheduler_->ScheduleRequest(child_id, route_id, request).release());
+ // TODO(ricea): Stop looking this up so much.
+ ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
+ throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id,
+ info->IsAsync(), request));
handler.reset(
new ThrottlingResourceHandler(handler.Pass(), request, throttles.Pass()));
@@ -1448,6 +1451,20 @@ void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) {
UnregisterDownloadedTempFile(filter_->child_id(), request_id);
}
+void ResourceDispatcherHostImpl::OnDidChangePriority(
+ int request_id,
+ net::RequestPriority new_priority,
+ int intra_priority_value) {
+ ResourceLoader* loader = GetLoader(filter_->child_id(), request_id);
+ // The request may go away before processing this message, so |loader| can
+ // legitimately be null.
+ if (!loader)
+ return;
+
+ scheduler_->ReprioritizeRequest(loader->request(), new_priority,
+ intra_priority_value);
+}
+
void ResourceDispatcherHostImpl::OnDataDownloadedACK(int request_id) {
// TODO(michaeln): maybe throttle DataDownloaded messages
}
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698