Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef BASE_FILE_DESCRIPTOR_POSIX_H_ |
michael@0 | 6 | #define BASE_FILE_DESCRIPTOR_POSIX_H_ |
michael@0 | 7 | |
michael@0 | 8 | namespace base { |
michael@0 | 9 | |
michael@0 | 10 | // ----------------------------------------------------------------------------- |
michael@0 | 11 | // We introduct a special structure for file descriptors in order that we are |
michael@0 | 12 | // able to use template specialisation to special-case their handling. |
michael@0 | 13 | // |
michael@0 | 14 | // WARNING: (Chromium only) There are subtleties to consider if serialising |
michael@0 | 15 | // these objects over IPC. See comments in chrome/common/ipc_message_utils.h |
michael@0 | 16 | // above the template specialisation for this structure. |
michael@0 | 17 | // ----------------------------------------------------------------------------- |
michael@0 | 18 | struct FileDescriptor { |
michael@0 | 19 | FileDescriptor() |
michael@0 | 20 | : fd(-1), |
michael@0 | 21 | auto_close(false) { } |
michael@0 | 22 | |
michael@0 | 23 | FileDescriptor(int ifd, bool iauto_close) |
michael@0 | 24 | : fd(ifd), |
michael@0 | 25 | auto_close(iauto_close) { } |
michael@0 | 26 | |
michael@0 | 27 | int fd; |
michael@0 | 28 | // If true, this file descriptor should be closed after it has been used. For |
michael@0 | 29 | // example an IPC system might interpret this flag as indicating that the |
michael@0 | 30 | // file descriptor it has been given should be closed after use. |
michael@0 | 31 | bool auto_close; |
michael@0 | 32 | }; |
michael@0 | 33 | |
michael@0 | 34 | } // namespace base |
michael@0 | 35 | |
michael@0 | 36 | #endif // BASE_FILE_DESCRIPTOR_POSIX_H_ |