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

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

Issue 201083002: Base: Make base::File use ScopedFD on POSIX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 File::File(RValue other) 45 File::File(RValue other)
46 : file_(other.object->TakePlatformFile()), 46 : file_(other.object->TakePlatformFile()),
47 error_details_(other.object->error_details()), 47 error_details_(other.object->error_details()),
48 created_(other.object->created()), 48 created_(other.object->created()),
49 async_(other.object->async_) { 49 async_(other.object->async_) {
50 } 50 }
51 51
52 File::~File() { 52 File::~File() {
53 Close();
54 } 53 }
55 54
56 File& File::operator=(RValue other) { 55 File& File::operator=(RValue other) {
57 if (this != other.object) { 56 if (this != other.object) {
58 Close(); 57 Close();
59 SetPlatformFile(other.object->TakePlatformFile()); 58 SetPlatformFile(other.object->TakePlatformFile());
60 error_details_ = other.object->error_details(); 59 error_details_ = other.object->error_details();
61 created_ = other.object->created(); 60 created_ = other.object->created();
62 async_ = other.object->async_; 61 async_ = other.object->async_;
63 } 62 }
64 return *this; 63 return *this;
65 } 64 }
66 65
67 #if !defined(OS_NACL) 66 #if !defined(OS_NACL)
68 void File::Initialize(const FilePath& name, uint32 flags) { 67 void File::Initialize(const FilePath& name, uint32 flags) {
69 if (name.ReferencesParent()) { 68 if (name.ReferencesParent()) {
70 error_details_ = FILE_ERROR_ACCESS_DENIED; 69 error_details_ = FILE_ERROR_ACCESS_DENIED;
71 return; 70 return;
72 } 71 }
73 InitializeUnsafe(name, flags); 72 InitializeUnsafe(name, flags);
74 } 73 }
75 #endif 74 #endif
76 75
77 } // namespace base 76 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file.h ('k') | base/files/file_posix.cc » ('j') | base/files/file_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698