| 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 #include "ppapi/proxy/ppapi_command_buffer_proxy.h" | 5 #include "ppapi/proxy/ppapi_command_buffer_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/proxy/ppapi_messages.h" | 7 #include "ppapi/proxy/ppapi_messages.h" |
| 8 #include "ppapi/proxy/proxy_channel.h" | 8 #include "ppapi/proxy/proxy_channel.h" |
| 9 #include "ppapi/shared_impl/api_id.h" | 9 #include "ppapi/shared_impl/api_id.h" |
| 10 #include "ppapi/shared_impl/host_resource.h" | 10 #include "ppapi/shared_impl/host_resource.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 *id = -1; | 115 *id = -1; |
| 116 | 116 |
| 117 if (last_state_.error != gpu::error::kNoError) | 117 if (last_state_.error != gpu::error::kNoError) |
| 118 return NULL; | 118 return NULL; |
| 119 | 119 |
| 120 // Assuming we are in the renderer process, the service is responsible for | 120 // Assuming we are in the renderer process, the service is responsible for |
| 121 // duplicating the handle. This might not be true for NaCl. | 121 // duplicating the handle. This might not be true for NaCl. |
| 122 ppapi::proxy::SerializedHandle handle( | 122 ppapi::proxy::SerializedHandle handle( |
| 123 ppapi::proxy::SerializedHandle::SHARED_MEMORY); | 123 ppapi::proxy::SerializedHandle::SHARED_MEMORY); |
| 124 if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer( | 124 if (!Send(new PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer( |
| 125 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, size, id, &handle))) { | 125 ppapi::API_ID_PPB_GRAPHICS_3D, resource_, |
| 126 static_cast<uint32_t>(size), id, &handle))) { |
| 126 return NULL; | 127 return NULL; |
| 127 } | 128 } |
| 128 | 129 |
| 129 if (*id <= 0 || !handle.is_shmem()) | 130 if (*id <= 0 || !handle.is_shmem()) |
| 130 return NULL; | 131 return NULL; |
| 131 | 132 |
| 132 scoped_ptr<base::SharedMemory> shared_memory( | 133 scoped_ptr<base::SharedMemory> shared_memory( |
| 133 new base::SharedMemory(handle.shmem(), false)); | 134 new base::SharedMemory(handle.shmem(), false)); |
| 134 | 135 |
| 135 // Map the shared memory on demand. | 136 // Map the shared memory on demand. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 shared_state()->Read(&last_state_); | 255 shared_state()->Read(&last_state_); |
| 255 } | 256 } |
| 256 | 257 |
| 257 gpu::CommandBufferSharedState* PpapiCommandBufferProxy::shared_state() const { | 258 gpu::CommandBufferSharedState* PpapiCommandBufferProxy::shared_state() const { |
| 258 return reinterpret_cast<gpu::CommandBufferSharedState*>( | 259 return reinterpret_cast<gpu::CommandBufferSharedState*>( |
| 259 shared_state_shm_->memory()); | 260 shared_state_shm_->memory()); |
| 260 } | 261 } |
| 261 | 262 |
| 262 } // namespace proxy | 263 } // namespace proxy |
| 263 } // namespace ppapi | 264 } // namespace ppapi |
| OLD | NEW |