| 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 #include "ppapi/proxy/ppb_buffer_proxy.h" | 5 #include "ppapi/proxy/ppb_buffer_proxy.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // static | 71 // static |
| 72 PP_Resource PPB_Buffer_Proxy::CreateProxyResource(PP_Instance instance, | 72 PP_Resource PPB_Buffer_Proxy::CreateProxyResource(PP_Instance instance, |
| 73 uint32_t size) { | 73 uint32_t size) { |
| 74 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 74 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 75 if (!dispatcher) | 75 if (!dispatcher) |
| 76 return 0; | 76 return 0; |
| 77 | 77 |
| 78 HostResource result; | 78 HostResource result; |
| 79 base::SharedMemoryHandle shm_handle = base::SharedMemory::NULLHandle(); | 79 base::SharedMemoryHandle shm_handle = base::SharedMemory::NULLHandle(); |
| 80 dispatcher->Send(new PpapiHostMsg_PPBBuffer_Create( | 80 dispatcher->Send(new PpapiHostMsg_PPBBuffer_Create( |
| 81 INTERFACE_ID_PPB_BUFFER, instance, size, | 81 API_ID_PPB_BUFFER, instance, size, |
| 82 &result, &shm_handle)); | 82 &result, &shm_handle)); |
| 83 if (result.is_null() || !base::SharedMemory::IsHandleValid(shm_handle)) | 83 if (result.is_null() || !base::SharedMemory::IsHandleValid(shm_handle)) |
| 84 return 0; | 84 return 0; |
| 85 | 85 |
| 86 return AddProxyResource(result, shm_handle, size); | 86 return AddProxyResource(result, shm_handle, size); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // static | 89 // static |
| 90 PP_Resource PPB_Buffer_Proxy::AddProxyResource( | 90 PP_Resource PPB_Buffer_Proxy::AddProxyResource( |
| 91 const HostResource& resource, | 91 const HostResource& resource, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 #elif defined(OS_POSIX) | 141 #elif defined(OS_POSIX) |
| 142 local_fd; | 142 local_fd; |
| 143 #else | 143 #else |
| 144 #error Not implemented. | 144 #error Not implemented. |
| 145 #endif | 145 #endif |
| 146 *result_shm_handle = dispatcher->ShareHandleWithRemote(platform_file, false); | 146 *result_shm_handle = dispatcher->ShareHandleWithRemote(platform_file, false); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace proxy | 149 } // namespace proxy |
| 150 } // namespace ppapi | 150 } // namespace ppapi |
| OLD | NEW |