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

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

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