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

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

Issue 2854973003: Fix the Unthrottled download count for parallel download (Closed)
Patch Set: Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_worker.h" 5 #include "content/browser/download/download_worker.h"
6 6
7 #include "content/browser/download/download_create_info.h" 7 #include "content/browser/download/download_create_info.h"
8 #include "content/public/browser/download_interrupt_reasons.h" 8 #include "content/public/browser/download_interrupt_reasons.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 10
11 namespace content { 11 namespace content {
12 namespace { 12 namespace {
13 13
14 const int kVerboseLevel = 1; 14 const int kVerboseLevel = 1;
15 15
16 std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> 16 std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>
17 CreateUrlDownloader(std::unique_ptr<DownloadUrlParameters> params, 17 CreateUrlDownloader(std::unique_ptr<DownloadUrlParameters> params,
18 base::WeakPtr<UrlDownloader::Delegate> delegate) { 18 base::WeakPtr<UrlDownloader::Delegate> delegate) {
19 DCHECK_CURRENTLY_ON(BrowserThread::IO); 19 DCHECK_CURRENTLY_ON(BrowserThread::IO);
20 20
21 // Build the URLRequest, BlobDataHandle is hold in original request for image 21 // Build the URLRequest, BlobDataHandle is hold in original request for image
22 // download. 22 // download.
23 std::unique_ptr<net::URLRequest> url_request = 23 std::unique_ptr<net::URLRequest> url_request =
24 DownloadRequestCore::CreateRequestOnIOThread(DownloadItem::kInvalidId, 24 DownloadRequestCore::CreateRequestOnIOThread(DownloadItem::kInvalidId,
25 params.get()); 25 params.get());
26 26
27 return std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>( 27 return std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>(
28 UrlDownloader::BeginDownload(delegate, std::move(url_request), 28 UrlDownloader::BeginDownload(delegate, std::move(url_request),
29 params->referrer()) 29 params->referrer(), true)
30 .release()); 30 .release());
31 } 31 }
32 32
33 } // namespace 33 } // namespace
34 34
35 DownloadWorker::DownloadWorker(DownloadWorker::Delegate* delegate, 35 DownloadWorker::DownloadWorker(DownloadWorker::Delegate* delegate,
36 int64_t offset, 36 int64_t offset,
37 int64_t length) 37 int64_t length)
38 : delegate_(delegate), 38 : delegate_(delegate),
39 offset_(offset), 39 offset_(offset),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 url_downloader_.reset(); 115 url_downloader_.reset();
116 } 116 }
117 117
118 void DownloadWorker::AddUrlDownloader( 118 void DownloadWorker::AddUrlDownloader(
119 std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> 119 std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>
120 downloader) { 120 downloader) {
121 url_downloader_ = std::move(downloader); 121 url_downloader_ = std::move(downloader);
122 } 122 }
123 123
124 } // namespace content 124 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_resource_handler.cc ('k') | content/browser/download/url_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698