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

Side by Side Diff: content/browser/renderer_host/redirect_to_file_resource_handler.cc

Issue 9148018: [Coverity] Fixed call by value to by reference (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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/renderer_host/redirect_to_file_resource_handler.h" 5 #include "content/browser/renderer_host/redirect_to_file_resource_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/file_util_proxy.h" 9 #include "base/file_util_proxy.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 next_handler_->OnRequestClosed(); 146 next_handler_->OnRequestClosed();
147 } 147 }
148 148
149 RedirectToFileResourceHandler::~RedirectToFileResourceHandler() { 149 RedirectToFileResourceHandler::~RedirectToFileResourceHandler() {
150 DCHECK(!file_stream_.get()); 150 DCHECK(!file_stream_.get());
151 } 151 }
152 152
153 void RedirectToFileResourceHandler::DidCreateTemporaryFile( 153 void RedirectToFileResourceHandler::DidCreateTemporaryFile(
154 base::PlatformFileError /*error_code*/, 154 base::PlatformFileError /*error_code*/,
155 base::PassPlatformFile file_handle, 155 base::PassPlatformFile file_handle,
156 FilePath file_path) { 156 const FilePath& file_path) {
157 if (request_was_closed_) { 157 if (request_was_closed_) {
158 // If the request was already closed, then don't bother allocating the 158 // If the request was already closed, then don't bother allocating the
159 // file_stream_ (otherwise we will leak it). 159 // file_stream_ (otherwise we will leak it).
160 return; 160 return;
161 } 161 }
162 deletable_file_ = DeletableFileReference::GetOrCreate( 162 deletable_file_ = DeletableFileReference::GetOrCreate(
163 file_path, 163 file_path,
164 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 164 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
165 file_stream_.reset(new net::FileStream(file_handle.ReleaseValue(), 165 file_stream_.reset(new net::FileStream(file_handle.ReleaseValue(),
166 base::PLATFORM_FILE_WRITE | 166 base::PLATFORM_FILE_WRITE |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 bool RedirectToFileResourceHandler::BufIsFull() const { 227 bool RedirectToFileResourceHandler::BufIsFull() const {
228 // This is a hack to workaround BufferedResourceHandler's inability to 228 // This is a hack to workaround BufferedResourceHandler's inability to
229 // deal with a ResourceHandler that returns a buffer size of less than 229 // deal with a ResourceHandler that returns a buffer size of less than
230 // 2 * net::kMaxBytesToSniff from its OnWillRead method. 230 // 2 * net::kMaxBytesToSniff from its OnWillRead method.
231 // TODO(darin): Fix this retardation! 231 // TODO(darin): Fix this retardation!
232 return buf_->RemainingCapacity() <= (2 * net::kMaxBytesToSniff); 232 return buf_->RemainingCapacity() <= (2 * net::kMaxBytesToSniff);
233 } 233 }
234 234
235 } // namespace content 235 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/redirect_to_file_resource_handler.h ('k') | content/common/net/url_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698