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

Unified Diff: chrome/browser/download/download_file_manager.cc

Issue 7112011: Change DownloadProcessHandle to be more of an encapsulated class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR. Created 9 years, 6 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/download/download_file_manager.h ('k') | chrome/browser/download/download_file_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_file_manager.cc
diff --git a/chrome/browser/download/download_file_manager.cc b/chrome/browser/download/download_file_manager.cc
index 1604905f1b88d22ae082fb67134409008f3f8654..16a0ac7654cae56b255f287419e9a943f59f48ef 100644
--- a/chrome/browser/download/download_file_manager.cc
+++ b/chrome/browser/download/download_file_manager.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_create_info.h"
#include "chrome/browser/download/download_manager.h"
-#include "chrome/browser/download/download_process_handle.h"
+#include "chrome/browser/download/download_request_handle.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/platform_util.h"
@@ -69,8 +69,7 @@ void DownloadFileManager::CreateDownloadFile(DownloadCreateInfo* info,
scoped_ptr<DownloadFile>
download_file(new DownloadFile(info, download_manager));
if (!download_file->Initialize(get_hash)) {
- download_util::CancelDownloadRequest(resource_dispatcher_host_,
- info->process_handle);
+ info->request_handle.CancelRequest();
return;
}
@@ -79,10 +78,7 @@ void DownloadFileManager::CreateDownloadFile(DownloadCreateInfo* info,
downloads_[id] = download_file.release();
// The file is now ready, we can un-pause the request and start saving data.
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this, &DownloadFileManager::ResumeDownloadRequest,
- info->process_handle));
+ info->request_handle.ResumeRequest();
StartUpdateTimer();
@@ -92,16 +88,6 @@ void DownloadFileManager::CreateDownloadFile(DownloadCreateInfo* info,
&DownloadManager::StartDownload, id));
}
-void DownloadFileManager::ResumeDownloadRequest(
- DownloadProcessHandle process) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- // This balances the pause in DownloadResourceHandler::OnResponseStarted.
- resource_dispatcher_host_->PauseRequest(process.child_id(),
- process.request_id(),
- false);
-}
-
DownloadFile* DownloadFileManager::GetDownloadFile(int id) {
DownloadFileMap::iterator it = downloads_.find(id);
return it == downloads_.end() ? NULL : it->second;
@@ -146,10 +132,9 @@ void DownloadFileManager::StartDownload(DownloadCreateInfo* info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(info);
- DownloadManager* manager = info->process_handle.GetDownloadManager();
+ DownloadManager* manager = info->request_handle.GetDownloadManager();
if (!manager) {
- download_util::CancelDownloadRequest(resource_dispatcher_host_,
- info->process_handle);
+ info->request_handle.CancelRequest();
delete info;
return;
}
@@ -270,7 +255,7 @@ void DownloadFileManager::OnDownloadManagerShutdown(DownloadManager* manager) {
i != downloads_.end(); ++i) {
DownloadFile* download_file = i->second;
if (download_file->GetDownloadManager() == manager) {
- download_file->CancelDownloadRequest(resource_dispatcher_host_);
+ download_file->CancelDownloadRequest();
to_remove.insert(download_file);
}
}
@@ -385,7 +370,7 @@ void DownloadFileManager::CancelDownloadOnRename(int id) {
// Without a download manager, we can't cancel the request normally, so we
// need to do it here. The normal path will also update the download
// history before cancelling the request.
- download_file->CancelDownloadRequest(resource_dispatcher_host_);
+ download_file->CancelDownloadRequest();
return;
}
« no previous file with comments | « chrome/browser/download/download_file_manager.h ('k') | chrome/browser/download/download_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698