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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 info->size = size.QuadPart; | 210 info->size = size.QuadPart; |
211 info->is_directory = | 211 info->is_directory = |
212 file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY != 0; | 212 file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY != 0; |
213 info->is_symbolic_link = false; // Windows doesn't have symbolic links. | 213 info->is_symbolic_link = false; // Windows doesn't have symbolic links. |
214 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime); | 214 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime); |
215 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime); | 215 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime); |
216 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime); | 216 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime); |
217 return true; | 217 return true; |
218 } | 218 } |
219 | 219 |
| 220 PlatformFile GetFileHandleForProcess(PlatformFile file, |
| 221 ProcessHandle process, |
| 222 bool close_source_handle) { |
| 223 if (file == base::kInvalidPlatformFileValue) |
| 224 return base::kInvalidPlatformFileValue; |
| 225 |
| 226 PlatformFile result = base::kInvalidPlatformFileValue; |
| 227 // Note that when |close_source_handle| is true, |file| is closed whether or |
| 228 // not DuplicateHandle succeeds. |
| 229 DuplicateHandle(GetCurrentProcess(), file, process, &result, 0, false, |
| 230 DUPLICATE_SAME_ACCESS | |
| 231 (close_source_handle ? DUPLICATE_CLOSE_SOURCE : 0)); |
| 232 return result; |
| 233 } |
| 234 |
220 } // namespace disk_cache | 235 } // namespace disk_cache |
OLD | NEW |