| Index: chrome/browser/renderer_host/download_resource_handler.cc
|
| diff --git a/chrome/browser/renderer_host/download_resource_handler.cc b/chrome/browser/renderer_host/download_resource_handler.cc
|
| index f35d5e4166ce7a127ce62a813137ecc2081b24e6..823081b5fa41bd5fa4557ac8b2880d4c66645be1 100644
|
| --- a/chrome/browser/renderer_host/download_resource_handler.cc
|
| +++ b/chrome/browser/renderer_host/download_resource_handler.cc
|
| @@ -30,14 +30,15 @@ DownloadResourceHandler::DownloadResourceHandler(
|
| int render_view_id,
|
| int request_id,
|
| const GURL& url,
|
| + const DownloadManager::GetNextIdThunkType& get_next_id,
|
| DownloadFileManager* download_file_manager,
|
| net::URLRequest* request,
|
| bool save_as,
|
| const DownloadSaveInfo& save_info)
|
| - : download_id_(-1),
|
| - global_id_(render_process_host_id, request_id),
|
| + : global_id_(render_process_host_id, request_id),
|
| render_view_id_(render_view_id),
|
| content_length_(0),
|
| + get_next_id_(get_next_id),
|
| download_file_manager_(download_file_manager),
|
| request_(request),
|
| save_as_(save_as),
|
| @@ -45,6 +46,7 @@ DownloadResourceHandler::DownloadResourceHandler(
|
| buffer_(new DownloadBuffer),
|
| rdh_(rdh),
|
| is_paused_(false) {
|
| + DCHECK(!get_next_id.is_null());
|
| download_util::RecordDownloadCount(download_util::UNTHROTTLED_COUNT);
|
| }
|
|
|
| @@ -65,6 +67,7 @@ bool DownloadResourceHandler::OnRequestRedirected(int request_id,
|
| // Send the download creation information to the download thread.
|
| bool DownloadResourceHandler::OnResponseStarted(int request_id,
|
| ResourceResponse* response) {
|
| + DCHECK(!get_next_id_.is_null());
|
| VLOG(20) << __FUNCTION__ << "()" << DebugString()
|
| << " request_id = " << request_id;
|
| download_start_time_ = base::TimeTicks::Now();
|
| @@ -77,7 +80,7 @@ bool DownloadResourceHandler::OnResponseStarted(int request_id,
|
| const ResourceDispatcherHostRequestInfo* request_info =
|
| ResourceDispatcherHost::InfoForRequest(request_);
|
|
|
| - download_id_ = download_file_manager_->GetNextId();
|
| + download_id_ = get_next_id_.Run();
|
|
|
| // Deleted in DownloadManager.
|
| DownloadCreateInfo* info = new DownloadCreateInfo;
|
| @@ -87,7 +90,7 @@ bool DownloadResourceHandler::OnResponseStarted(int request_id,
|
| info->received_bytes = 0;
|
| info->total_bytes = content_length_;
|
| info->state = DownloadItem::IN_PROGRESS;
|
| - info->download_id = download_id_;
|
| + info->download_id = download_id_.id();
|
| info->has_user_gesture = request_info->has_user_gesture();
|
| info->request_handle = DownloadRequestHandle(rdh_,
|
| global_id_.child_id,
|
| @@ -256,7 +259,7 @@ std::string DownloadResourceHandler::DebugString() const {
|
| " save_info_.file_path = \"%" PRFilePath "\""
|
| " }",
|
| request_->url().spec().c_str(),
|
| - download_id_,
|
| + download_id_.id(),
|
| global_id_.child_id,
|
| global_id_.request_id,
|
| render_view_id_,
|
|
|