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 #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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 break; | 97 break; |
98 default: | 98 default: |
99 *error_code = PLATFORM_FILE_ERROR_FAILED; | 99 *error_code = PLATFORM_FILE_ERROR_FAILED; |
100 } | 100 } |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 return file; | 104 return file; |
105 } | 105 } |
106 | 106 |
107 PlatformFile CreatePlatformFile(const std::wstring& name, int flags, | |
108 bool* created) { | |
109 return CreatePlatformFile(FilePath::FromWStringHack(name), flags, | |
110 created, NULL); | |
111 } | |
112 | |
113 bool ClosePlatformFile(PlatformFile file) { | 107 bool ClosePlatformFile(PlatformFile file) { |
114 base::ThreadRestrictions::AssertIOAllowed(); | 108 base::ThreadRestrictions::AssertIOAllowed(); |
115 return (CloseHandle(file) != 0); | 109 return (CloseHandle(file) != 0); |
116 } | 110 } |
117 | 111 |
118 int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size) { | 112 int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size) { |
119 base::ThreadRestrictions::AssertIOAllowed(); | 113 base::ThreadRestrictions::AssertIOAllowed(); |
120 if (file == kInvalidPlatformFileValue) | 114 if (file == kInvalidPlatformFileValue) |
121 return -1; | 115 return -1; |
122 | 116 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 info->is_directory = | 209 info->is_directory = |
216 file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY != 0; | 210 file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY != 0; |
217 info->is_symbolic_link = false; // Windows doesn't have symbolic links. | 211 info->is_symbolic_link = false; // Windows doesn't have symbolic links. |
218 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime); | 212 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime); |
219 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime); | 213 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime); |
220 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime); | 214 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime); |
221 return true; | 215 return true; |
222 } | 216 } |
223 | 217 |
224 } // namespace disk_cache | 218 } // namespace disk_cache |
OLD | NEW |