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 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 | 7 |
8 namespace base { | 8 namespace base { |
9 | 9 |
10 File::Info::Info() | 10 File::Info::Info() |
11 : size(0), | 11 : size(0), |
12 is_directory(false), | 12 is_directory(false), |
13 is_symbolic_link(false) { | 13 is_symbolic_link(false) { |
14 } | 14 } |
15 | 15 |
16 File::Info::~Info() { | 16 File::Info::~Info() { |
17 } | 17 } |
18 | 18 |
19 File::Region::Region(int64 offset, int64 size) : offset(offset), size(size) { | |
20 DCHECK_GE(offset, 0); | |
21 DCHECK_GE(size, 0); | |
22 } | |
23 | |
24 File::Region::~Region() { | |
25 } | |
26 | |
27 bool File::Region::IsWholeFile() const { | |
willchan no longer on Chromium
2014/07/21 23:55:40
Hmmm...what happens when |size| == the length of t
Primiano Tucci (use gerrit)
2014/07/22 10:32:01
Good point, let me spend one minute to explain the
willchan no longer on Chromium
2014/07/22 20:45:47
We chatted about this offline. Primiano explained
| |
28 return offset == 0 && size == std::numeric_limits<int64>::max(); | |
29 } | |
30 | |
31 // static | |
32 File::Region File::Region::WholeFile() { | |
33 return File::Region(0, std::numeric_limits<int64>::max()); | |
34 } | |
35 | |
19 File::File() | 36 File::File() |
20 : error_details_(FILE_ERROR_FAILED), | 37 : error_details_(FILE_ERROR_FAILED), |
21 created_(false), | 38 created_(false), |
22 async_(false) { | 39 async_(false) { |
23 } | 40 } |
24 | 41 |
25 #if !defined(OS_NACL) | 42 #if !defined(OS_NACL) |
26 File::File(const FilePath& name, uint32 flags) | 43 File::File(const FilePath& name, uint32 flags) |
27 : error_details_(FILE_OK), | 44 : error_details_(FILE_OK), |
28 created_(false), | 45 created_(false), |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 return "FILE_ERROR_IO"; | 135 return "FILE_ERROR_IO"; |
119 case FILE_ERROR_MAX: | 136 case FILE_ERROR_MAX: |
120 break; | 137 break; |
121 } | 138 } |
122 | 139 |
123 NOTREACHED(); | 140 NOTREACHED(); |
124 return ""; | 141 return ""; |
125 } | 142 } |
126 | 143 |
127 } // namespace base | 144 } // namespace base |
OLD | NEW |