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/files/file.h" | 5 #include "base/files/file.h" |
6 | 6 #include "base/files/file_path.h" |
7 // TODO(rvargas): remove this (needed for kInvalidPlatformFileValue). | |
8 #include "base/platform_file.h" | |
9 | 7 |
10 namespace base { | 8 namespace base { |
11 | 9 |
12 File::Info::Info() | 10 File::Info::Info() |
13 : size(0), | 11 : size(0), |
14 is_directory(false), | 12 is_directory(false), |
15 is_symbolic_link(false) { | 13 is_symbolic_link(false) { |
16 } | 14 } |
17 | 15 |
18 File::Info::~Info() { | 16 File::Info::~Info() { |
19 } | 17 } |
20 | 18 |
21 File::File() | 19 File::File() |
22 : file_(kInvalidPlatformFileValue), | 20 : error_details_(FILE_ERROR_FAILED), |
23 error_details_(FILE_ERROR_FAILED), | |
24 created_(false), | 21 created_(false), |
25 async_(false) { | 22 async_(false) { |
26 } | 23 } |
27 | 24 |
28 #if !defined(OS_NACL) | 25 #if !defined(OS_NACL) |
29 File::File(const FilePath& name, uint32 flags) | 26 File::File(const FilePath& name, uint32 flags) |
30 : file_(kInvalidPlatformFileValue), | 27 : error_details_(FILE_OK), |
31 error_details_(FILE_OK), | |
32 created_(false), | 28 created_(false), |
33 async_(false) { | 29 async_(false) { |
34 Initialize(name, flags); | 30 Initialize(name, flags); |
35 } | 31 } |
36 #endif | 32 #endif |
37 | 33 |
38 File::File(PlatformFile platform_file) | 34 File::File(PlatformFile platform_file) |
39 : file_(platform_file), | 35 : file_(platform_file), |
40 error_details_(FILE_OK), | 36 error_details_(FILE_OK), |
41 created_(false), | 37 created_(false), |
42 async_(false) { | 38 async_(false) { |
43 #if defined(OS_POSIX) | 39 #if defined(OS_POSIX) |
44 DCHECK_GE(platform_file, -1); | 40 DCHECK_GE(platform_file, -1); |
45 #endif | 41 #endif |
46 } | 42 } |
47 | 43 |
48 File::File(Error error_details) | 44 File::File(Error error_details) |
49 : file_(kInvalidPlatformFileValue), | 45 : error_details_(error_details), |
50 error_details_(error_details), | |
51 created_(false), | 46 created_(false), |
52 async_(false) { | 47 async_(false) { |
53 } | 48 } |
54 | 49 |
55 File::File(RValue other) | 50 File::File(RValue other) |
56 : file_(other.object->TakePlatformFile()), | 51 : file_(other.object->TakePlatformFile()), |
57 error_details_(other.object->error_details()), | 52 error_details_(other.object->error_details()), |
58 created_(other.object->created()), | 53 created_(other.object->created()), |
59 async_(other.object->async_) { | 54 async_(other.object->async_) { |
60 } | 55 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return "FILE_ERROR_IO"; | 118 return "FILE_ERROR_IO"; |
124 case FILE_ERROR_MAX: | 119 case FILE_ERROR_MAX: |
125 break; | 120 break; |
126 } | 121 } |
127 | 122 |
128 NOTREACHED(); | 123 NOTREACHED(); |
129 return ""; | 124 return ""; |
130 } | 125 } |
131 | 126 |
132 } // namespace base | 127 } // namespace base |
OLD | NEW |