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

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: rvargas feedback 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 object referencing this file for use within the current
291 // process. Handling of FLAG_DELETE_ON_CLOSE varies by OS. On POSIX, the File
292 // object that was created or initialized with this flag will unlink the
293 // underlying file on close. On Windows, the underlying file is deleted when
294 // the last handle to it is closed.
295 File Duplicate();
296
290 bool async() const { return async_; } 297 bool async() const { return async_; }
291 298
292 #if defined(OS_WIN) 299 #if defined(OS_WIN)
293 static Error OSErrorToFileError(DWORD last_error); 300 static Error OSErrorToFileError(DWORD last_error);
294 #elif defined(OS_POSIX) 301 #elif defined(OS_POSIX)
295 static Error OSErrorToFileError(int saved_errno); 302 static Error OSErrorToFileError(int saved_errno);
296 #endif 303 #endif
297 304
298 // Converts an error value to a human-readable form. Used for logging. 305 // Converts an error value to a human-readable form. Used for logging.
299 static std::string ErrorToString(Error error); 306 static std::string ErrorToString(Error error);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 #endif 362 #endif
356 363
357 Error error_details_; 364 Error error_details_;
358 bool created_; 365 bool created_;
359 bool async_; 366 bool async_;
360 }; 367 };
361 368
362 } // namespace base 369 } // namespace base
363 370
364 #endif // BASE_FILES_FILE_H_ 371 #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