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

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: Removed unneeded include file. 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
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 0c200e5b004abb6e9733ff385d53c6a7f1223909..efd5650c52ae27065f7c41caee3b189ea53d50a5 100644
--- a/chrome/browser/download/download_file_manager.cc
+++ b/chrome/browser/download/download_file_manager.cc
@@ -12,7 +12,7 @@
#include "build/build_config.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"
@@ -68,8 +68,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;
}
@@ -78,10 +77,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();
@@ -91,16 +87,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;
@@ -145,10 +131,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;
}
@@ -269,7 +254,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);
}
}
@@ -384,7 +369,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;
}

Powered by Google App Engine
This is Rietveld 408576698