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

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

Issue 2860593003: Refactoring DownloadManager::DownloadURL to add proper annotation. (Closed)
Patch Set: Comment addressed. Created 3 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 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 #include "net/traffic_annotation/network_traffic_annotation.h"
10 11
11 namespace content { 12 namespace content {
12 namespace { 13 namespace {
13 14
14 const int kVerboseLevel = 1; 15 const int kVerboseLevel = 1;
15 16
16 class CompletedByteStreamReader : public ByteStreamReader { 17 class CompletedByteStreamReader : public ByteStreamReader {
17 public: 18 public:
18 CompletedByteStreamReader(int status) : status_(status) {}; 19 CompletedByteStreamReader(int status) : status_(status) {};
19 ~CompletedByteStreamReader() override = default; 20 ~CompletedByteStreamReader() override = default;
(...skipping 11 matching lines...) Expand all
31 }; 32 };
32 33
33 std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> 34 std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>
34 CreateUrlDownloader(std::unique_ptr<DownloadUrlParameters> params, 35 CreateUrlDownloader(std::unique_ptr<DownloadUrlParameters> params,
35 base::WeakPtr<UrlDownloader::Delegate> delegate) { 36 base::WeakPtr<UrlDownloader::Delegate> delegate) {
36 DCHECK_CURRENTLY_ON(BrowserThread::IO); 37 DCHECK_CURRENTLY_ON(BrowserThread::IO);
37 38
38 // Build the URLRequest, BlobDataHandle is hold in original request for image 39 // Build the URLRequest, BlobDataHandle is hold in original request for image
39 // download. 40 // download.
40 std::unique_ptr<net::URLRequest> url_request = 41 std::unique_ptr<net::URLRequest> url_request =
41 DownloadRequestCore::CreateRequestOnIOThread(DownloadItem::kInvalidId, 42 DownloadRequestCore::CreateRequestOnIOThread(
42 params.get()); 43 DownloadItem::kInvalidId, params.get(), NO_TRAFFIC_ANNOTATION_YET);
43 44
44 return std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>( 45 return std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>(
45 UrlDownloader::BeginDownload(delegate, std::move(url_request), 46 UrlDownloader::BeginDownload(delegate, std::move(url_request),
46 params->referrer(), true) 47 params->referrer(), true)
47 .release()); 48 .release());
48 } 49 }
49 50
50 } // namespace 51 } // namespace
51 52
52 DownloadWorker::DownloadWorker(DownloadWorker::Delegate* delegate, 53 DownloadWorker::DownloadWorker(DownloadWorker::Delegate* delegate,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 url_downloader_.reset(); 131 url_downloader_.reset();
131 } 132 }
132 133
133 void DownloadWorker::AddUrlDownloader( 134 void DownloadWorker::AddUrlDownloader(
134 std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> 135 std::unique_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread>
135 downloader) { 136 downloader) {
136 url_downloader_ = std::move(downloader); 137 url_downloader_ = std::move(downloader);
137 } 138 }
138 139
139 } // namespace content 140 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_request_core_unittest.cc ('k') | content/browser/download/drag_download_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698