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_IPC_MESSAGE_ATTACHMENT_SET_H_ | 5 #ifndef IPC_IPC_MESSAGE_ATTACHMENT_SET_H_ |
6 #define IPC_IPC_MESSAGE_ATTACHMENT_SET_H_ | 6 #define IPC_IPC_MESSAGE_ATTACHMENT_SET_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 #if defined(OS_POSIX) | 59 #if defined(OS_POSIX) |
60 // This is the maximum number of descriptors per message. We need to know this | 60 // This is the maximum number of descriptors per message. We need to know this |
61 // because the control message kernel interface has to be given a buffer which | 61 // because the control message kernel interface has to be given a buffer which |
62 // is large enough to store all the descriptor numbers. Otherwise the kernel | 62 // is large enough to store all the descriptor numbers. Otherwise the kernel |
63 // tells us that it truncated the control data and the extra descriptors are | 63 // tells us that it truncated the control data and the extra descriptors are |
64 // lost. | 64 // lost. |
65 // | 65 // |
66 // In debugging mode, it's a fatal error to try and add more than this number | 66 // In debugging mode, it's a fatal error to try and add more than this number |
67 // of descriptors to a MessageAttachmentSet. | 67 // of descriptors to a MessageAttachmentSet. |
68 static const size_t kMaxDescriptorsPerMessage = 7; | 68 static const size_t kMaxDescriptorsPerMessage = 128; |
69 | 69 |
70 // --------------------------------------------------------------------------- | 70 // --------------------------------------------------------------------------- |
71 // Interfaces for transmission... | 71 // Interfaces for transmission... |
72 | 72 |
73 // Fill an array with file descriptors without 'consuming' them. CommitAll | 73 // Fill an array with file descriptors without 'consuming' them. CommitAll |
74 // must be called after these descriptors have been transmitted. | 74 // must be called after these descriptors have been transmitted. |
75 // buffer: (output) a buffer of, at least, size() integers. | 75 // buffer: (output) a buffer of, at least, size() integers. |
76 void PeekDescriptors(base::PlatformFile* buffer) const; | 76 void PeekDescriptors(base::PlatformFile* buffer) const; |
77 // Returns true if any contained file descriptors appear to be handles to a | 77 // Returns true if any contained file descriptors appear to be handles to a |
78 // directory. | 78 // directory. |
(...skipping 30 matching lines...) Expand all Loading... |
109 // all the descriptors have been read (with GetNthDescriptor). Secondly, we | 109 // all the descriptors have been read (with GetNthDescriptor). Secondly, we |
110 // can check that they are read in order. | 110 // can check that they are read in order. |
111 mutable unsigned consumed_descriptor_highwater_; | 111 mutable unsigned consumed_descriptor_highwater_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(MessageAttachmentSet); | 113 DISALLOW_COPY_AND_ASSIGN(MessageAttachmentSet); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace IPC | 116 } // namespace IPC |
117 | 117 |
118 #endif // IPC_IPC_MESSAGE_ATTACHMENT_SET_H_ | 118 #endif // IPC_IPC_MESSAGE_ATTACHMENT_SET_H_ |
OLD | NEW |