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

Unified Diff: chrome/browser/renderer_host/resource_dispatcher_host.cc

Issue 42541: Prioritize which HTTP requests get a socket first by adding a priority level ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « chrome/browser/renderer_host/resource_dispatcher_host.h ('k') | net/base/client_socket_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/resource_dispatcher_host.cc
===================================================================
--- chrome/browser/renderer_host/resource_dispatcher_host.cc (revision 12453)
+++ chrome/browser/renderer_host/resource_dispatcher_host.cc (working copy)
@@ -53,7 +53,7 @@
#endif
// Uncomment to enable logging of request traffic.
-//#define LOG_RESOURCE_DISPATCHER_REQUESTS
+// #define LOG_RESOURCE_DISPATCHER_REQUESTS
#ifdef LOG_RESOURCE_DISPATCHER_REQUESTS
# define RESOURCE_LOG(stuff) LOG(INFO) << stuff
@@ -328,6 +328,18 @@
request->set_context(context);
request->set_origin_pid(request_data.origin_pid);
+ // If the request is for the top level page or a frame/iframe, then we should
+ // prioritize it higher than other resource types. Currently, we just use
+ // priorities 1 and 0.
+ // TODO(willchan): Revisit the actual priorities when looking at considering
+ // boosting priorities for requests for the foreground tab.
+ if (request_data.resource_type == ResourceType::MAIN_FRAME ||
+ request_data.resource_type == ResourceType::SUB_FRAME) {
+ request->set_priority(1);
+ } else {
+ request->set_priority(0);
+ }
+
// Set upload data.
uint64 upload_size = 0;
if (!request_data.upload_content.empty()) {
@@ -377,7 +389,8 @@
request_data.main_frame_origin,
request_data.resource_type,
upload_size);
- extra_info->allow_download = ResourceType::IsFrame(request_data.resource_type);
+ extra_info->allow_download =
+ ResourceType::IsFrame(request_data.resource_type);
request->set_user_data(extra_info); // takes pointer ownership
BeginRequestInternal(request);
@@ -511,7 +524,7 @@
"null", // frame_origin
"null", // main_frame_origin
ResourceType::SUB_RESOURCE,
- 0 /* upload_size */ );
+ 0 /* upload_size */);
extra_info->allow_download = true;
extra_info->is_download = true;
request->set_user_data(extra_info); // Takes pointer ownership.
« no previous file with comments | « chrome/browser/renderer_host/resource_dispatcher_host.h ('k') | net/base/client_socket_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698