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

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

Issue 93513002: Base: Move platform_file.* to files/file.* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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"
6
7 // TODO(rvargas): remove this (needed for kInvalidPlatformFileValue).
5 #include "base/platform_file.h" 8 #include "base/platform_file.h"
6 9
7 namespace base { 10 namespace base {
8 11
9 PlatformFileInfo::PlatformFileInfo() 12 File::Info::Info()
10 : size(0), 13 : size(0),
11 is_directory(false), 14 is_directory(false),
12 is_symbolic_link(false) { 15 is_symbolic_link(false) {
13 } 16 }
14 17
15 PlatformFileInfo::~PlatformFileInfo() {} 18 File::Info::~Info() {
19 }
20
21 File::File()
22 : file_(kInvalidPlatformFileValue),
23 error_(FILE_OK),
24 created_(false),
25 async_(false) {
26 }
16 27
17 #if !defined(OS_NACL) 28 #if !defined(OS_NACL)
18 PlatformFile CreatePlatformFile(const FilePath& name, 29 File::File(const FilePath& name, uint32 flags)
19 int flags, 30 : file_(kInvalidPlatformFileValue),
20 bool* created, 31 error_(FILE_OK),
21 PlatformFileError* error) { 32 created_(false),
33 async_(false) {
22 if (name.ReferencesParent()) { 34 if (name.ReferencesParent()) {
23 if (error) 35 error_ = FILE_ERROR_ACCESS_DENIED;
24 *error = PLATFORM_FILE_ERROR_ACCESS_DENIED; 36 return;
25 return kInvalidPlatformFileValue;
26 } 37 }
27 return CreatePlatformFileUnsafe(name, flags, created, error); 38 CreateBaseFileUnsafe(name, flags);
28 } 39 }
29 #endif 40 #endif
30 41
42 File::File(RValue other)
43 : file_(other.object->TakePlatformFile()),
44 error_(other.object->error()),
45 created_(other.object->created()),
46 async_(other.object->async_) {
47 }
48
49 File::~File() {
50 Close();
51 }
52
53 File& File::operator=(RValue other) {
54 if (this != other.object) {
55 Close();
56 SetPlatformFile(other.object->TakePlatformFile());
57 error_ = other.object->error();
58 created_ = other.object->created();
59 async_ = other.object->async_;
60 }
61 return *this;
62 }
63
31 } // namespace base 64 } // namespace base
OLDNEW
« base/files/file.h ('K') | « base/files/file.h ('k') | base/files/file_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698