| 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" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 if (object->is_flush_pending()) | 183 if (object->is_flush_pending()) |
| 184 return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. | 184 return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. |
| 185 object->set_current_flush_callback(callback); | 185 object->set_current_flush_callback(callback); |
| 186 | 186 |
| 187 dispatcher->Send(new PpapiHostMsg_PPBGraphics2D_Flush( | 187 dispatcher->Send(new PpapiHostMsg_PPBGraphics2D_Flush( |
| 188 INTERFACE_ID_PPB_GRAPHICS_2D, object->host_resource())); | 188 INTERFACE_ID_PPB_GRAPHICS_2D, object->host_resource())); |
| 189 return PP_ERROR_WOULDBLOCK; | 189 return PP_ERROR_WOULDBLOCK; |
| 190 } | 190 } |
| 191 | 191 |
| 192 const PPB_Graphics2D ppb_graphics_2d = { | 192 const PPB_Graphics2D graphics_2d_interface = { |
| 193 &Create, | 193 &Create, |
| 194 &IsGraphics2D, | 194 &IsGraphics2D, |
| 195 &Describe, | 195 &Describe, |
| 196 &PaintImageData, | 196 &PaintImageData, |
| 197 &Scroll, | 197 &Scroll, |
| 198 &ReplaceContents, | 198 &ReplaceContents, |
| 199 &Flush | 199 &Flush |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 InterfaceProxy* CreateGraphics2DProxy(Dispatcher* dispatcher, |
| 203 const void* target_interface) { |
| 204 return new PPB_Graphics2D_Proxy(dispatcher, target_interface); |
| 205 } |
| 206 |
| 202 } // namespace | 207 } // namespace |
| 203 | 208 |
| 204 PPB_Graphics2D_Proxy::PPB_Graphics2D_Proxy(Dispatcher* dispatcher, | 209 PPB_Graphics2D_Proxy::PPB_Graphics2D_Proxy(Dispatcher* dispatcher, |
| 205 const void* target_interface) | 210 const void* target_interface) |
| 206 : InterfaceProxy(dispatcher, target_interface), | 211 : InterfaceProxy(dispatcher, target_interface), |
| 207 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 212 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 208 } | 213 } |
| 209 | 214 |
| 210 PPB_Graphics2D_Proxy::~PPB_Graphics2D_Proxy() { | 215 PPB_Graphics2D_Proxy::~PPB_Graphics2D_Proxy() { |
| 211 } | 216 } |
| 212 | 217 |
| 213 const void* PPB_Graphics2D_Proxy::GetSourceInterface() const { | 218 // static |
| 214 return &ppb_graphics_2d; | 219 const InterfaceProxy::Info* PPB_Graphics2D_Proxy::GetInfo() { |
| 215 } | 220 static const Info info = { |
| 216 | 221 &graphics_2d_interface, |
| 217 InterfaceID PPB_Graphics2D_Proxy::GetInterfaceId() const { | 222 PPB_GRAPHICS_2D_INTERFACE, |
| 218 return INTERFACE_ID_PPB_GRAPHICS_2D; | 223 INTERFACE_ID_PPB_GRAPHICS_2D, |
| 224 false, |
| 225 &CreateGraphics2DProxy, |
| 226 }; |
| 227 return &info; |
| 219 } | 228 } |
| 220 | 229 |
| 221 bool PPB_Graphics2D_Proxy::OnMessageReceived(const IPC::Message& msg) { | 230 bool PPB_Graphics2D_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 222 bool handled = true; | 231 bool handled = true; |
| 223 IPC_BEGIN_MESSAGE_MAP(PPB_Graphics2D_Proxy, msg) | 232 IPC_BEGIN_MESSAGE_MAP(PPB_Graphics2D_Proxy, msg) |
| 224 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Create, | 233 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Create, |
| 225 OnMsgCreate) | 234 OnMsgCreate) |
| 226 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_PaintImageData, | 235 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_PaintImageData, |
| 227 OnMsgPaintImageData) | 236 OnMsgPaintImageData) |
| 228 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Scroll, | 237 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Scroll, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 320 |
| 312 void PPB_Graphics2D_Proxy::SendFlushACKToPlugin( | 321 void PPB_Graphics2D_Proxy::SendFlushACKToPlugin( |
| 313 int32_t result, | 322 int32_t result, |
| 314 const HostResource& graphics_2d) { | 323 const HostResource& graphics_2d) { |
| 315 dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK( | 324 dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK( |
| 316 INTERFACE_ID_PPB_GRAPHICS_2D, graphics_2d, result)); | 325 INTERFACE_ID_PPB_GRAPHICS_2D, graphics_2d, result)); |
| 317 } | 326 } |
| 318 | 327 |
| 319 } // namespace proxy | 328 } // namespace proxy |
| 320 } // namespace pp | 329 } // namespace pp |
| OLD | NEW |