| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |