diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 20:42:55 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 20:42:55 +0000 |
commit | 725355a29e53a5bc0f37237b9be5023a35e0c09e (patch) | |
tree | 89338fa14de0636689c57716f8ffe1485540d3ea /chrome | |
parent | 78c3a37c716807e8f50444da64d6506632e13669 (diff) | |
download | chromium_src-725355a29e53a5bc0f37237b9be5023a35e0c09e.zip chromium_src-725355a29e53a5bc0f37237b9be5023a35e0c09e.tar.gz chromium_src-725355a29e53a5bc0f37237b9be5023a35e0c09e.tar.bz2 |
Reverting 12479 which reverted 12470.
This change is the same as 12470, except with HttpRequestInfo::priority initialized in the initializer list, which should fix the purify errors.
Review URL: http://codereview.chromium.org/53066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12490 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host.cc | 19 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host.h | 17 |
2 files changed, 29 insertions, 7 deletions
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index 9d4f7bd..da28df4 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -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 @@ -330,6 +330,18 @@ void ResourceDispatcherHost::BeginRequest( 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_data) { @@ -377,7 +389,8 @@ void ResourceDispatcherHost::BeginRequest( 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 @@ void ResourceDispatcherHost::BeginDownload(const GURL& url, "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. diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h index 2ec711b..052c157 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.h +++ b/chrome/browser/renderer_host/resource_dispatcher_host.h @@ -13,7 +13,11 @@ #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ #include <map> +#include <string> +#include <vector> +#include "base/basictypes.h" +#include "base/logging.h" #include "base/observer_list.h" #include "base/process.h" #include "base/timer.h" @@ -59,13 +63,14 @@ class ResourceDispatcherHost : public URLRequest::Delegate { const ViewHostMsg_Resource_Request& request_data) = 0; protected: - Receiver(ChildProcessInfo::ProcessType type) : ChildProcessInfo(type) { } + explicit Receiver(ChildProcessInfo::ProcessType type) + : ChildProcessInfo(type) { } virtual ~Receiver() { } }; // Holds the data we would like to associate with each request class ExtraRequestInfo : public URLRequest::UserData { - friend class ResourceDispatcherHost; + friend class ResourceDispatcherHost; public: ExtraRequestInfo(ResourceHandler* handler, ChildProcessInfo::ProcessType process_type, @@ -173,6 +178,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate { class Observer { public: + virtual ~Observer() { } virtual void OnRequestStarted(ResourceDispatcherHost* resource_dispatcher, URLRequest* request) = 0; virtual void OnResponseCompleted( @@ -358,7 +364,10 @@ class ResourceDispatcherHost : public URLRequest::Delegate { void DataReceivedACK(int process_id, int request_id); // Needed for the sync IPC message dispatcher macros. - bool Send(IPC::Message* message) { delete message; return false; } + bool Send(IPC::Message* message) { + delete message; + return false; + } private: FRIEND_TEST(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies); @@ -424,7 +433,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate { // It may be enhanced in the future to provide some kind of prioritization // mechanism. We should also consider a hashtable or binary tree if it turns // out we have a lot of things here. - typedef std::map<GlobalRequestID,URLRequest*> PendingRequestList; + typedef std::map<GlobalRequestID, URLRequest*> PendingRequestList; // Deletes the pending request identified by the iterator passed in. // This function will invalidate the iterator passed in. Callers should |