| 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, socket or file handles passed in | 41 // Helper functions to return shared memory or socket handles passed in the |
| 42 // the params struct. | 42 // 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; | |
| 59 void TakeAllSharedMemoryHandles( | 57 void TakeAllSharedMemoryHandles( |
| 60 std::vector<base::SharedMemoryHandle>* handles) const; | 58 std::vector<base::SharedMemoryHandle>* handles) const; |
| 61 | 59 |
| 62 // Appends the given handle to the list of handles sent with the call or | 60 // Appends the given handle to the list of handles sent with the call or |
| 63 // reply. | 61 // reply. |
| 64 void AppendHandle(const SerializedHandle& handle) const; | 62 void AppendHandle(const SerializedHandle& handle) const; |
| 65 | 63 |
| 66 protected: | 64 protected: |
| 67 ResourceMessageParams(); | 65 ResourceMessageParams(); |
| 68 ResourceMessageParams(PP_Resource resource, int32_t sequence); | 66 ResourceMessageParams(PP_Resource resource, int32_t sequence); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { | 183 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { |
| 186 return r->Deserialize(m, iter); | 184 return r->Deserialize(m, iter); |
| 187 } | 185 } |
| 188 static void Log(const param_type& p, std::string* l) { | 186 static void Log(const param_type& p, std::string* l) { |
| 189 } | 187 } |
| 190 }; | 188 }; |
| 191 | 189 |
| 192 } // namespace IPC | 190 } // namespace IPC |
| 193 | 191 |
| 194 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ | 192 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_PARAMS_H_ |
| OLD | NEW |