Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: base/files/file.cc

Issue 430583005: Make VEA test support videos with different coded size and visible size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments of patch set 7 and 8 Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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::File() 19 File::File()
20 : error_details_(FILE_ERROR_FAILED), 20 : error_details_(FILE_ERROR_FAILED),
21 created_(false), 21 created_(false),
22 async_(false) { 22 async_(false),
23 flags_(0) {
23 } 24 }
24 25
25 #if !defined(OS_NACL) 26 #if !defined(OS_NACL)
26 File::File(const FilePath& name, uint32 flags) 27 File::File(const FilePath& name, uint32 flags)
27 : error_details_(FILE_OK), 28 : error_details_(FILE_OK),
28 created_(false), 29 created_(false),
29 async_(false) { 30 async_(false),
31 flags_(0) {
30 Initialize(name, flags); 32 Initialize(name, flags);
31 } 33 }
32 #endif 34 #endif
33 35
34 File::File(PlatformFile platform_file) 36 File::File(PlatformFile platform_file)
35 : file_(platform_file), 37 : file_(platform_file),
36 error_details_(FILE_OK), 38 error_details_(FILE_OK),
37 created_(false), 39 created_(false),
38 async_(false) { 40 async_(false),
41 flags_(0) {
39 #if defined(OS_POSIX) 42 #if defined(OS_POSIX)
40 DCHECK_GE(platform_file, -1); 43 DCHECK_GE(platform_file, -1);
41 #endif 44 #endif
42 } 45 }
43 46
44 File::File(Error error_details) 47 File::File(Error error_details)
45 : error_details_(error_details), 48 : error_details_(error_details),
46 created_(false), 49 created_(false),
47 async_(false) { 50 async_(false),
51 flags_(0) {
48 } 52 }
49 53
50 File::File(RValue other) 54 File::File(RValue other)
51 : file_(other.object->TakePlatformFile()), 55 : file_(other.object->TakePlatformFile()),
52 error_details_(other.object->error_details()), 56 error_details_(other.object->error_details()),
53 created_(other.object->created()), 57 created_(other.object->created()),
54 async_(other.object->async_) { 58 async_(other.object->async_),
59 flags_(other.object->flags_) {
55 } 60 }
56 61
57 File::~File() { 62 File::~File() {
58 // Go through the AssertIOAllowed logic. 63 // Go through the AssertIOAllowed logic.
59 Close(); 64 Close();
60 } 65 }
61 66
62 File& File::operator=(RValue other) { 67 File& File::operator=(RValue other) {
63 if (this != other.object) { 68 if (this != other.object) {
64 Close(); 69 Close();
65 SetPlatformFile(other.object->TakePlatformFile()); 70 SetPlatformFile(other.object->TakePlatformFile());
66 error_details_ = other.object->error_details(); 71 error_details_ = other.object->error_details();
67 created_ = other.object->created(); 72 created_ = other.object->created();
68 async_ = other.object->async_; 73 async_ = other.object->async_;
74 flags_ = other.object->flags_;
69 } 75 }
70 return *this; 76 return *this;
71 } 77 }
72 78
73 #if !defined(OS_NACL) 79 #if !defined(OS_NACL)
74 void File::Initialize(const FilePath& name, uint32 flags) { 80 void File::Initialize(const FilePath& name, uint32 flags) {
75 if (name.ReferencesParent()) { 81 if (name.ReferencesParent()) {
76 error_details_ = FILE_ERROR_ACCESS_DENIED; 82 error_details_ = FILE_ERROR_ACCESS_DENIED;
77 return; 83 return;
78 } 84 }
85 flags_ = flags;
79 InitializeUnsafe(name, flags); 86 InitializeUnsafe(name, flags);
80 } 87 }
81 #endif 88 #endif
82 89
83 std::string File::ErrorToString(Error error) { 90 std::string File::ErrorToString(Error error) {
84 switch (error) { 91 switch (error) {
85 case FILE_OK: 92 case FILE_OK:
86 return "FILE_OK"; 93 return "FILE_OK";
87 case FILE_ERROR_FAILED: 94 case FILE_ERROR_FAILED:
88 return "FILE_ERROR_FAILED"; 95 return "FILE_ERROR_FAILED";
(...skipping 29 matching lines...) Expand all
118 return "FILE_ERROR_IO"; 125 return "FILE_ERROR_IO";
119 case FILE_ERROR_MAX: 126 case FILE_ERROR_MAX:
120 break; 127 break;
121 } 128 }
122 129
123 NOTREACHED(); 130 NOTREACHED();
124 return ""; 131 return "";
125 } 132 }
126 133
127 } // namespace base 134 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698