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

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

Issue 99923002: Move temp file functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/spdy/spdy_network_transaction_unittest.cc ('k') | net/url_request/url_request_unittest.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/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 int URLFetcherFileWriter::Initialize(const CompletionCallback& callback) { 66 int URLFetcherFileWriter::Initialize(const CompletionCallback& callback) {
67 file_stream_.reset(new FileStream(NULL)); 67 file_stream_.reset(new FileStream(NULL));
68 68
69 int result = ERR_IO_PENDING; 69 int result = ERR_IO_PENDING;
70 if (file_path_.empty()) { 70 if (file_path_.empty()) {
71 base::FilePath* temp_file_path = new base::FilePath; 71 base::FilePath* temp_file_path = new base::FilePath;
72 base::PostTaskAndReplyWithResult( 72 base::PostTaskAndReplyWithResult(
73 file_task_runner_.get(), 73 file_task_runner_.get(),
74 FROM_HERE, 74 FROM_HERE,
75 base::Bind(&file_util::CreateTemporaryFile, temp_file_path), 75 base::Bind(&base::CreateTemporaryFile, temp_file_path),
76 base::Bind(&URLFetcherFileWriter::DidCreateTempFile, 76 base::Bind(&URLFetcherFileWriter::DidCreateTempFile,
77 weak_factory_.GetWeakPtr(), 77 weak_factory_.GetWeakPtr(),
78 callback, 78 callback,
79 base::Owned(temp_file_path))); 79 base::Owned(temp_file_path)));
80 } else { 80 } else {
81 result = file_stream_->Open( 81 result = file_stream_->Open(
82 file_path_, 82 file_path_,
83 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_ASYNC | 83 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_ASYNC |
84 base::PLATFORM_FILE_CREATE_ALWAYS, 84 base::PLATFORM_FILE_CREATE_ALWAYS,
85 base::Bind(&URLFetcherFileWriter::DidOpenFile, 85 base::Bind(&URLFetcherFileWriter::DidOpenFile,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 void URLFetcherFileWriter::CloseComplete(const CompletionCallback& callback, 180 void URLFetcherFileWriter::CloseComplete(const CompletionCallback& callback,
181 int result) { 181 int result) {
182 // Destroy |file_stream_| whether or not the close succeeded. 182 // Destroy |file_stream_| whether or not the close succeeded.
183 file_stream_.reset(); 183 file_stream_.reset();
184 callback.Run(result); 184 callback.Run(result);
185 } 185 }
186 186
187 } // namespace net 187 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_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