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> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 class HostResource; | 33 class HostResource; |
34 | 34 |
35 namespace proxy { | 35 namespace proxy { |
36 | 36 |
37 class SerializedHandle; | 37 class SerializedHandle; |
38 class PpapiCommandBufferProxy; | 38 class PpapiCommandBufferProxy; |
39 | 39 |
40 class PPAPI_PROXY_EXPORT Graphics3D : public PPB_Graphics3D_Shared { | 40 class PPAPI_PROXY_EXPORT Graphics3D : public PPB_Graphics3D_Shared { |
41 public: | 41 public: |
42 explicit Graphics3D(const HostResource& resource); | 42 Graphics3D(const HostResource& resource, const gfx::Size& size); |
43 ~Graphics3D() override; | 43 ~Graphics3D() override; |
44 | 44 |
45 bool Init(gpu::gles2::GLES2Implementation* share_gles2, | 45 bool Init(gpu::gles2::GLES2Implementation* share_gles2, |
46 const gpu::Capabilities& capabilities, | 46 const gpu::Capabilities& capabilities, |
47 const SerializedHandle& shared_state, | 47 const SerializedHandle& shared_state, |
48 gpu::CommandBufferId command_buffer_id); | 48 gpu::CommandBufferId command_buffer_id); |
49 | 49 |
50 // Graphics3DTrusted API. These are not implemented in the proxy. | 50 // Graphics3DTrusted API. These are not implemented in the proxy. |
51 PP_Bool SetGetBuffer(int32_t shm_id) override; | 51 PP_Bool SetGetBuffer(int32_t shm_id) override; |
52 PP_Bool Flush(int32_t put_offset) override; | 52 PP_Bool Flush(int32_t put_offset) override; |
53 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, | 53 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, |
54 int32_t* id) override; | 54 int32_t* id) override; |
55 PP_Bool DestroyTransferBuffer(int32_t id) override; | 55 PP_Bool DestroyTransferBuffer(int32_t id) override; |
56 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, | 56 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, |
57 int32_t end) override; | 57 int32_t end) override; |
58 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, | 58 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, |
59 int32_t end) override; | 59 int32_t end) override; |
60 void EnsureWorkVisible() override; | 60 void EnsureWorkVisible() override; |
61 void TakeFrontBuffer() override; | 61 void TakeFrontBuffer() override; |
62 | 62 |
63 private: | 63 private: |
64 // PPB_Graphics3D_Shared overrides. | 64 // PPB_Graphics3D_Shared overrides. |
65 gpu::CommandBuffer* GetCommandBuffer() override; | 65 gpu::CommandBuffer* GetCommandBuffer() override; |
66 gpu::GpuControl* GetGpuControl() override; | 66 gpu::GpuControl* GetGpuControl() override; |
67 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token, | 67 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token, |
68 int32_t width, | 68 const gfx::Size& size) override; |
69 int32_t height) override; | |
70 | 69 |
71 std::unique_ptr<PpapiCommandBufferProxy> command_buffer_; | 70 std::unique_ptr<PpapiCommandBufferProxy> command_buffer_; |
72 | 71 |
73 DISALLOW_COPY_AND_ASSIGN(Graphics3D); | 72 DISALLOW_COPY_AND_ASSIGN(Graphics3D); |
74 }; | 73 }; |
75 | 74 |
76 class PPB_Graphics3D_Proxy : public InterfaceProxy { | 75 class PPB_Graphics3D_Proxy : public InterfaceProxy { |
77 public: | 76 public: |
78 explicit PPB_Graphics3D_Proxy(Dispatcher* dispatcher); | 77 explicit PPB_Graphics3D_Proxy(Dispatcher* dispatcher); |
79 ~PPB_Graphics3D_Proxy(); | 78 ~PPB_Graphics3D_Proxy(); |
(...skipping 29 matching lines...) Expand all Loading... |
109 bool* success); | 108 bool* success); |
110 void OnMsgAsyncFlush(const HostResource& context, int32_t put_offset); | 109 void OnMsgAsyncFlush(const HostResource& context, int32_t put_offset); |
111 void OnMsgCreateTransferBuffer( | 110 void OnMsgCreateTransferBuffer( |
112 const HostResource& context, | 111 const HostResource& context, |
113 uint32_t size, | 112 uint32_t size, |
114 int32_t* id, | 113 int32_t* id, |
115 ppapi::proxy::SerializedHandle* transfer_buffer); | 114 ppapi::proxy::SerializedHandle* transfer_buffer); |
116 void OnMsgDestroyTransferBuffer(const HostResource& context, int32_t id); | 115 void OnMsgDestroyTransferBuffer(const HostResource& context, int32_t id); |
117 void OnMsgSwapBuffers(const HostResource& context, | 116 void OnMsgSwapBuffers(const HostResource& context, |
118 const gpu::SyncToken& sync_token, | 117 const gpu::SyncToken& sync_token, |
119 int32_t width, | 118 const gfx::Size& size); |
120 int32_t height); | |
121 void OnMsgTakeFrontBuffer(const HostResource& context); | 119 void OnMsgTakeFrontBuffer(const HostResource& context); |
122 void OnMsgEnsureWorkVisible(const HostResource& context); | 120 void OnMsgEnsureWorkVisible(const HostResource& context); |
123 // Renderer->plugin message handlers. | 121 // Renderer->plugin message handlers. |
124 void OnMsgSwapBuffersACK(const HostResource& context, | 122 void OnMsgSwapBuffersACK(const HostResource& context, |
125 int32_t pp_error); | 123 int32_t pp_error); |
126 | 124 |
127 void SendSwapBuffersACKToPlugin(int32_t result, | 125 void SendSwapBuffersACKToPlugin(int32_t result, |
128 const HostResource& context); | 126 const HostResource& context); |
129 | 127 |
130 ProxyCompletionCallbackFactory<PPB_Graphics3D_Proxy> callback_factory_; | 128 ProxyCompletionCallbackFactory<PPB_Graphics3D_Proxy> callback_factory_; |
131 | 129 |
132 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Proxy); | 130 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Proxy); |
133 }; | 131 }; |
134 | 132 |
135 } // namespace proxy | 133 } // namespace proxy |
136 } // namespace ppapi | 134 } // namespace ppapi |
137 | 135 |
138 #endif // PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ | 136 #endif // PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ |
139 | 137 |
OLD | NEW |