OLD | NEW |
---|---|
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_FILE_DESCRIPTOR_POSIX_H_ | 5 #ifndef BASE_FILE_DESCRIPTOR_POSIX_H_ |
6 #define BASE_FILE_DESCRIPTOR_POSIX_H_ | 6 #define BASE_FILE_DESCRIPTOR_POSIX_H_ |
7 | 7 |
8 namespace base { | 8 namespace base { |
9 | 9 |
10 // ----------------------------------------------------------------------------- | 10 // ----------------------------------------------------------------------------- |
11 // We introduct a special structure for file descriptors in order that we are | 11 // We introduct a special structure for file descriptors in order that we are |
12 // able to use template specialisation to special-case their handling. | 12 // able to use template specialisation to special-case their handling. |
13 // | |
14 // WARNING: (Chromium only) There are subtleties to consider if serialising | |
15 // these objects over IPC. See comments in chrome/common/ipc_message_utils.h | |
16 // above the template specialisation for this structure. | |
13 // ----------------------------------------------------------------------------- | 17 // ----------------------------------------------------------------------------- |
14 struct FileDescriptor { | 18 struct FileDescriptor { |
15 FileDescriptor() | 19 FileDescriptor() |
16 : fd(-1), | 20 : fd(-1), |
17 auto_close(false) { } | 21 auto_close(false) { } |
18 | 22 |
19 FileDescriptor(int ifd, bool iauto_close) | 23 FileDescriptor(int ifd, bool iauto_close) |
20 : fd(ifd), | 24 : fd(ifd), |
21 auto_close(iauto_close) { } | 25 auto_close(iauto_close) { } |
22 | 26 |
23 int fd; | 27 int fd; |
Alpha Left Google
2009/03/05 20:39:38
Should this be type base::PlatformFile?
| |
24 // If true, this file descriptor should be closed after it has been used. For | 28 // If true, this file descriptor should be closed after it has been used. For |
25 // example an IPC system might interpret this flag as indicating that the | 29 // example an IPC system might interpret this flag as indicating that the |
26 // file descriptor it has been given should be closed after use. | 30 // file descriptor it has been given should be closed after use. |
27 bool auto_close; | 31 bool auto_close; |
28 }; | 32 }; |
29 | 33 |
30 } // namespace base | 34 } // namespace base |
31 | 35 |
32 #endif // BASE_FILE_DESCRIPTOR_POSIX_H_ | 36 #endif // BASE_FILE_DESCRIPTOR_POSIX_H_ |
OLD | NEW |