Chromium Code Reviews| 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..6f66055296c57547c44a6f21719932c4fd67551e 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,13 @@ 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); |
| + scoped_ptr<ScheduledResourceRequest> scheduled_resource_request( |
| + scheduler_->ScheduleRequest(child_id, route_id, info->IsAsync(), |
| + request)); |
| + info->set_scheduled_resource_request(scheduled_resource_request.get()); |
|
davidben
2015/08/12 23:58:11
There is a sliiiiight awkwardness in that it's not
Adam Rice
2015/08/13 21:21:02
If we can guarantee that no-one forges a DidChange
davidben
2015/08/13 23:08:52
Yeah, I think right now we are guaranteed to not h
Adam Rice
2015/08/13 23:42:28
The only think that actually looked at that field
|
| + throttles.push_back(scheduled_resource_request.Pass()); |
| handler.reset( |
| new ThrottlingResourceHandler(handler.Pass(), request, throttles.Pass())); |
| @@ -1448,6 +1454,19 @@ 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) { |
|
davidben
2015/08/12 23:58:11
Since this is coming from the renderer, it should
Adam Rice
2015/08/13 21:21:02
I should have spotted that. Done.
|
| + ScheduledResourceRequest* scheduled_resource_request = |
| + GetLoader(filter_->child_id(), request_id) |
| + ->GetRequestInfo() |
| + ->scheduled_resource_request(); |
| + DCHECK(scheduled_resource_request); |
| + scheduled_resource_request->ChangePriority(new_priority, |
| + intra_priority_value); |
| +} |
| + |
| void ResourceDispatcherHostImpl::OnDataDownloadedACK(int request_id) { |
| // TODO(michaeln): maybe throttle DataDownloaded messages |
| } |