| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/platform_file.h" | 5 #include "base/platform_file.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 DWORD bytes_read; | 128 DWORD bytes_read; |
| 129 if (::ReadFile(file, data, size, &bytes_read, &overlapped) != 0) | 129 if (::ReadFile(file, data, size, &bytes_read, &overlapped) != 0) |
| 130 return bytes_read; | 130 return bytes_read; |
| 131 else if (ERROR_HANDLE_EOF == GetLastError()) | 131 else if (ERROR_HANDLE_EOF == GetLastError()) |
| 132 return 0; | 132 return 0; |
| 133 | 133 |
| 134 return -1; | 134 return -1; |
| 135 } | 135 } |
| 136 | 136 |
| 137 int ReadPlatformFileNoBestEffort(PlatformFile file, int64 offset, |
| 138 char* data, int size) { |
| 139 return ReadPlatformFile(file, offset, data, size); |
| 140 } |
| 141 |
| 137 int WritePlatformFile(PlatformFile file, int64 offset, | 142 int WritePlatformFile(PlatformFile file, int64 offset, |
| 138 const char* data, int size) { | 143 const char* data, int size) { |
| 139 base::ThreadRestrictions::AssertIOAllowed(); | 144 base::ThreadRestrictions::AssertIOAllowed(); |
| 140 if (file == kInvalidPlatformFileValue) | 145 if (file == kInvalidPlatformFileValue) |
| 141 return -1; | 146 return -1; |
| 142 | 147 |
| 143 LARGE_INTEGER offset_li; | 148 LARGE_INTEGER offset_li; |
| 144 offset_li.QuadPart = offset; | 149 offset_li.QuadPart = offset; |
| 145 | 150 |
| 146 OVERLAPPED overlapped = {0}; | 151 OVERLAPPED overlapped = {0}; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 info->is_directory = | 218 info->is_directory = |
| 214 file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY != 0; | 219 file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY != 0; |
| 215 info->is_symbolic_link = false; // Windows doesn't have symbolic links. | 220 info->is_symbolic_link = false; // Windows doesn't have symbolic links. |
| 216 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime); | 221 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime); |
| 217 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime); | 222 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime); |
| 218 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime); | 223 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime); |
| 219 return true; | 224 return true; |
| 220 } | 225 } |
| 221 | 226 |
| 222 } // namespace disk_cache | 227 } // namespace disk_cache |
| OLD | NEW |