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

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

Issue 202493007: Revert 257577 "Revert 257562 "Base: Make base::File use ScopedFD..." (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 | « no previous file | trunk/src/base/files/file.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) 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 #ifndef BASE_FILES_FILE_H_ 5 #ifndef BASE_FILES_FILE_H_
6 #define BASE_FILES_FILE_H_ 6 #define BASE_FILES_FILE_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
11 #endif 11 #endif
12 12
13 #include "base/base_export.h" 13 #include "base/base_export.h"
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/files/scoped_file.h"
15 #include "base/move.h" 16 #include "base/move.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 18
18 #if defined(OS_WIN) 19 #if defined(OS_WIN)
19 #include "base/win/scoped_handle.h" 20 #include "base/win/scoped_handle.h"
20 #endif 21 #endif
21 22
22 namespace base { 23 namespace base {
23 24
24 class FilePath; 25 class FilePath;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // FLAG_CREATE_ALWAYS), and false otherwise. 171 // FLAG_CREATE_ALWAYS), and false otherwise.
171 bool created() const { return created_; } 172 bool created() const { return created_; }
172 173
173 // Returns the OS result of opening this file. Note that the way to verify 174 // Returns the OS result of opening this file. Note that the way to verify
174 // the success of the operation is to use IsValid(), not this method: 175 // the success of the operation is to use IsValid(), not this method:
175 // File file(name, flags); 176 // File file(name, flags);
176 // if (!file.IsValid()) 177 // if (!file.IsValid())
177 // return; 178 // return;
178 Error error_details() const { return error_details_; } 179 Error error_details() const { return error_details_; }
179 180
180 PlatformFile GetPlatformFile() const { return file_; } 181 PlatformFile GetPlatformFile() const;
181 PlatformFile TakePlatformFile(); 182 PlatformFile TakePlatformFile();
182 183
183 // Destroying this object closes the file automatically. 184 // Destroying this object closes the file automatically.
184 void Close(); 185 void Close();
185 186
186 // Changes current position in the file to an |offset| relative to an origin 187 // Changes current position in the file to an |offset| relative to an origin
187 // defined by |whence|. Returns the resultant current position in the file 188 // defined by |whence|. Returns the resultant current position in the file
188 // (relative to the start) or -1 in case of error. 189 // (relative to the start) or -1 in case of error.
189 int64 Seek(Whence whence, int64 offset); 190 int64 Seek(Whence whence, int64 offset);
190 191
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 #elif defined(OS_POSIX) 270 #elif defined(OS_POSIX)
270 static Error OSErrorToFileError(int saved_errno); 271 static Error OSErrorToFileError(int saved_errno);
271 #endif 272 #endif
272 273
273 private: 274 private:
274 void SetPlatformFile(PlatformFile file); 275 void SetPlatformFile(PlatformFile file);
275 276
276 #if defined(OS_WIN) 277 #if defined(OS_WIN)
277 win::ScopedHandle file_; 278 win::ScopedHandle file_;
278 #elif defined(OS_POSIX) 279 #elif defined(OS_POSIX)
279 PlatformFile file_; 280 ScopedFD file_;
280 #endif 281 #endif
281 282
282 Error error_details_; 283 Error error_details_;
283 bool created_; 284 bool created_;
284 bool async_; 285 bool async_;
285 }; 286 };
286 287
287 } // namespace base 288 } // namespace base
288 289
289 #endif // BASE_FILES_FILE_H_ 290 #endif // BASE_FILES_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | trunk/src/base/files/file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698