| 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 #ifndef PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ |
| 6 #define PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <vector> | 10 #include <vector> |
| 9 | 11 |
| 12 #include "base/macros.h" |
| 10 #include "gpu/command_buffer/common/command_buffer.h" | 13 #include "gpu/command_buffer/common/command_buffer.h" |
| 11 #include "ppapi/c/pp_graphics_3d.h" | 14 #include "ppapi/c/pp_graphics_3d.h" |
| 12 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
| 13 #include "ppapi/proxy/interface_proxy.h" | 16 #include "ppapi/proxy/interface_proxy.h" |
| 14 #include "ppapi/proxy/ppapi_proxy_export.h" | 17 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 15 #include "ppapi/proxy/proxy_completion_callback_factory.h" | 18 #include "ppapi/proxy/proxy_completion_callback_factory.h" |
| 16 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 19 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
| 17 #include "ppapi/shared_impl/resource.h" | 20 #include "ppapi/shared_impl/resource.h" |
| 18 #include "ppapi/utility/completion_callback_factory.h" | 21 #include "ppapi/utility/completion_callback_factory.h" |
| 19 | 22 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 37 | 40 |
| 38 bool Init(gpu::gles2::GLES2Implementation* share_gles2, | 41 bool Init(gpu::gles2::GLES2Implementation* share_gles2, |
| 39 const gpu::Capabilities& capabilities, | 42 const gpu::Capabilities& capabilities, |
| 40 const SerializedHandle& shared_state, | 43 const SerializedHandle& shared_state, |
| 41 uint64_t command_buffer_id); | 44 uint64_t command_buffer_id); |
| 42 | 45 |
| 43 // Graphics3DTrusted API. These are not implemented in the proxy. | 46 // Graphics3DTrusted API. These are not implemented in the proxy. |
| 44 PP_Bool SetGetBuffer(int32_t shm_id) override; | 47 PP_Bool SetGetBuffer(int32_t shm_id) override; |
| 45 PP_Bool Flush(int32_t put_offset) override; | 48 PP_Bool Flush(int32_t put_offset) override; |
| 46 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, | 49 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, |
| 47 int32* id) override; | 50 int32_t* id) override; |
| 48 PP_Bool DestroyTransferBuffer(int32_t id) override; | 51 PP_Bool DestroyTransferBuffer(int32_t id) override; |
| 49 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, | 52 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, |
| 50 int32_t end) override; | 53 int32_t end) override; |
| 51 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, | 54 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, |
| 52 int32_t end) override; | 55 int32_t end) override; |
| 53 uint32_t InsertSyncPoint() override; | 56 uint32_t InsertSyncPoint() override; |
| 54 uint32_t InsertFutureSyncPoint() override; | 57 uint32_t InsertFutureSyncPoint() override; |
| 55 void RetireSyncPoint(uint32_t sync_point) override; | 58 void RetireSyncPoint(uint32_t sync_point) override; |
| 56 | 59 |
| 57 private: | 60 private: |
| 58 // PPB_Graphics3D_Shared overrides. | 61 // PPB_Graphics3D_Shared overrides. |
| 59 gpu::CommandBuffer* GetCommandBuffer() override; | 62 gpu::CommandBuffer* GetCommandBuffer() override; |
| 60 gpu::GpuControl* GetGpuControl() override; | 63 gpu::GpuControl* GetGpuControl() override; |
| 61 int32 DoSwapBuffers() override; | 64 int32_t DoSwapBuffers() override; |
| 62 | 65 |
| 63 scoped_ptr<PpapiCommandBufferProxy> command_buffer_; | 66 scoped_ptr<PpapiCommandBufferProxy> command_buffer_; |
| 64 | 67 |
| 65 DISALLOW_COPY_AND_ASSIGN(Graphics3D); | 68 DISALLOW_COPY_AND_ASSIGN(Graphics3D); |
| 66 }; | 69 }; |
| 67 | 70 |
| 68 class PPB_Graphics3D_Proxy : public InterfaceProxy { | 71 class PPB_Graphics3D_Proxy : public InterfaceProxy { |
| 69 public: | 72 public: |
| 70 explicit PPB_Graphics3D_Proxy(Dispatcher* dispatcher); | 73 explicit PPB_Graphics3D_Proxy(Dispatcher* dispatcher); |
| 71 ~PPB_Graphics3D_Proxy(); | 74 ~PPB_Graphics3D_Proxy(); |
| 72 | 75 |
| 73 static PP_Resource CreateProxyResource( | 76 static PP_Resource CreateProxyResource( |
| 74 PP_Instance instance, | 77 PP_Instance instance, |
| 75 PP_Resource share_context, | 78 PP_Resource share_context, |
| 76 const int32_t* attrib_list); | 79 const int32_t* attrib_list); |
| 77 | 80 |
| 78 // InterfaceProxy implementation. | 81 // InterfaceProxy implementation. |
| 79 bool OnMessageReceived(const IPC::Message& msg) override; | 82 bool OnMessageReceived(const IPC::Message& msg) override; |
| 80 | 83 |
| 81 static const ApiID kApiID = API_ID_PPB_GRAPHICS_3D; | 84 static const ApiID kApiID = API_ID_PPB_GRAPHICS_3D; |
| 82 | 85 |
| 83 private: | 86 private: |
| 84 void OnMsgCreate(PP_Instance instance, | 87 void OnMsgCreate(PP_Instance instance, |
| 85 HostResource share_context, | 88 HostResource share_context, |
| 86 const std::vector<int32_t>& attribs, | 89 const std::vector<int32_t>& attribs, |
| 87 HostResource* result, | 90 HostResource* result, |
| 88 gpu::Capabilities* capabilities, | 91 gpu::Capabilities* capabilities, |
| 89 SerializedHandle* handle, | 92 SerializedHandle* handle, |
| 90 uint64_t* command_buffer_id); | 93 uint64_t* command_buffer_id); |
| 91 void OnMsgSetGetBuffer(const HostResource& context, | 94 void OnMsgSetGetBuffer(const HostResource& context, int32_t id); |
| 92 int32 id); | |
| 93 void OnMsgWaitForTokenInRange(const HostResource& context, | 95 void OnMsgWaitForTokenInRange(const HostResource& context, |
| 94 int32 start, | 96 int32_t start, |
| 95 int32 end, | 97 int32_t end, |
| 96 gpu::CommandBuffer::State* state, | 98 gpu::CommandBuffer::State* state, |
| 97 bool* success); | 99 bool* success); |
| 98 void OnMsgWaitForGetOffsetInRange(const HostResource& context, | 100 void OnMsgWaitForGetOffsetInRange(const HostResource& context, |
| 99 int32 start, | 101 int32_t start, |
| 100 int32 end, | 102 int32_t end, |
| 101 gpu::CommandBuffer::State* state, | 103 gpu::CommandBuffer::State* state, |
| 102 bool* success); | 104 bool* success); |
| 103 void OnMsgAsyncFlush(const HostResource& context, int32 put_offset); | 105 void OnMsgAsyncFlush(const HostResource& context, int32_t put_offset); |
| 104 void OnMsgCreateTransferBuffer( | 106 void OnMsgCreateTransferBuffer( |
| 105 const HostResource& context, | 107 const HostResource& context, |
| 106 uint32 size, | 108 uint32_t size, |
| 107 int32* id, | 109 int32_t* id, |
| 108 ppapi::proxy::SerializedHandle* transfer_buffer); | 110 ppapi::proxy::SerializedHandle* transfer_buffer); |
| 109 void OnMsgDestroyTransferBuffer(const HostResource& context, | 111 void OnMsgDestroyTransferBuffer(const HostResource& context, int32_t id); |
| 110 int32 id); | |
| 111 void OnMsgSwapBuffers(const HostResource& context); | 112 void OnMsgSwapBuffers(const HostResource& context); |
| 112 void OnMsgInsertSyncPoint(const HostResource& context, uint32* sync_point); | 113 void OnMsgInsertSyncPoint(const HostResource& context, uint32_t* sync_point); |
| 113 void OnMsgInsertFutureSyncPoint(const HostResource& context, | 114 void OnMsgInsertFutureSyncPoint(const HostResource& context, |
| 114 uint32* sync_point); | 115 uint32_t* sync_point); |
| 115 void OnMsgRetireSyncPoint(const HostResource& context, uint32 sync_point); | 116 void OnMsgRetireSyncPoint(const HostResource& context, uint32_t sync_point); |
| 116 // Renderer->plugin message handlers. | 117 // Renderer->plugin message handlers. |
| 117 void OnMsgSwapBuffersACK(const HostResource& context, | 118 void OnMsgSwapBuffersACK(const HostResource& context, |
| 118 int32_t pp_error); | 119 int32_t pp_error); |
| 119 | 120 |
| 120 void SendSwapBuffersACKToPlugin(int32_t result, | 121 void SendSwapBuffersACKToPlugin(int32_t result, |
| 121 const HostResource& context); | 122 const HostResource& context); |
| 122 | 123 |
| 123 ProxyCompletionCallbackFactory<PPB_Graphics3D_Proxy> callback_factory_; | 124 ProxyCompletionCallbackFactory<PPB_Graphics3D_Proxy> callback_factory_; |
| 124 | 125 |
| 125 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Proxy); | 126 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Proxy); |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 } // namespace proxy | 129 } // namespace proxy |
| 129 } // namespace ppapi | 130 } // namespace ppapi |
| 130 | 131 |
| 131 #endif // PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ | 132 #endif // PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ |
| 132 | 133 |
| OLD | NEW |