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

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

Issue 1017243002: Add File::Duplicate to duplicate a file handle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops Created 5 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
« no previous file with comments | « no previous file | base/files/file_posix.cc » ('j') | base/files/file_unittest.cc » ('J')
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>
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // POSIX-specific semantics: 280 // POSIX-specific semantics:
281 // * Locks are advisory only. 281 // * Locks are advisory only.
282 // * Within a process, locking the same file (by the same or new handle) 282 // * Within a process, locking the same file (by the same or new handle)
283 // will succeed. 283 // will succeed.
284 // * Closing any descriptor on a given file releases the lock. 284 // * Closing any descriptor on a given file releases the lock.
285 Error Lock(); 285 Error Lock();
286 286
287 // Unlock a file previously locked. 287 // Unlock a file previously locked.
288 Error Unlock(); 288 Error Unlock();
289 289
290 // Returns a new handle to this file for use within the current process. On
rvargas (doing something else) 2015/03/18 20:56:42 nit: handle -> object
grt (UTC plus 2) 2015/03/19 03:31:02 Done.
291 // POSIX, only the original File will obey FLAG_DELETE_ON_CLOSE.
rvargas (doing something else) 2015/03/18 20:56:42 I don't think this behavior is posix exclusive...
grt (UTC plus 2) 2015/03/18 21:06:24 I singled out POSIX here because "delete on close"
rvargas (doing something else) 2015/03/18 21:29:58 sounds good
grt (UTC plus 2) 2015/03/19 03:31:02 Done.
292 File Duplicate();
293
290 bool async() const { return async_; } 294 bool async() const { return async_; }
291 295
292 #if defined(OS_WIN) 296 #if defined(OS_WIN)
293 static Error OSErrorToFileError(DWORD last_error); 297 static Error OSErrorToFileError(DWORD last_error);
294 #elif defined(OS_POSIX) 298 #elif defined(OS_POSIX)
295 static Error OSErrorToFileError(int saved_errno); 299 static Error OSErrorToFileError(int saved_errno);
296 #endif 300 #endif
297 301
298 // Converts an error value to a human-readable form. Used for logging. 302 // Converts an error value to a human-readable form. Used for logging.
299 static std::string ErrorToString(Error error); 303 static std::string ErrorToString(Error error);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 #endif 359 #endif
356 360
357 Error error_details_; 361 Error error_details_;
358 bool created_; 362 bool created_;
359 bool async_; 363 bool async_;
360 }; 364 };
361 365
362 } // namespace base 366 } // namespace base
363 367
364 #endif // BASE_FILES_FILE_H_ 368 #endif // BASE_FILES_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | base/files/file_posix.cc » ('j') | base/files/file_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698