| 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/ppb_graphics_3d_proxy.h" | 5 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 #include "gpu/command_buffer/common/command_buffer.h" | 8 #include "gpu/command_buffer/common/command_buffer.h" |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/proxy/enter_proxy.h" | 10 #include "ppapi/proxy/enter_proxy.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 gpu::CommandBuffer::State Graphics3D::GetState() { | 79 gpu::CommandBuffer::State Graphics3D::GetState() { |
| 80 return GetErrorState(); | 80 return GetErrorState(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 PP_Bool Graphics3D::Flush(int32_t put_offset) { | 83 PP_Bool Graphics3D::Flush(int32_t put_offset) { |
| 84 return PP_FALSE; | 84 return PP_FALSE; |
| 85 } | 85 } |
| 86 | 86 |
| 87 int32_t Graphics3D::CreateTransferBuffer(uint32_t size) { | 87 int32_t Graphics3D::CreateTransferBuffer(uint32_t size, |
| 88 int* shm_handle, |
| 89 uint32_t* shm_size) { |
| 88 return PP_FALSE; | 90 return PP_FALSE; |
| 89 } | 91 } |
| 90 | 92 |
| 91 PP_Bool Graphics3D::DestroyTransferBuffer(int32_t id) { | 93 PP_Bool Graphics3D::DestroyTransferBuffer(int32_t id) { |
| 92 return PP_FALSE; | 94 return PP_FALSE; |
| 93 } | 95 } |
| 94 | 96 |
| 95 PP_Bool Graphics3D::GetTransferBuffer(int32_t id, | |
| 96 int* shm_handle, | |
| 97 uint32_t* shm_size) { | |
| 98 return PP_FALSE; | |
| 99 } | |
| 100 | |
| 101 gpu::CommandBuffer::State Graphics3D::WaitForTokenInRange(int32_t start, | 97 gpu::CommandBuffer::State Graphics3D::WaitForTokenInRange(int32_t start, |
| 102 int32_t end) { | 98 int32_t end) { |
| 103 return GetErrorState(); | 99 return GetErrorState(); |
| 104 } | 100 } |
| 105 | 101 |
| 106 gpu::CommandBuffer::State Graphics3D::WaitForGetOffsetInRange(int32_t start, | 102 gpu::CommandBuffer::State Graphics3D::WaitForGetOffsetInRange(int32_t start, |
| 107 int32_t end) { | 103 int32_t end) { |
| 108 return GetErrorState(); | 104 return GetErrorState(); |
| 109 } | 105 } |
| 110 | 106 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 OnMsgGetState) | 192 OnMsgGetState) |
| 197 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForTokenInRange, | 193 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForTokenInRange, |
| 198 OnMsgWaitForTokenInRange) | 194 OnMsgWaitForTokenInRange) |
| 199 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForGetOffsetInRange, | 195 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForGetOffsetInRange, |
| 200 OnMsgWaitForGetOffsetInRange) | 196 OnMsgWaitForGetOffsetInRange) |
| 201 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush, OnMsgAsyncFlush) | 197 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush, OnMsgAsyncFlush) |
| 202 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer, | 198 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer, |
| 203 OnMsgCreateTransferBuffer) | 199 OnMsgCreateTransferBuffer) |
| 204 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer, | 200 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer, |
| 205 OnMsgDestroyTransferBuffer) | 201 OnMsgDestroyTransferBuffer) |
| 206 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer, | |
| 207 OnMsgGetTransferBuffer) | |
| 208 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers, | 202 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers, |
| 209 OnMsgSwapBuffers) | 203 OnMsgSwapBuffers) |
| 210 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_InsertSyncPoint, | 204 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_InsertSyncPoint, |
| 211 OnMsgInsertSyncPoint) | 205 OnMsgInsertSyncPoint) |
| 212 #endif // !defined(OS_NACL) | 206 #endif // !defined(OS_NACL) |
| 213 | 207 |
| 214 IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK, | 208 IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK, |
| 215 OnMsgSwapBuffersACK) | 209 OnMsgSwapBuffersACK) |
| 216 IPC_MESSAGE_UNHANDLED(handled = false) | 210 IPC_MESSAGE_UNHANDLED(handled = false) |
| 217 | 211 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 void PPB_Graphics3D_Proxy::OnMsgAsyncFlush(const HostResource& context, | 288 void PPB_Graphics3D_Proxy::OnMsgAsyncFlush(const HostResource& context, |
| 295 int32 put_offset) { | 289 int32 put_offset) { |
| 296 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | 290 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); |
| 297 if (enter.succeeded()) | 291 if (enter.succeeded()) |
| 298 enter.object()->Flush(put_offset); | 292 enter.object()->Flush(put_offset); |
| 299 } | 293 } |
| 300 | 294 |
| 301 void PPB_Graphics3D_Proxy::OnMsgCreateTransferBuffer( | 295 void PPB_Graphics3D_Proxy::OnMsgCreateTransferBuffer( |
| 302 const HostResource& context, | 296 const HostResource& context, |
| 303 uint32 size, | 297 uint32 size, |
| 304 int32* id) { | 298 int32* id, |
| 299 ppapi::proxy::SerializedHandle* transfer_buffer) { |
| 300 transfer_buffer->set_null_shmem(); |
| 305 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | 301 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); |
| 306 if (enter.succeeded()) | 302 if (enter.succeeded()) { |
| 307 *id = enter.object()->CreateTransferBuffer(size); | 303 int shm_handle = 0; |
| 308 else | 304 uint32_t shm_size = 0; |
| 305 *id = enter.object()->CreateTransferBuffer(size, &shm_handle, &shm_size); |
| 306 transfer_buffer->set_shmem( |
| 307 TransportSHMHandleFromInt(dispatcher(), shm_handle), |
| 308 shm_size); |
| 309 } else { |
| 309 *id = -1; | 310 *id = -1; |
| 311 } |
| 310 } | 312 } |
| 311 | 313 |
| 312 void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer( | 314 void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer( |
| 313 const HostResource& context, | 315 const HostResource& context, |
| 314 int32 id) { | 316 int32 id) { |
| 315 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | 317 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); |
| 316 if (enter.succeeded()) | 318 if (enter.succeeded()) |
| 317 enter.object()->DestroyTransferBuffer(id); | 319 enter.object()->DestroyTransferBuffer(id); |
| 318 } | 320 } |
| 319 | 321 |
| 320 void PPB_Graphics3D_Proxy::OnMsgGetTransferBuffer( | |
| 321 const HostResource& context, | |
| 322 int32 id, | |
| 323 ppapi::proxy::SerializedHandle* transfer_buffer) { | |
| 324 transfer_buffer->set_null_shmem(); | |
| 325 | |
| 326 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | |
| 327 int shm_handle = 0; | |
| 328 uint32_t shm_size = 0; | |
| 329 if (enter.succeeded() && | |
| 330 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { | |
| 331 transfer_buffer->set_shmem( | |
| 332 TransportSHMHandleFromInt(dispatcher(), shm_handle), | |
| 333 shm_size); | |
| 334 } | |
| 335 } | |
| 336 | |
| 337 void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) { | 322 void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) { |
| 338 EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter( | 323 EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter( |
| 339 context, callback_factory_, | 324 context, callback_factory_, |
| 340 &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context); | 325 &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context); |
| 341 if (enter.succeeded()) | 326 if (enter.succeeded()) |
| 342 enter.SetResult(enter.object()->SwapBuffers(enter.callback())); | 327 enter.SetResult(enter.object()->SwapBuffers(enter.callback())); |
| 343 } | 328 } |
| 344 | 329 |
| 345 void PPB_Graphics3D_Proxy::OnMsgInsertSyncPoint(const HostResource& context, | 330 void PPB_Graphics3D_Proxy::OnMsgInsertSyncPoint(const HostResource& context, |
| 346 uint32* sync_point) { | 331 uint32* sync_point) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 363 int32_t result, | 348 int32_t result, |
| 364 const HostResource& context) { | 349 const HostResource& context) { |
| 365 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( | 350 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( |
| 366 API_ID_PPB_GRAPHICS_3D, context, result)); | 351 API_ID_PPB_GRAPHICS_3D, context, result)); |
| 367 } | 352 } |
| 368 #endif // !defined(OS_NACL) | 353 #endif // !defined(OS_NACL) |
| 369 | 354 |
| 370 } // namespace proxy | 355 } // namespace proxy |
| 371 } // namespace ppapi | 356 } // namespace ppapi |
| 372 | 357 |
| OLD | NEW |