Index: content/browser/download/download_file_manager.cc |
diff --git a/content/browser/download/download_file_manager.cc b/content/browser/download/download_file_manager.cc |
index 1ca7830e1015e3ce3936397333f2fa90f34597eb..b111c8af35e5f91502bd87e9fa37b6c91a6ba43e 100644 |
--- a/content/browser/download/download_file_manager.cc |
+++ b/content/browser/download/download_file_manager.cc |
@@ -13,7 +13,6 @@ |
#include "base/stl_util.h" |
#include "base/utf_string_conversions.h" |
#include "content/browser/download/base_file.h" |
-#include "content/browser/download/download_buffer.h" |
#include "content/browser/download/download_create_info.h" |
#include "content/browser/download/download_file_impl.h" |
#include "content/browser/download/download_interrupt_reasons_impl.h" |
@@ -118,9 +117,6 @@ void DownloadFileManager::CreateDownloadFile( |
} else { |
DCHECK(GetDownloadFile(info->download_id) == NULL); |
downloads_[info->download_id] = download_file.release(); |
- |
- // The file is now ready, we can un-pause the request and start saving data. |
- request_handle.ResumeRequest(); |
} |
BrowserThread::PostTask( |
@@ -174,105 +170,6 @@ void DownloadFileManager::StartDownload( |
hash_needed, bound_net_log)); |
} |
-// We don't forward an update to the UI thread here, since we want to throttle |
-// the UI update rate via a periodic timer. If the user has cancelled the |
-// download (in the UI thread), we may receive a few more updates before the IO |
-// thread gets the cancel message: we just delete the data since the |
-// DownloadFile has been deleted. |
-void DownloadFileManager::UpdateDownload( |
- DownloadId global_id, content::DownloadBuffer* buffer) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
- scoped_ptr<content::ContentVector> contents(buffer->ReleaseContents()); |
- |
- download_stats::RecordFileThreadReceiveBuffers(contents->size()); |
- |
- DownloadFile* download_file = GetDownloadFile(global_id); |
- bool had_error = false; |
- for (size_t i = 0; i < contents->size(); ++i) { |
- net::IOBuffer* data = (*contents)[i].first; |
- const int data_len = (*contents)[i].second; |
- if (!had_error && download_file) { |
- net::Error write_result = |
- download_file->AppendDataToFile(data->data(), data_len); |
- if (write_result != net::OK) { |
- // Write failed: interrupt the download. |
- DownloadManager* download_manager = |
- download_file->GetDownloadManager(); |
- had_error = true; |
- |
- int64 bytes_downloaded = download_file->BytesSoFar(); |
- std::string hash_state(download_file->GetHashState()); |
- |
- // Calling this here in case we get more data, to avoid |
- // processing data after an error. That could lead to |
- // files that are corrupted if the later processing succeeded. |
- CancelDownload(global_id); |
- download_file = NULL; // Was deleted in |CancelDownload|. |
- |
- if (download_manager) { |
- BrowserThread::PostTask( |
- BrowserThread::UI, FROM_HERE, |
- base::Bind(&DownloadManager::OnDownloadInterrupted, |
- download_manager, |
- global_id.local(), |
- bytes_downloaded, |
- hash_state, |
- content::ConvertNetErrorToInterruptReason( |
- write_result, |
- content::DOWNLOAD_INTERRUPT_FROM_DISK))); |
- } |
- } |
- } |
- data->Release(); |
- } |
-} |
- |
-void DownloadFileManager::OnResponseCompleted( |
- DownloadId global_id, |
- content::DownloadInterruptReason reason, |
- const std::string& security_info) { |
- VLOG(20) << __FUNCTION__ << "()" << " id = " << global_id |
- << " reason = " << InterruptReasonDebugString(reason) |
- << " security_info = \"" << security_info << "\""; |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
- DownloadFile* download_file = GetDownloadFile(global_id); |
- if (!download_file) |
- return; |
- |
- download_file->Finish(); |
- |
- DownloadManager* download_manager = download_file->GetDownloadManager(); |
- if (!download_manager) { |
- CancelDownload(global_id); |
- return; |
- } |
- |
- if (reason == content::DOWNLOAD_INTERRUPT_REASON_NONE) { |
- std::string hash; |
- if (!download_file->GetHash(&hash) || |
- BaseFile::IsEmptyHash(hash)) { |
- hash.clear(); |
- } |
- |
- BrowserThread::PostTask( |
- BrowserThread::UI, FROM_HERE, |
- base::Bind(&DownloadManager::OnResponseCompleted, |
- download_manager, global_id.local(), |
- download_file->BytesSoFar(), hash)); |
- } else { |
- BrowserThread::PostTask( |
- BrowserThread::UI, FROM_HERE, |
- base::Bind(&DownloadManager::OnDownloadInterrupted, |
- download_manager, |
- global_id.local(), |
- download_file->BytesSoFar(), |
- download_file->GetHashState(), |
- reason)); |
- } |
- // We need to keep the download around until the UI thread has finalized |
- // the name. |
-} |
- |
// This method will be sent via a user action, or shutdown on the UI thread, and |
// run on the download thread. Since this message has been sent from the UI |
// thread, the download may have already completed and won't exist in our map. |