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

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

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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) 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 owns_file_ = false; 123 owns_file_ = false;
124 } 124 }
125 125
126 void URLFetcherFileWriter::CloseAndDeleteFile() { 126 void URLFetcherFileWriter::CloseAndDeleteFile() {
127 if (!owns_file_) 127 if (!owns_file_)
128 return; 128 return;
129 129
130 file_stream_.reset(); 130 file_stream_.reset();
131 DisownFile(); 131 DisownFile();
132 file_task_runner_->PostTask(FROM_HERE, 132 file_task_runner_->PostTask(FROM_HERE,
133 base::Bind(base::IgnoreResult(&file_util::Delete), 133 base::Bind(base::IgnoreResult(&base::Delete),
134 file_path_, 134 file_path_,
135 false /* recursive */)); 135 false /* recursive */));
136 } 136 }
137 137
138 void URLFetcherFileWriter::DidCreateTempFile(const CompletionCallback& callback, 138 void URLFetcherFileWriter::DidCreateTempFile(const CompletionCallback& callback,
139 base::FilePath* temp_file_path, 139 base::FilePath* temp_file_path,
140 bool success) { 140 bool success) {
141 if (!success) { 141 if (!success) {
142 error_code_ = ERR_FILE_NOT_FOUND; 142 error_code_ = ERR_FILE_NOT_FOUND;
143 callback.Run(error_code_); 143 callback.Run(error_code_);
(...skipping 18 matching lines...) Expand all
162 total_bytes_written_ = 0; 162 total_bytes_written_ = 0;
163 owns_file_ = true; 163 owns_file_ = true;
164 } else { 164 } else {
165 error_code_ = result; 165 error_code_ = result;
166 CloseAndDeleteFile(); 166 CloseAndDeleteFile();
167 } 167 }
168 callback.Run(result); 168 callback.Run(result);
169 } 169 }
170 170
171 } // namespace net 171 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/unix_domain_socket_posix_unittest.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698