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

Side by Side Diff: net/url_request/url_fetcher_response_writer.cc

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk 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
« no previous file with comments | « net/url_request/url_fetcher_impl_unittest.cc ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "net/url_request/url_fetcher_response_writer.h" 5 #include "net/url_request/url_fetcher_response_writer.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/task_runner.h" 9 #include "base/task_runner.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 int URLFetcherFileWriter::Initialize(const CompletionCallback& callback) { 55 int URLFetcherFileWriter::Initialize(const CompletionCallback& callback) {
56 DCHECK(!file_stream_); 56 DCHECK(!file_stream_);
57 DCHECK(!owns_file_); 57 DCHECK(!owns_file_);
58 58
59 file_stream_.reset(new FileStream(NULL)); 59 file_stream_.reset(new FileStream(NULL));
60 60
61 int result = ERR_IO_PENDING; 61 int result = ERR_IO_PENDING;
62 if (file_path_.empty()) { 62 if (file_path_.empty()) {
63 base::FilePath* temp_file_path = new base::FilePath; 63 base::FilePath* temp_file_path = new base::FilePath;
64 base::PostTaskAndReplyWithResult( 64 base::PostTaskAndReplyWithResult(
65 file_task_runner_, 65 file_task_runner_.get(),
66 FROM_HERE, 66 FROM_HERE,
67 base::Bind(&file_util::CreateTemporaryFile, 67 base::Bind(&file_util::CreateTemporaryFile, temp_file_path),
68 temp_file_path),
69 base::Bind(&URLFetcherFileWriter::DidCreateTempFile, 68 base::Bind(&URLFetcherFileWriter::DidCreateTempFile,
70 weak_factory_.GetWeakPtr(), 69 weak_factory_.GetWeakPtr(),
71 callback, 70 callback,
72 base::Owned(temp_file_path))); 71 base::Owned(temp_file_path)));
73 } else { 72 } else {
74 result = file_stream_->Open( 73 result = file_stream_->Open(
75 file_path_, 74 file_path_,
76 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_ASYNC | 75 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_ASYNC |
77 base::PLATFORM_FILE_CREATE_ALWAYS, 76 base::PLATFORM_FILE_CREATE_ALWAYS,
78 base::Bind(&URLFetcherFileWriter::DidOpenFile, 77 base::Bind(&URLFetcherFileWriter::DidOpenFile,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 total_bytes_written_ = 0; 162 total_bytes_written_ = 0;
164 owns_file_ = true; 163 owns_file_ = true;
165 } else { 164 } else {
166 error_code_ = result; 165 error_code_ = result;
167 CloseAndDeleteFile(); 166 CloseAndDeleteFile();
168 } 167 }
169 callback.Run(result); 168 callback.Run(result);
170 } 169 }
171 170
172 } // namespace net 171 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_fetcher_impl_unittest.cc ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698