OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file.h" | 5 #include "base/files/file.h" |
6 | 6 |
7 #include <io.h> | 7 #include <io.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
11 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 | 14 |
15 // Make sure our Whence mappings match the system headers. | 15 // Make sure our Whence mappings match the system headers. |
16 COMPILE_ASSERT(File::FROM_BEGIN == FILE_BEGIN && | 16 static_assert(File::FROM_BEGIN == FILE_BEGIN && |
17 File::FROM_CURRENT == FILE_CURRENT && | 17 File::FROM_CURRENT == FILE_CURRENT && |
18 File::FROM_END == FILE_END, whence_matches_system); | 18 File::FROM_END == FILE_END, |
| 19 "whence mapping must match the system headers"); |
19 | 20 |
20 bool File::IsValid() const { | 21 bool File::IsValid() const { |
21 return file_.IsValid(); | 22 return file_.IsValid(); |
22 } | 23 } |
23 | 24 |
24 PlatformFile File::GetPlatformFile() const { | 25 PlatformFile File::GetPlatformFile() const { |
25 return file_.Get(); | 26 return file_.Get(); |
26 } | 27 } |
27 | 28 |
28 PlatformFile File::TakePlatformFile() { | 29 PlatformFile File::TakePlatformFile() { |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 ThreadRestrictions::AssertIOAllowed(); | 399 ThreadRestrictions::AssertIOAllowed(); |
399 DCHECK(IsValid()); | 400 DCHECK(IsValid()); |
400 return ::FlushFileBuffers(file_.Get()) != FALSE; | 401 return ::FlushFileBuffers(file_.Get()) != FALSE; |
401 } | 402 } |
402 | 403 |
403 void File::SetPlatformFile(PlatformFile file) { | 404 void File::SetPlatformFile(PlatformFile file) { |
404 file_.Set(file); | 405 file_.Set(file); |
405 } | 406 } |
406 | 407 |
407 } // namespace base | 408 } // namespace base |
OLD | NEW |