OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ | 5 #ifndef PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ |
6 #define PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ | 6 #define PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // Returns the handle at the given index if it exists and is of the given | 32 // Returns the handle at the given index if it exists and is of the given |
33 // type. The corresponding slot in the list is set to an invalid handle. | 33 // type. The corresponding slot in the list is set to an invalid handle. |
34 // If the index doesn't exist or the handle isn't of the given type, returns | 34 // If the index doesn't exist or the handle isn't of the given type, returns |
35 // an invalid handle. | 35 // an invalid handle. |
36 // Note that the caller is responsible for closing the returned handle, if it | 36 // Note that the caller is responsible for closing the returned handle, if it |
37 // is valid. | 37 // is valid. |
38 SerializedHandle TakeHandleOfTypeAtIndex(size_t index, | 38 SerializedHandle TakeHandleOfTypeAtIndex(size_t index, |
39 SerializedHandle::Type type) const; | 39 SerializedHandle::Type type) const; |
40 | 40 |
41 // Helper functions to return shared memory or socket handles passed in the | 41 // Helper functions to return shared memory, socket or file handles passed in |
42 // params struct. | 42 // the params struct. |
43 // If the index has a valid handle of the given type, it will be placed in the | 43 // If the index has a valid handle of the given type, it will be placed in the |
44 // output parameter, the corresponding slot in the list will be set to an | 44 // output parameter, the corresponding slot in the list will be set to an |
45 // invalid handle, and the function will return true. If the handle doesn't | 45 // invalid handle, and the function will return true. If the handle doesn't |
46 // exist or is a different type, the functions will return false and the | 46 // exist or is a different type, the functions will return false and the |
47 // output parameter will be untouched. | 47 // output parameter will be untouched. |
48 // | 48 // |
49 // Note: 1) the handle could still be a "null" or invalid handle of the right | 49 // Note: 1) the handle could still be a "null" or invalid handle of the right |
50 // type and the functions will succeed. | 50 // type and the functions will succeed. |
51 // 2) the caller is responsible for closing the returned handle, if it | 51 // 2) the caller is responsible for closing the returned handle, if it |
52 // is valid. | 52 // is valid. |
53 bool TakeSharedMemoryHandleAtIndex(size_t index, | 53 bool TakeSharedMemoryHandleAtIndex(size_t index, |
54 base::SharedMemoryHandle* handle) const; | 54 base::SharedMemoryHandle* handle) const; |
55 bool TakeSocketHandleAtIndex(size_t index, | 55 bool TakeSocketHandleAtIndex(size_t index, |
56 IPC::PlatformFileForTransit* handle) const; | 56 IPC::PlatformFileForTransit* handle) const; |
| 57 bool TakeFileHandleAtIndex(size_t index, |
| 58 IPC::PlatformFileForTransit* handle) const; |
57 void TakeAllSharedMemoryHandles( | 59 void TakeAllSharedMemoryHandles( |
58 std::vector<base::SharedMemoryHandle>* handles) const; | 60 std::vector<base::SharedMemoryHandle>* handles) const; |
59 | 61 |
60 // Appends the given handle to the list of handles sent with the call or | 62 // Appends the given handle to the list of handles sent with the call or |
61 // reply. | 63 // reply. |
62 void AppendHandle(const SerializedHandle& handle) const; | 64 void AppendHandle(const SerializedHandle& handle) const; |
63 | 65 |
64 protected: | 66 protected: |
65 ResourceMessageParams(); | 67 ResourceMessageParams(); |
66 ResourceMessageParams(PP_Resource resource, int32_t sequence); | 68 ResourceMessageParams(PP_Resource resource, int32_t sequence); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { | 186 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { |
185 return r->Deserialize(m, iter); | 187 return r->Deserialize(m, iter); |
186 } | 188 } |
187 static void Log(const param_type& p, std::string* l) { | 189 static void Log(const param_type& p, std::string* l) { |
188 } | 190 } |
189 }; | 191 }; |
190 | 192 |
191 } // namespace IPC | 193 } // namespace IPC |
192 | 194 |
193 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ | 195 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ |
OLD | NEW |