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 "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 const HostResource& context, | 309 const HostResource& context, |
310 int32 id) { | 310 int32 id) { |
311 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | 311 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); |
312 if (enter.succeeded()) | 312 if (enter.succeeded()) |
313 enter.object()->DestroyTransferBuffer(id); | 313 enter.object()->DestroyTransferBuffer(id); |
314 } | 314 } |
315 | 315 |
316 void PPB_Graphics3D_Proxy::OnMsgGetTransferBuffer( | 316 void PPB_Graphics3D_Proxy::OnMsgGetTransferBuffer( |
317 const HostResource& context, | 317 const HostResource& context, |
318 int32 id, | 318 int32 id, |
319 base::SharedMemoryHandle* transfer_buffer, | 319 ppapi::proxy::SerializedHandle* transfer_buffer) { |
320 uint32* size) { | 320 transfer_buffer->set_null_shmem(); |
321 *transfer_buffer = base::SharedMemory::NULLHandle(); | |
322 *size = 0; | |
323 | 321 |
324 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | 322 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); |
325 int shm_handle = 0; | 323 int shm_handle = 0; |
326 uint32_t shm_size = 0; | 324 uint32_t shm_size = 0; |
327 if (enter.succeeded() && | 325 if (enter.succeeded() && |
328 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { | 326 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { |
329 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); | 327 transfer_buffer->set_shmem( |
330 *size = shm_size; | 328 TransportSHMHandleFromInt(dispatcher(), shm_handle), |
| 329 shm_size); |
331 } | 330 } |
332 } | 331 } |
333 | 332 |
334 void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) { | 333 void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) { |
335 EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter( | 334 EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter( |
336 context, callback_factory_, | 335 context, callback_factory_, |
337 &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context); | 336 &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context); |
338 if (enter.succeeded()) | 337 if (enter.succeeded()) |
339 enter.SetResult(enter.object()->SwapBuffers(enter.callback())); | 338 enter.SetResult(enter.object()->SwapBuffers(enter.callback())); |
340 } | 339 } |
341 | 340 |
342 void PPB_Graphics3D_Proxy::OnMsgSwapBuffersACK(const HostResource& resource, | 341 void PPB_Graphics3D_Proxy::OnMsgSwapBuffersACK(const HostResource& resource, |
343 int32_t pp_error) { | 342 int32_t pp_error) { |
344 EnterPluginFromHostResource<PPB_Graphics3D_API> enter(resource); | 343 EnterPluginFromHostResource<PPB_Graphics3D_API> enter(resource); |
345 if (enter.succeeded()) | 344 if (enter.succeeded()) |
346 static_cast<Graphics3D*>(enter.object())->SwapBuffersACK(pp_error); | 345 static_cast<Graphics3D*>(enter.object())->SwapBuffersACK(pp_error); |
347 } | 346 } |
348 | 347 |
349 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( | 348 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( |
350 int32_t result, | 349 int32_t result, |
351 const HostResource& context) { | 350 const HostResource& context) { |
352 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( | 351 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( |
353 API_ID_PPB_GRAPHICS_3D, context, result)); | 352 API_ID_PPB_GRAPHICS_3D, context, result)); |
354 } | 353 } |
355 | 354 |
356 } // namespace proxy | 355 } // namespace proxy |
357 } // namespace ppapi | 356 } // namespace ppapi |
358 | 357 |
OLD | NEW |