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

Side by Side Diff: content/browser/download/download_request_core.cc

Issue 2742093002: Glue parallel download job and download file together. (Closed)
Patch Set: Rebase, and adjust unittests with recent landed CLs. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/download/download_request_core.h" 5 #include "content/browser/download/download_request_core.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 started_ = true; 271 started_ = true;
272 std::unique_ptr<DownloadCreateInfo> create_info(new DownloadCreateInfo( 272 std::unique_ptr<DownloadCreateInfo> create_info(new DownloadCreateInfo(
273 base::Time::Now(), request()->net_log(), std::move(save_info_))); 273 base::Time::Now(), request()->net_log(), std::move(save_info_)));
274 274
275 if (result == DOWNLOAD_INTERRUPT_REASON_NONE) 275 if (result == DOWNLOAD_INTERRUPT_REASON_NONE)
276 create_info->remote_address = request()->GetSocketAddress().host(); 276 create_info->remote_address = request()->GetSocketAddress().host();
277 create_info->url_chain = request()->url_chain(); 277 create_info->url_chain = request()->url_chain();
278 create_info->referrer_url = GURL(request()->referrer()); 278 create_info->referrer_url = GURL(request()->referrer());
279 create_info->result = result; 279 create_info->result = result;
280 create_info->download_id = download_id_; 280 create_info->download_id = download_id_;
281 create_info->offset = create_info->save_info->offset;
281 return create_info; 282 return create_info;
282 } 283 }
283 284
284 bool DownloadRequestCore::OnResponseStarted( 285 bool DownloadRequestCore::OnResponseStarted(
285 const std::string& override_mime_type) { 286 const std::string& override_mime_type) {
286 DCHECK_CURRENTLY_ON(BrowserThread::IO); 287 DCHECK_CURRENTLY_ON(BrowserThread::IO);
287 DVLOG(20) << __func__ << "() " << DebugString(); 288 DVLOG(20) << __func__ << "() " << DebugString();
288 download_start_time_ = base::TimeTicks::Now(); 289 download_start_time_ = base::TimeTicks::Now();
289 290
290 DownloadInterruptReason result = 291 DownloadInterruptReason result =
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 return DOWNLOAD_INTERRUPT_REASON_NONE; 661 return DOWNLOAD_INTERRUPT_REASON_NONE;
661 } 662 }
662 663
663 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) 664 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT)
664 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; 665 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT;
665 666
666 return DOWNLOAD_INTERRUPT_REASON_NONE; 667 return DOWNLOAD_INTERRUPT_REASON_NONE;
667 } 668 }
668 669
669 } // namespace content 670 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_job_factory.cc ('k') | content/browser/download/download_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698