OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 IPC_FILE_DESCRIPTOR_SET_POSIX_H_ | 5 #ifndef IPC_FILE_DESCRIPTOR_SET_POSIX_H_ |
6 #define IPC_FILE_DESCRIPTOR_SET_POSIX_H_ | 6 #define IPC_FILE_DESCRIPTOR_SET_POSIX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_descriptor_posix.h" | 12 #include "base/file_descriptor_posix.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "ipc/ipc_export.h" |
14 | 15 |
15 // ----------------------------------------------------------------------------- | 16 // ----------------------------------------------------------------------------- |
16 // A FileDescriptorSet is an ordered set of POSIX file descriptors. These are | 17 // A FileDescriptorSet is an ordered set of POSIX file descriptors. These are |
17 // associated with IPC messages so that descriptors can be transmitted over a | 18 // associated with IPC messages so that descriptors can be transmitted over a |
18 // UNIX domain socket. | 19 // UNIX domain socket. |
19 // ----------------------------------------------------------------------------- | 20 // ----------------------------------------------------------------------------- |
20 class FileDescriptorSet : public base::RefCountedThreadSafe<FileDescriptorSet> { | 21 class IPC_EXPORT FileDescriptorSet |
| 22 : public base::RefCountedThreadSafe<FileDescriptorSet> { |
21 public: | 23 public: |
22 FileDescriptorSet(); | 24 FileDescriptorSet(); |
23 | 25 |
24 // This is the maximum number of descriptors per message. We need to know this | 26 // This is the maximum number of descriptors per message. We need to know this |
25 // because the control message kernel interface has to be given a buffer which | 27 // because the control message kernel interface has to be given a buffer which |
26 // is large enough to store all the descriptor numbers. Otherwise the kernel | 28 // is large enough to store all the descriptor numbers. Otherwise the kernel |
27 // tells us that it truncated the control data and the extra descriptors are | 29 // tells us that it truncated the control data and the extra descriptors are |
28 // lost. | 30 // lost. |
29 // | 31 // |
30 // In debugging mode, it's a fatal error to try and add more than this number | 32 // In debugging mode, it's a fatal error to try and add more than this number |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // This contains the index of the next descriptor which should be consumed. | 108 // This contains the index of the next descriptor which should be consumed. |
107 // It's used in a couple of ways. Firstly, at destruction we can check that | 109 // It's used in a couple of ways. Firstly, at destruction we can check that |
108 // all the descriptors have been read (with GetNthDescriptor). Secondly, we | 110 // all the descriptors have been read (with GetNthDescriptor). Secondly, we |
109 // can check that they are read in order. | 111 // can check that they are read in order. |
110 mutable unsigned consumed_descriptor_highwater_; | 112 mutable unsigned consumed_descriptor_highwater_; |
111 | 113 |
112 DISALLOW_COPY_AND_ASSIGN(FileDescriptorSet); | 114 DISALLOW_COPY_AND_ASSIGN(FileDescriptorSet); |
113 }; | 115 }; |
114 | 116 |
115 #endif // IPC_FILE_DESCRIPTOR_SET_POSIX_H_ | 117 #endif // IPC_FILE_DESCRIPTOR_SET_POSIX_H_ |
OLD | NEW |