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

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

Issue 202583005: Revert 257562 "Base: Make base::File use ScopedFD on POSIX." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/base/files/file.h ('k') | trunk/src/base/files/file_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6
7 // TODO(rvargas): remove this (needed for kInvalidPlatformFileValue). 7 // TODO(rvargas): remove this (needed for kInvalidPlatformFileValue).
8 #include "base/platform_file.h" 8 #include "base/platform_file.h"
9 9
10 namespace base { 10 namespace base {
(...skipping 22 matching lines...) Expand all
33 async_(false) { 33 async_(false) {
34 Initialize(name, flags); 34 Initialize(name, flags);
35 } 35 }
36 #endif 36 #endif
37 37
38 File::File(PlatformFile platform_file) 38 File::File(PlatformFile platform_file)
39 : file_(platform_file), 39 : file_(platform_file),
40 error_details_(FILE_OK), 40 error_details_(FILE_OK),
41 created_(false), 41 created_(false),
42 async_(false) { 42 async_(false) {
43 #if defined(OS_POSIX)
44 DCHECK_GE(platform_file, -1);
45 #endif
46 } 43 }
47 44
48 File::File(RValue other) 45 File::File(RValue other)
49 : file_(other.object->TakePlatformFile()), 46 : file_(other.object->TakePlatformFile()),
50 error_details_(other.object->error_details()), 47 error_details_(other.object->error_details()),
51 created_(other.object->created()), 48 created_(other.object->created()),
52 async_(other.object->async_) { 49 async_(other.object->async_) {
53 } 50 }
54 51
55 File::~File() { 52 File::~File() {
53 Close();
56 } 54 }
57 55
58 File& File::operator=(RValue other) { 56 File& File::operator=(RValue other) {
59 if (this != other.object) { 57 if (this != other.object) {
60 Close(); 58 Close();
61 SetPlatformFile(other.object->TakePlatformFile()); 59 SetPlatformFile(other.object->TakePlatformFile());
62 error_details_ = other.object->error_details(); 60 error_details_ = other.object->error_details();
63 created_ = other.object->created(); 61 created_ = other.object->created();
64 async_ = other.object->async_; 62 async_ = other.object->async_;
65 } 63 }
66 return *this; 64 return *this;
67 } 65 }
68 66
69 #if !defined(OS_NACL) 67 #if !defined(OS_NACL)
70 void File::Initialize(const FilePath& name, uint32 flags) { 68 void File::Initialize(const FilePath& name, uint32 flags) {
71 if (name.ReferencesParent()) { 69 if (name.ReferencesParent()) {
72 error_details_ = FILE_ERROR_ACCESS_DENIED; 70 error_details_ = FILE_ERROR_ACCESS_DENIED;
73 return; 71 return;
74 } 72 }
75 InitializeUnsafe(name, flags); 73 InitializeUnsafe(name, flags);
76 } 74 }
77 #endif 75 #endif
78 76
79 } // namespace base 77 } // namespace base
OLDNEW
« no previous file with comments | « trunk/src/base/files/file.h ('k') | trunk/src/base/files/file_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698