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 #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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
11 #include "gpu/command_buffer/common/command_buffer.h" | 11 #include "gpu/command_buffer/common/command_buffer.h" |
12 #include "ppapi/c/dev/pp_graphics_3d_dev.h" | 12 #include "ppapi/c/dev/pp_graphics_3d_dev.h" |
13 #include "ppapi/c/pp_instance.h" | 13 #include "ppapi/c/pp_instance.h" |
14 #include "ppapi/cpp/completion_callback.h" | 14 #include "ppapi/cpp/completion_callback.h" |
15 #include "ppapi/proxy/interface_proxy.h" | 15 #include "ppapi/proxy/interface_proxy.h" |
16 #include "ppapi/proxy/plugin_resource.h" | 16 #include "ppapi/proxy/plugin_resource.h" |
17 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" | 17 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
18 #include "ppapi/shared_impl/graphics_3d_impl.h" | 18 #include "ppapi/shared_impl/graphics_3d_impl.h" |
19 | 19 |
| 20 namespace ppapi { |
| 21 class HostResource; |
| 22 } |
| 23 |
20 namespace pp { | 24 namespace pp { |
21 namespace proxy { | 25 namespace proxy { |
22 | 26 |
23 class HostResource; | |
24 | |
25 class Graphics3D : public PluginResource, | 27 class Graphics3D : public PluginResource, |
26 public ppapi::Graphics3DImpl { | 28 public ppapi::Graphics3DImpl { |
27 public: | 29 public: |
28 explicit Graphics3D(const HostResource& resource); | 30 explicit Graphics3D(const ppapi::HostResource& resource); |
29 virtual ~Graphics3D(); | 31 virtual ~Graphics3D(); |
30 | 32 |
31 bool Init(); | 33 bool Init(); |
32 | 34 |
33 // PluginResource overrides. | 35 // PluginResource overrides. |
34 virtual ::ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE { | 36 virtual ::ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE { |
35 return this; | 37 return this; |
36 } | 38 } |
37 | 39 |
38 // Graphics3DTrusted API. These are not implemented in the proxy. | 40 // Graphics3DTrusted API. These are not implemented in the proxy. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return static_cast<const PPB_Graphics3D_Dev*>(target_interface()); | 79 return static_cast<const PPB_Graphics3D_Dev*>(target_interface()); |
78 } | 80 } |
79 | 81 |
80 // InterfaceProxy implementation. | 82 // InterfaceProxy implementation. |
81 virtual bool OnMessageReceived(const IPC::Message& msg); | 83 virtual bool OnMessageReceived(const IPC::Message& msg); |
82 | 84 |
83 private: | 85 private: |
84 void OnMsgCreate(PP_Instance instance, | 86 void OnMsgCreate(PP_Instance instance, |
85 PP_Config3D_Dev config, | 87 PP_Config3D_Dev config, |
86 const std::vector<int32_t>& attribs, | 88 const std::vector<int32_t>& attribs, |
87 HostResource* result); | 89 ppapi::HostResource* result); |
88 void OnMsgInitCommandBuffer(const HostResource& context, | 90 void OnMsgInitCommandBuffer(const ppapi::HostResource& context, |
89 int32 size, | 91 int32 size, |
90 base::SharedMemoryHandle* ring_buffer); | 92 base::SharedMemoryHandle* ring_buffer); |
91 void OnMsgGetState(const HostResource& context, | 93 void OnMsgGetState(const ppapi::HostResource& context, |
92 gpu::CommandBuffer::State* state); | 94 gpu::CommandBuffer::State* state); |
93 void OnMsgFlush(const HostResource& context, | 95 void OnMsgFlush(const ppapi::HostResource& context, |
94 int32 put_offset, | 96 int32 put_offset, |
95 int32 last_known_get, | 97 int32 last_known_get, |
96 gpu::CommandBuffer::State* state); | 98 gpu::CommandBuffer::State* state); |
97 void OnMsgAsyncFlush(const HostResource& context, | 99 void OnMsgAsyncFlush(const ppapi::HostResource& context, |
98 int32 put_offset); | 100 int32 put_offset); |
99 void OnMsgCreateTransferBuffer(const HostResource& context, | 101 void OnMsgCreateTransferBuffer(const ppapi::HostResource& context, |
100 int32 size, | 102 int32 size, |
101 int32* id); | 103 int32* id); |
102 void OnMsgDestroyTransferBuffer(const HostResource& context, | 104 void OnMsgDestroyTransferBuffer(const ppapi::HostResource& context, |
103 int32 id); | 105 int32 id); |
104 void OnMsgGetTransferBuffer(const HostResource& context, | 106 void OnMsgGetTransferBuffer(const ppapi::HostResource& context, |
105 int32 id, | 107 int32 id, |
106 base::SharedMemoryHandle* transfer_buffer, | 108 base::SharedMemoryHandle* transfer_buffer, |
107 uint32* size); | 109 uint32* size); |
108 void OnMsgSwapBuffers(const HostResource& context); | 110 void OnMsgSwapBuffers(const ppapi::HostResource& context); |
109 // Renderer->plugin message handlers. | 111 // Renderer->plugin message handlers. |
110 void OnMsgSwapBuffersACK(const HostResource& context, int32_t pp_error); | 112 void OnMsgSwapBuffersACK(const ppapi::HostResource& context, |
| 113 int32_t pp_error); |
111 | 114 |
112 void SendSwapBuffersACKToPlugin(int32_t result, | 115 void SendSwapBuffersACKToPlugin(int32_t result, |
113 const HostResource& context); | 116 const ppapi::HostResource& context); |
114 | 117 |
115 CompletionCallbackFactory<PPB_Graphics3D_Proxy, | 118 CompletionCallbackFactory<PPB_Graphics3D_Proxy, |
116 ProxyNonThreadSafeRefCount> callback_factory_; | 119 ProxyNonThreadSafeRefCount> callback_factory_; |
117 | 120 |
118 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Proxy); | 121 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Proxy); |
119 }; | 122 }; |
120 | 123 |
121 } // namespace proxy | 124 } // namespace proxy |
122 } // namespace pp | 125 } // namespace pp |
123 | 126 |
124 #endif // PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ | 127 #endif // PPAPI_PROXY_PPB_GRAPHICS_3D_PROXY_H_ |
125 | 128 |
OLD | NEW |