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

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

Issue 2660723002: ResourceHandler::OnWillStart: Remove min_size argument. (Closed)
Patch Set: Merge Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/url_downloader.h" 5 #include "content/browser/download/url_downloader.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/threading/sequenced_task_runner_handle.h" 10 #include "base/threading/sequenced_task_runner_handle.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 void UrlDownloader::StartReading(bool is_continuation) { 138 void UrlDownloader::StartReading(bool is_continuation) {
139 int bytes_read; 139 int bytes_read;
140 140
141 // Make sure we track the buffer in at least one place. This ensures it gets 141 // Make sure we track the buffer in at least one place. This ensures it gets
142 // deleted even in the case the request has already finished its job and 142 // deleted even in the case the request has already finished its job and
143 // doesn't use the buffer. 143 // doesn't use the buffer.
144 scoped_refptr<net::IOBuffer> buf; 144 scoped_refptr<net::IOBuffer> buf;
145 int buf_size; 145 int buf_size;
146 if (!core_.OnWillRead(&buf, &buf_size, -1)) { 146 if (!core_.OnWillRead(&buf, &buf_size)) {
147 int result = request_->CancelWithError(net::ERR_ABORTED); 147 int result = request_->CancelWithError(net::ERR_ABORTED);
148 base::SequencedTaskRunnerHandle::Get()->PostTask( 148 base::SequencedTaskRunnerHandle::Get()->PostTask(
149 FROM_HERE, base::Bind(&UrlDownloader::ResponseCompleted, 149 FROM_HERE, base::Bind(&UrlDownloader::ResponseCompleted,
150 weak_ptr_factory_.GetWeakPtr(), result)); 150 weak_ptr_factory_.GetWeakPtr(), result));
151 return; 151 return;
152 } 152 }
153 153
154 DCHECK(buf.get()); 154 DCHECK(buf.get());
155 DCHECK(buf_size > 0); 155 DCHECK(buf_size > 0);
156 156
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 Destroy(); 238 Destroy();
239 } 239 }
240 240
241 void UrlDownloader::Destroy() { 241 void UrlDownloader::Destroy() {
242 BrowserThread::PostTask( 242 BrowserThread::PostTask(
243 BrowserThread::UI, FROM_HERE, 243 BrowserThread::UI, FROM_HERE,
244 base::Bind(&DownloadManagerImpl::RemoveUrlDownloader, manager_, this)); 244 base::Bind(&DownloadManagerImpl::RemoveUrlDownloader, manager_, this));
245 } 245 }
246 246
247 } // namespace content 247 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/save_file_resource_handler.cc ('k') | content/browser/loader/async_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698