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

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

Issue 18764: Change FileStream to use FilePath instead of wstring. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « net/base/upload_data_stream.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // For loading files, we make use of overlapped i/o to ensure that reading from 5 // For loading files, we make use of overlapped i/o to ensure that reading from
6 // the filesystem (e.g., a network filesystem) does not block the calling 6 // the filesystem (e.g., a network filesystem) does not block the calling
7 // thread. An alternative approach would be to use a background thread or pool 7 // thread. An alternative approach would be to use a background thread or pool
8 // of threads, but it seems better to leverage the operating system's ability 8 // of threads, but it seems better to leverage the operating system's ability
9 // to do background file reads for us. 9 // to do background file reads for us.
10 // 10 //
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return; 165 return;
166 166
167 int rv = net::OK; 167 int rv = net::OK;
168 if (!exists) { 168 if (!exists) {
169 rv = net::ERR_FILE_NOT_FOUND; 169 rv = net::ERR_FILE_NOT_FOUND;
170 } else { 170 } else {
171 DCHECK(!file_info.is_directory); 171 DCHECK(!file_info.is_directory);
172 int flags = base::PLATFORM_FILE_OPEN | 172 int flags = base::PLATFORM_FILE_OPEN |
173 base::PLATFORM_FILE_READ | 173 base::PLATFORM_FILE_READ |
174 base::PLATFORM_FILE_ASYNC; 174 base::PLATFORM_FILE_ASYNC;
175 rv = stream_.Open(file_path_.ToWStringHack(), flags); 175 rv = stream_.Open(file_path_, flags);
176 } 176 }
177 177
178 if (rv == net::OK) { 178 if (rv == net::OK) {
179 set_expected_content_size(file_info.size); 179 set_expected_content_size(file_info.size);
180 NotifyHeadersComplete(); 180 NotifyHeadersComplete();
181 } else { 181 } else {
182 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); 182 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
183 } 183 }
184 } 184 }
185 185
(...skipping 28 matching lines...) Expand all
214 return false; 214 return false;
215 215
216 *location = net::FilePathToFileURL(new_path); 216 *location = net::FilePathToFileURL(new_path);
217 *http_status_code = 301; 217 *http_status_code = 301;
218 return true; 218 return true;
219 #else 219 #else
220 return false; 220 return false;
221 #endif 221 #endif
222 } 222 }
223 223
OLDNEW
« no previous file with comments | « net/base/upload_data_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698