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

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

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 | Annotate | Revision Log
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/save_file_resource_handler.h" 5 #include "content/browser/download/save_file_resource_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 bool SaveFileResourceHandler::OnWillStart(int request_id, 70 bool SaveFileResourceHandler::OnWillStart(int request_id,
71 const GURL& url, 71 const GURL& url,
72 bool* defer) { 72 bool* defer) {
73 return true; 73 return true;
74 } 74 }
75 75
76 bool SaveFileResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, 76 bool SaveFileResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
77 int* buf_size, int min_size) { 77 int* buf_size, int min_size) {
78 DCHECK(buf && buf_size); 78 DCHECK(buf && buf_size);
79 if (!read_buffer_) { 79 if (!read_buffer_.get()) {
80 *buf_size = min_size < 0 ? kReadBufSize : min_size; 80 *buf_size = min_size < 0 ? kReadBufSize : min_size;
81 read_buffer_ = new net::IOBuffer(*buf_size); 81 read_buffer_ = new net::IOBuffer(*buf_size);
82 } 82 }
83 *buf = read_buffer_.get(); 83 *buf = read_buffer_.get();
84 return true; 84 return true;
85 } 85 }
86 86
87 bool SaveFileResourceHandler::OnReadCompleted(int request_id, int bytes_read, 87 bool SaveFileResourceHandler::OnReadCompleted(int request_id, int bytes_read,
88 bool* defer) { 88 bool* defer) {
89 DCHECK(read_buffer_); 89 DCHECK(read_buffer_.get());
90 // We are passing ownership of this buffer to the save file manager. 90 // We are passing ownership of this buffer to the save file manager.
91 scoped_refptr<net::IOBuffer> buffer; 91 scoped_refptr<net::IOBuffer> buffer;
92 read_buffer_.swap(buffer); 92 read_buffer_.swap(buffer);
93 BrowserThread::PostTask( 93 BrowserThread::PostTask(
94 BrowserThread::FILE, FROM_HERE, 94 BrowserThread::FILE, FROM_HERE,
95 base::Bind(&SaveFileManager::UpdateSaveProgress, 95 base::Bind(&SaveFileManager::UpdateSaveProgress,
96 save_manager_, save_id_, buffer, bytes_read)); 96 save_manager_, save_id_, buffer, bytes_read));
97 return true; 97 return true;
98 } 98 }
99 99
(...skipping 14 matching lines...) Expand all
114 int bytes_downloaded) { 114 int bytes_downloaded) {
115 NOTREACHED(); 115 NOTREACHED();
116 } 116 }
117 117
118 void SaveFileResourceHandler::set_content_length( 118 void SaveFileResourceHandler::set_content_length(
119 const std::string& content_length) { 119 const std::string& content_length) {
120 base::StringToInt64(content_length, &content_length_); 120 base::StringToInt64(content_length, &content_length_);
121 } 121 }
122 122
123 } // namespace content 123 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/drag_download_util.cc ('k') | content/browser/fileapi/chrome_blob_storage_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698