Index: chrome/browser/renderer_host/resource_dispatcher_host.h |
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h |
index 18781772eb0de178ae4212e13fadc7cc99f0d3a0..23779f605599bd82cb21c42a1b832d8a261ab93e 100644 |
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h |
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h |
@@ -23,6 +23,7 @@ |
#include "base/scoped_ptr.h" |
#include "base/timer.h" |
#include "chrome/common/child_process_info.h" |
+#include "chrome/browser/renderer_host/global_request_id.h" |
#include "chrome/browser/renderer_host/resource_queue.h" |
#include "ipc/ipc_message.h" |
#include "net/url_request/url_request.h" |
@@ -42,8 +43,8 @@ class SSLClientAuthHandler; |
class UserScriptListener; |
class URLRequestContext; |
class WebKitThread; |
+struct DownloadCreateInfo; |
struct DownloadSaveInfo; |
-struct GlobalRequestID; |
struct ViewHostMsg_Resource_Request; |
struct ViewMsg_ClosePage_Params; |
@@ -111,7 +112,8 @@ class ResourceDispatcherHost : public URLRequest::Delegate { |
bool prompt_for_save_location, |
int process_unique_id, |
int route_id, |
- URLRequestContext* request_context); |
+ URLRequestContext* request_context, |
+ uint64 start_offset); |
// Initiates a save file from the browser process (as opposed to a resource |
// request from the renderer or another child process). |
@@ -150,11 +152,20 @@ class ResourceDispatcherHost : public URLRequest::Delegate { |
// Pauses or resumes network activity for a particular request. |
void PauseRequest(int process_unique_id, int request_id, bool pause); |
+ // Restarts network activity for a particular request. |
+ void RestartRequest(int process_unique_id, |
+ int request_id, |
+ DownloadCreateInfo* info); |
+ |
// Returns the number of pending requests. This is designed for the unittests |
- int pending_requests() const { |
+ int pending_request_count() const { |
return static_cast<int>(pending_requests_.size()); |
} |
+ int interrupted_request_count() const { |
+ return static_cast<int>(interrupted_requests_.size()); |
+ } |
+ |
// Intended for unit-tests only. Returns the memory cost of all the |
// outstanding requests (pending and blocked) for |process_unique_id|. |
int GetOutstandingRequestsMemoryCost(int process_unique_id) const; |
@@ -246,6 +257,9 @@ class ResourceDispatcherHost : public URLRequest::Delegate { |
void NotifyResponseCompleted(URLRequest* request, int process_unique_id); |
void RemovePendingRequest(int process_unique_id, int request_id); |
+ void RemoveInterruptedRequest(int process_unique_id, int request_id); |
+ void MovePendingRequestToInterrupted(int process_unique_id, int request_id); |
+ void MoveInterruptedRequestToPending(int process_unique_id, int request_id); |
// Causes all new requests for the route identified by |
// |process_unique_id| and |route_id| to be blocked (not being |
@@ -302,6 +316,11 @@ class ResourceDispatcherHost : public URLRequest::Delegate { |
// Resumes the given request by calling OnResponseStarted or OnReadCompleted. |
void ResumeRequest(const GlobalRequestID& request_id); |
+ // Restarts the given request's download operation. |
+ static void RestartDownload(ResourceDispatcherHost* rdh, |
+ const GlobalRequestID& request_id, |
+ DownloadCreateInfo* info); |
+ |
// Internal function to start reading for the first time. |
void StartReading(URLRequest* request); |
@@ -351,10 +370,16 @@ class ResourceDispatcherHost : public URLRequest::Delegate { |
// out we have a lot of things here. |
typedef std::map<GlobalRequestID, URLRequest*> PendingRequestList; |
+ // Accumulates matching requests from the given list. |
+ std::vector<GlobalRequestID> GetMatchingRequests( |
+ int process_unique_id, |
+ int route_id, |
+ const PendingRequestList& requests); |
+ |
// Deletes the pending request identified by the iterator passed in. |
// This function will invalidate the iterator passed in. Callers should |
// not rely on this iterator being valid on return. |
- void RemovePendingRequest(const PendingRequestList::iterator& iter); |
+ void RemoveRequestFromMap(const PendingRequestList::iterator& iter); |
// Notify our observers that we started receiving a response for a request. |
void NotifyResponseStarted(URLRequest* request, int process_unique_id); |
@@ -404,18 +429,25 @@ class ResourceDispatcherHost : public URLRequest::Delegate { |
const GURL& new_first_party_for_cookies); |
ResourceHandler* CreateSafeBrowsingResourceHandler( |
- ResourceHandler* handler, int child_id, int route_id, |
+ ResourceHandler* handler, int process_unique_id, int route_id, |
ResourceType::Type resource_type); |
// Creates ResourceDispatcherHostRequestInfo for a browser-initiated request |
// (a download or a page save). |download| should be true if the request |
// is a file download. |
ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( |
- ResourceHandler* handler, int child_id, int route_id, bool download); |
+ ResourceHandler* handler, |
+ int process_unique_id, |
+ int route_id, |
+ bool download); |
- // Returns true if |request| is in |pending_requests_|. |
+ // Returns true if |request| is in |pending_requests_| or |
+ // |interrupted_requests_|. |
bool IsValidRequest(URLRequest* request); |
+ // Returns true if |request| is in |interrupted_requests_|. |
+ bool IsInterruptedRequest(URLRequest* request); |
+ |
// Returns true if the message passed in is a resource related message. |
static bool IsResourceDispatcherHostMessage(const IPC::Message&); |
@@ -432,6 +464,9 @@ class ResourceDispatcherHost : public URLRequest::Delegate { |
PendingRequestList pending_requests_; |
+ // This list contains all the interrupted requests. |
+ PendingRequestList interrupted_requests_; |
+ |
// A timer that periodically calls UpdateLoadStates while pending_requests_ |
// is not empty. |
base::RepeatingTimer<ResourceDispatcherHost> update_load_states_timer_; |