| 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_context_3d_proxy.h" | 5 #include "ppapi/proxy/ppb_context_3d_proxy.h" |
| 6 | 6 |
| 7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
| 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| 11 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
| 12 #include "ppapi/c/dev/ppb_context_3d_dev.h" | 12 #include "ppapi/c/dev/ppb_context_3d_dev.h" |
| 13 #include "ppapi/c/dev/ppb_context_3d_trusted_dev.h" | 13 #include "ppapi/c/dev/ppb_context_3d_trusted_dev.h" |
| 14 #include "ppapi/proxy/enter_proxy.h" | 14 #include "ppapi/proxy/enter_proxy.h" |
| 15 #include "ppapi/proxy/plugin_dispatcher.h" | 15 #include "ppapi/proxy/plugin_dispatcher.h" |
| 16 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
| 17 #include "ppapi/proxy/ppb_surface_3d_proxy.h" | 17 #include "ppapi/proxy/ppb_surface_3d_proxy.h" |
| 18 #include "ppapi/thunk/enter.h" | 18 #include "ppapi/thunk/enter.h" |
| 19 #include "ppapi/thunk/resource_creation_api.h" | 19 #include "ppapi/thunk/resource_creation_api.h" |
| 20 #include "ppapi/thunk/thunk.h" | 20 #include "ppapi/thunk/thunk.h" |
| 21 | 21 |
| 22 using ppapi::HostResource; | |
| 23 using ppapi::Resource; | |
| 24 using ppapi::thunk::EnterFunctionNoLock; | 22 using ppapi::thunk::EnterFunctionNoLock; |
| 25 using ppapi::thunk::EnterResourceNoLock; | 23 using ppapi::thunk::EnterResourceNoLock; |
| 26 using ppapi::thunk::PPB_Context3D_API; | 24 using ppapi::thunk::PPB_Context3D_API; |
| 27 using ppapi::thunk::PPB_Surface3D_API; | 25 using ppapi::thunk::PPB_Surface3D_API; |
| 28 using ppapi::thunk::ResourceCreationAPI; | 26 using ppapi::thunk::ResourceCreationAPI; |
| 29 | 27 |
| 30 namespace pp { | 28 namespace ppapi { |
| 31 namespace proxy { | 29 namespace proxy { |
| 32 | 30 |
| 33 namespace { | 31 namespace { |
| 34 | 32 |
| 35 base::SharedMemoryHandle TransportSHMHandleFromInt(Dispatcher* dispatcher, | 33 base::SharedMemoryHandle TransportSHMHandleFromInt(Dispatcher* dispatcher, |
| 36 int shm_handle) { | 34 int shm_handle) { |
| 37 // TODO(piman): Change trusted interface to return a PP_FileHandle, those | 35 // TODO(piman): Change trusted interface to return a PP_FileHandle, those |
| 38 // casts are ugly. | 36 // casts are ugly. |
| 39 base::PlatformFile source = | 37 base::PlatformFile source = |
| 40 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 const void* target_interface) | 525 const void* target_interface) |
| 528 : InterfaceProxy(dispatcher, target_interface) { | 526 : InterfaceProxy(dispatcher, target_interface) { |
| 529 } | 527 } |
| 530 | 528 |
| 531 PPB_Context3D_Proxy::~PPB_Context3D_Proxy() { | 529 PPB_Context3D_Proxy::~PPB_Context3D_Proxy() { |
| 532 } | 530 } |
| 533 | 531 |
| 534 // static | 532 // static |
| 535 const InterfaceProxy::Info* PPB_Context3D_Proxy::GetInfo() { | 533 const InterfaceProxy::Info* PPB_Context3D_Proxy::GetInfo() { |
| 536 static const Info info = { | 534 static const Info info = { |
| 537 ::ppapi::thunk::GetPPB_Context3D_Thunk(), | 535 thunk::GetPPB_Context3D_Thunk(), |
| 538 PPB_CONTEXT_3D_DEV_INTERFACE, | 536 PPB_CONTEXT_3D_DEV_INTERFACE, |
| 539 INTERFACE_ID_PPB_CONTEXT_3D, | 537 INTERFACE_ID_PPB_CONTEXT_3D, |
| 540 false, | 538 false, |
| 541 &CreateContext3DProxy, | 539 &CreateContext3DProxy, |
| 542 }; | 540 }; |
| 543 return &info; | 541 return &info; |
| 544 } | 542 } |
| 545 | 543 |
| 546 // static | 544 // static |
| 547 const InterfaceProxy::Info* PPB_Context3D_Proxy::GetTextureMappingInfo() { | 545 const InterfaceProxy::Info* PPB_Context3D_Proxy::GetTextureMappingInfo() { |
| 548 static const Info info = { | 546 static const Info info = { |
| 549 ::ppapi::thunk::GetPPB_GLESChromiumTextureMapping_Thunk(), | 547 thunk::GetPPB_GLESChromiumTextureMapping_Thunk(), |
| 550 PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE, | 548 PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE, |
| 551 INTERFACE_ID_NONE, // CONTEXT_3D is the canonical one. | 549 INTERFACE_ID_NONE, // CONTEXT_3D is the canonical one. |
| 552 false, | 550 false, |
| 553 &CreateContext3DProxy, | 551 &CreateContext3DProxy, |
| 554 }; | 552 }; |
| 555 return &info; | 553 return &info; |
| 556 } | 554 } |
| 557 | 555 |
| 558 // static | 556 // static |
| 559 PP_Resource PPB_Context3D_Proxy::Create(PP_Instance instance, | 557 PP_Resource PPB_Context3D_Proxy::Create(PP_Instance instance, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 int shm_handle = 0; | 721 int shm_handle = 0; |
| 724 uint32_t shm_size = 0; | 722 uint32_t shm_size = 0; |
| 725 if (enter.succeeded() && | 723 if (enter.succeeded() && |
| 726 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { | 724 enter.object()->GetTransferBuffer(id, &shm_handle, &shm_size)) { |
| 727 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); | 725 *transfer_buffer = TransportSHMHandleFromInt(dispatcher(), shm_handle); |
| 728 *size = shm_size; | 726 *size = shm_size; |
| 729 } | 727 } |
| 730 } | 728 } |
| 731 | 729 |
| 732 } // namespace proxy | 730 } // namespace proxy |
| 733 } // namespace pp | 731 } // namespace ppapi |
| OLD | NEW |