| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 // Otherwise, a read error occured. We may just need to wait... | 144 // Otherwise, a read error occured. We may just need to wait... |
| 145 if (rv == net::ERR_IO_PENDING) { | 145 if (rv == net::ERR_IO_PENDING) { |
| 146 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 146 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
| 147 } else { | 147 } else { |
| 148 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 148 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
| 149 } | 149 } |
| 150 return false; | 150 return false; |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool URLRequestFileJob::GetMimeType(std::string* mime_type) { | 153 bool URLRequestFileJob::GetMimeType(std::string* mime_type) const { |
| 154 DCHECK(request_); | 154 DCHECK(request_); |
| 155 return net::GetMimeTypeFromFile(file_path_, mime_type); | 155 return net::GetMimeTypeFromFile(file_path_, mime_type); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void URLRequestFileJob::DidResolve( | 158 void URLRequestFileJob::DidResolve( |
| 159 bool exists, const file_util::FileInfo& file_info) { | 159 bool exists, const file_util::FileInfo& file_info) { |
| 160 #if defined(OS_WIN) | 160 #if defined(OS_WIN) |
| 161 async_resolver_ = NULL; | 161 async_resolver_ = NULL; |
| 162 #endif | 162 #endif |
| 163 | 163 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return false; | 219 return false; |
| 220 | 220 |
| 221 *location = net::FilePathToFileURL(new_path); | 221 *location = net::FilePathToFileURL(new_path); |
| 222 *http_status_code = 301; | 222 *http_status_code = 301; |
| 223 return true; | 223 return true; |
| 224 #else | 224 #else |
| 225 return false; | 225 return false; |
| 226 #endif | 226 #endif |
| 227 } | 227 } |
| 228 | 228 |
| OLD | NEW |