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

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

Issue 12243002: Pass WebKit priority changes and parsing messages up to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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
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 9dcf49e5fe3cbec993ffd3faf6eee11dd7649677..0d94b5e6d081bacaf514e9c7a7b00890f7d39f22 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -203,9 +203,9 @@ void RemoveDownloadFileFromChildSecurityPolicy(int child_id,
#pragma warning(default: 4748)
#endif
-net::RequestPriority DetermineRequestPriority(
- const ResourceHostMsg_Request& request_data) {
- switch (request_data.priority) {
+net::RequestPriority ConvertWebKitPriorityToNetPriority(
+ const WebKit::WebURLRequest::Priority& priority) {
+ switch (priority) {
case WebKit::WebURLRequest::PriorityVeryHigh:
return net::HIGHEST;
@@ -792,6 +792,7 @@ bool ResourceDispatcherHostImpl::OnMessageReceived(
IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK)
IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest)
IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect)
+ IPC_MESSAGE_HANDLER(ResourceHostMsg_DidChangePriority, OnDidChangePriority)
IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache,
OnDidLoadResourceFromMemoryCache)
@@ -922,7 +923,8 @@ void ResourceDispatcherHostImpl::BeginRequest(
request->set_load_flags(load_flags);
- request->set_priority(DetermineRequestPriority(request_data));
+ request->set_priority(ConvertWebKitPriorityToNetPriority(
+ request_data.priority));
// Resolve elements from request_body and prepare upload data.
if (request_data.request_body) {
@@ -1127,6 +1129,20 @@ void ResourceDispatcherHostImpl::OnFollowRedirect(
}
}
+void ResourceDispatcherHostImpl::OnDidChangePriority(
+ int request_id,
+ WebKit::WebURLRequest::Priority priority) {
+ int child_id = filter_->child_id();
+ LoaderMap::iterator it = pending_loaders_.find(
+ GlobalRequestID(child_id, request_id));
+ if (it == pending_loaders_.end()) {
+ // PendingRequest likely removed while this IPC was in flight.
+ return;
+ }
+ const linked_ptr<ResourceLoader>& loader = it->second;
+ loader->ChangePriority(ConvertWebKitPriorityToNetPriority(priority));
darin (slow to review) 2013/02/06 05:04:13 Maybe instead of routing this notification through
+}
+
ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo(
int child_id,
int route_id,

Powered by Google App Engine
This is Rietveld 408576698