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

Side by Side Diff: content/browser/download/download_request_core.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 (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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // retry. 349 // retry.
350 abort_reason_ = DOWNLOAD_INTERRUPT_REASON_SERVER_UNREACHABLE; 350 abort_reason_ = DOWNLOAD_INTERRUPT_REASON_SERVER_UNREACHABLE;
351 return false; 351 return false;
352 } 352 }
353 return true; 353 return true;
354 } 354 }
355 355
356 // Create a new buffer, which will be handed to the download thread for file 356 // Create a new buffer, which will be handed to the download thread for file
357 // writing and deletion. 357 // writing and deletion.
358 bool DownloadRequestCore::OnWillRead(scoped_refptr<net::IOBuffer>* buf, 358 bool DownloadRequestCore::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
359 int* buf_size, 359 int* buf_size) {
360 int min_size) {
361 DCHECK_CURRENTLY_ON(BrowserThread::IO); 360 DCHECK_CURRENTLY_ON(BrowserThread::IO);
362 DCHECK(buf && buf_size); 361 DCHECK(buf && buf_size);
363 DCHECK(!read_buffer_.get()); 362 DCHECK(!read_buffer_.get());
364 363
365 *buf_size = min_size < 0 ? kReadBufSize : min_size; 364 *buf_size = kReadBufSize;
366 read_buffer_ = new net::IOBuffer(*buf_size); 365 read_buffer_ = new net::IOBuffer(*buf_size);
367 *buf = read_buffer_.get(); 366 *buf = read_buffer_.get();
368 return true; 367 return true;
369 } 368 }
370 369
371 // Pass the buffer to the download file writer. 370 // Pass the buffer to the download file writer.
372 bool DownloadRequestCore::OnReadCompleted(int bytes_read, bool* defer) { 371 bool DownloadRequestCore::OnReadCompleted(int bytes_read, bool* defer) {
373 DCHECK_CURRENTLY_ON(BrowserThread::IO); 372 DCHECK_CURRENTLY_ON(BrowserThread::IO);
374 DCHECK(read_buffer_.get()); 373 DCHECK(read_buffer_.get());
375 374
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 return DOWNLOAD_INTERRUPT_REASON_NONE; 616 return DOWNLOAD_INTERRUPT_REASON_NONE;
618 } 617 }
619 618
620 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) 619 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT)
621 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; 620 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT;
622 621
623 return DOWNLOAD_INTERRUPT_REASON_NONE; 622 return DOWNLOAD_INTERRUPT_REASON_NONE;
624 } 623 }
625 624
626 } // namespace content 625 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_request_core.h ('k') | content/browser/download/download_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698