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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // must be called after these descriptors have been transmitted. | 70 // must be called after these descriptors have been transmitted. |
71 // buffer: (output) a buffer of, at least, size() integers. | 71 // buffer: (output) a buffer of, at least, size() integers. |
72 void GetDescriptors(int* buffer) const; | 72 void GetDescriptors(int* buffer) const; |
73 // This must be called after transmitting the descriptors returned by | 73 // This must be called after transmitting the descriptors returned by |
74 // GetDescriptors. It marks all the descriptors as consumed and closes those | 74 // GetDescriptors. It marks all the descriptors as consumed and closes those |
75 // which are auto-close. | 75 // which are auto-close. |
76 void CommitAll(); | 76 void CommitAll(); |
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. |
79 bool ContainsDirectoryDescriptor() const; | 79 bool ContainsDirectoryDescriptor() const; |
| 80 // Fetch all filedescriptors with the "auto close" property. |
| 81 // Used instead of CommitAll() when closing must be handled manually. |
| 82 void ReleaseFDsToClose(std::vector<int>* fds); |
80 | 83 |
81 // --------------------------------------------------------------------------- | 84 // --------------------------------------------------------------------------- |
82 | 85 |
83 | 86 |
84 // --------------------------------------------------------------------------- | 87 // --------------------------------------------------------------------------- |
85 // Interfaces for receiving... | 88 // Interfaces for receiving... |
86 | 89 |
87 // Set the contents of the set from the given buffer. This set must be empty | 90 // Set the contents of the set from the given buffer. This set must be empty |
88 // before calling. The auto-close flag is set on all the descriptors so that | 91 // before calling. The auto-close flag is set on all the descriptors so that |
89 // unconsumed descriptors are closed on destruction. | 92 // unconsumed descriptors are closed on destruction. |
(...skipping 15 matching lines...) Expand all Loading... |
105 // 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. |
106 // 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 |
107 // all the descriptors have been read (with GetNthDescriptor). Secondly, we | 110 // all the descriptors have been read (with GetNthDescriptor). Secondly, we |
108 // can check that they are read in order. | 111 // can check that they are read in order. |
109 mutable unsigned consumed_descriptor_highwater_; | 112 mutable unsigned consumed_descriptor_highwater_; |
110 | 113 |
111 DISALLOW_COPY_AND_ASSIGN(FileDescriptorSet); | 114 DISALLOW_COPY_AND_ASSIGN(FileDescriptorSet); |
112 }; | 115 }; |
113 | 116 |
114 #endif // IPC_FILE_DESCRIPTOR_SET_POSIX_H_ | 117 #endif // IPC_FILE_DESCRIPTOR_SET_POSIX_H_ |
OLD | NEW |