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_graphics_2d_proxy.h" | 5 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" |
6 | 6 |
7 #include <string.h> // For memset. | 7 #include <string.h> // For memset. |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "ppapi/c/pp_completion_callback.h" | 11 #include "ppapi/c/pp_completion_callback.h" |
12 #include "ppapi/c/pp_errors.h" | 12 #include "ppapi/c/pp_errors.h" |
13 #include "ppapi/c/pp_resource.h" | 13 #include "ppapi/c/pp_resource.h" |
14 #include "ppapi/c/ppb_graphics_2d.h" | 14 #include "ppapi/c/ppb_graphics_2d.h" |
15 #include "ppapi/proxy/enter_proxy.h" | 15 #include "ppapi/proxy/enter_proxy.h" |
16 #include "ppapi/proxy/plugin_dispatcher.h" | 16 #include "ppapi/proxy/plugin_dispatcher.h" |
17 #include "ppapi/proxy/ppapi_messages.h" | 17 #include "ppapi/proxy/ppapi_messages.h" |
18 #include "ppapi/thunk/enter.h" | 18 #include "ppapi/thunk/enter.h" |
19 #include "ppapi/thunk/ppb_graphics_2d_api.h" | 19 #include "ppapi/thunk/ppb_graphics_2d_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::PPB_Graphics2D_API; | 22 using ppapi::thunk::PPB_Graphics2D_API; |
25 | 23 |
26 namespace pp { | 24 namespace ppapi { |
27 namespace proxy { | 25 namespace proxy { |
28 | 26 |
29 namespace { | 27 namespace { |
30 | 28 |
31 InterfaceProxy* CreateGraphics2DProxy(Dispatcher* dispatcher, | 29 InterfaceProxy* CreateGraphics2DProxy(Dispatcher* dispatcher, |
32 const void* target_interface) { | 30 const void* target_interface) { |
33 return new PPB_Graphics2D_Proxy(dispatcher, target_interface); | 31 return new PPB_Graphics2D_Proxy(dispatcher, target_interface); |
34 } | 32 } |
35 | 33 |
36 } // namespace | 34 } // namespace |
37 | 35 |
38 class Graphics2D : public ppapi::Resource, | 36 class Graphics2D : public Resource, public thunk::PPB_Graphics2D_API { |
39 public ppapi::thunk::PPB_Graphics2D_API { | |
40 public: | 37 public: |
41 Graphics2D(const HostResource& host_resource, | 38 Graphics2D(const HostResource& host_resource, |
42 const PP_Size& size, | 39 const PP_Size& size, |
43 PP_Bool is_always_opaque); | 40 PP_Bool is_always_opaque); |
44 virtual ~Graphics2D(); | 41 virtual ~Graphics2D(); |
45 | 42 |
46 // Resource. | 43 // Resource. |
47 virtual PPB_Graphics2D_API* AsPPB_Graphics2D_API(); | 44 virtual PPB_Graphics2D_API* AsPPB_Graphics2D_API(); |
48 | 45 |
49 // PPB_Graphics_2D_API. | 46 // PPB_Graphics_2D_API. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 : InterfaceProxy(dispatcher, target_interface), | 153 : InterfaceProxy(dispatcher, target_interface), |
157 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 154 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
158 } | 155 } |
159 | 156 |
160 PPB_Graphics2D_Proxy::~PPB_Graphics2D_Proxy() { | 157 PPB_Graphics2D_Proxy::~PPB_Graphics2D_Proxy() { |
161 } | 158 } |
162 | 159 |
163 // static | 160 // static |
164 const InterfaceProxy::Info* PPB_Graphics2D_Proxy::GetInfo() { | 161 const InterfaceProxy::Info* PPB_Graphics2D_Proxy::GetInfo() { |
165 static const Info info = { | 162 static const Info info = { |
166 ::ppapi::thunk::GetPPB_Graphics2D_Thunk(), | 163 thunk::GetPPB_Graphics2D_Thunk(), |
167 PPB_GRAPHICS_2D_INTERFACE, | 164 PPB_GRAPHICS_2D_INTERFACE, |
168 INTERFACE_ID_PPB_GRAPHICS_2D, | 165 INTERFACE_ID_PPB_GRAPHICS_2D, |
169 false, | 166 false, |
170 &CreateGraphics2DProxy, | 167 &CreateGraphics2DProxy, |
171 }; | 168 }; |
172 return &info; | 169 return &info; |
173 } | 170 } |
174 | 171 |
175 // static | 172 // static |
176 PP_Resource PPB_Graphics2D_Proxy::CreateProxyResource( | 173 PP_Resource PPB_Graphics2D_Proxy::CreateProxyResource( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 256 } |
260 | 257 |
261 void PPB_Graphics2D_Proxy::SendFlushACKToPlugin( | 258 void PPB_Graphics2D_Proxy::SendFlushACKToPlugin( |
262 int32_t result, | 259 int32_t result, |
263 const HostResource& graphics_2d) { | 260 const HostResource& graphics_2d) { |
264 dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK( | 261 dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK( |
265 INTERFACE_ID_PPB_GRAPHICS_2D, graphics_2d, result)); | 262 INTERFACE_ID_PPB_GRAPHICS_2D, graphics_2d, result)); |
266 } | 263 } |
267 | 264 |
268 } // namespace proxy | 265 } // namespace proxy |
269 } // namespace pp | 266 } // namespace ppapi |
OLD | NEW |