| 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 "base/numerics/safe_conversions.h" |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 8 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 #include "gpu/command_buffer/common/command_buffer.h" | 9 #include "gpu/command_buffer/common/command_buffer.h" |
| 9 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/proxy/enter_proxy.h" | 11 #include "ppapi/proxy/enter_proxy.h" |
| 11 #include "ppapi/proxy/plugin_dispatcher.h" | 12 #include "ppapi/proxy/plugin_dispatcher.h" |
| 12 #include "ppapi/proxy/ppapi_command_buffer_proxy.h" | 13 #include "ppapi/proxy/ppapi_command_buffer_proxy.h" |
| 13 #include "ppapi/proxy/ppapi_messages.h" | 14 #include "ppapi/proxy/ppapi_messages.h" |
| 14 #include "ppapi/shared_impl/ppapi_globals.h" | 15 #include "ppapi/shared_impl/ppapi_globals.h" |
| 15 #include "ppapi/thunk/enter.h" | 16 #include "ppapi/thunk/enter.h" |
| 16 #include "ppapi/thunk/resource_creation_api.h" | 17 #include "ppapi/thunk/resource_creation_api.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if (enter.succeeded()) { | 309 if (enter.succeeded()) { |
| 309 scoped_refptr<gpu::Buffer> buffer = | 310 scoped_refptr<gpu::Buffer> buffer = |
| 310 enter.object()->CreateTransferBuffer(size, id); | 311 enter.object()->CreateTransferBuffer(size, id); |
| 311 if (!buffer.get()) | 312 if (!buffer.get()) |
| 312 return; | 313 return; |
| 313 gpu::SharedMemoryBufferBacking* backing = | 314 gpu::SharedMemoryBufferBacking* backing = |
| 314 static_cast<gpu::SharedMemoryBufferBacking*>(buffer->backing()); | 315 static_cast<gpu::SharedMemoryBufferBacking*>(buffer->backing()); |
| 315 DCHECK(backing && backing->shared_memory()); | 316 DCHECK(backing && backing->shared_memory()); |
| 316 transfer_buffer->set_shmem( | 317 transfer_buffer->set_shmem( |
| 317 TransportSHMHandle(dispatcher(), backing->shared_memory()->handle()), | 318 TransportSHMHandle(dispatcher(), backing->shared_memory()->handle()), |
| 318 buffer->size()); | 319 base::checked_cast<uint32_t>(buffer->size())); |
| 319 } else { | 320 } else { |
| 320 *id = -1; | 321 *id = -1; |
| 321 } | 322 } |
| 322 } | 323 } |
| 323 | 324 |
| 324 void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer( | 325 void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer( |
| 325 const HostResource& context, | 326 const HostResource& context, |
| 326 int32 id) { | 327 int32 id) { |
| 327 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); | 328 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); |
| 328 if (enter.succeeded()) | 329 if (enter.succeeded()) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( | 374 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( |
| 374 int32_t result, | 375 int32_t result, |
| 375 const HostResource& context) { | 376 const HostResource& context) { |
| 376 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( | 377 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( |
| 377 API_ID_PPB_GRAPHICS_3D, context, result)); | 378 API_ID_PPB_GRAPHICS_3D, context, result)); |
| 378 } | 379 } |
| 379 #endif // !defined(OS_NACL) | 380 #endif // !defined(OS_NACL) |
| 380 | 381 |
| 381 } // namespace proxy | 382 } // namespace proxy |
| 382 } // namespace ppapi | 383 } // namespace ppapi |
| OLD | NEW |