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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 disposition = CREATE_NEW; | 27 disposition = CREATE_NEW; |
28 } | 28 } |
29 | 29 |
30 if (flags & FLAG_OPEN_ALWAYS) { | 30 if (flags & FLAG_OPEN_ALWAYS) { |
31 DCHECK(!disposition); | 31 DCHECK(!disposition); |
32 disposition = OPEN_ALWAYS; | 32 disposition = OPEN_ALWAYS; |
33 } | 33 } |
34 | 34 |
35 if (flags & FLAG_CREATE_ALWAYS) { | 35 if (flags & FLAG_CREATE_ALWAYS) { |
36 DCHECK(!disposition); | 36 DCHECK(!disposition); |
| 37 DCHECK(flags & FLAG_WRITE); |
37 disposition = CREATE_ALWAYS; | 38 disposition = CREATE_ALWAYS; |
38 } | 39 } |
39 | 40 |
40 if (flags & FLAG_OPEN_TRUNCATED) { | 41 if (flags & FLAG_OPEN_TRUNCATED) { |
41 DCHECK(!disposition); | 42 DCHECK(!disposition); |
42 DCHECK(flags & FLAG_WRITE); | 43 DCHECK(flags & FLAG_WRITE); |
43 disposition = TRUNCATE_EXISTING; | 44 disposition = TRUNCATE_EXISTING; |
44 } | 45 } |
45 | 46 |
46 if (!disposition) { | 47 if (!disposition) { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 last_error); | 340 last_error); |
340 return FILE_ERROR_FAILED; | 341 return FILE_ERROR_FAILED; |
341 } | 342 } |
342 } | 343 } |
343 | 344 |
344 void File::SetPlatformFile(PlatformFile file) { | 345 void File::SetPlatformFile(PlatformFile file) { |
345 file_.Set(file); | 346 file_.Set(file); |
346 } | 347 } |
347 | 348 |
348 } // namespace base | 349 } // namespace base |
OLD | NEW |