| 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/ppp_graphics_3d_proxy.h" | 5 #include "ppapi/proxy/ppp_graphics_3d_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/ppp_graphics_3d.h" | 7 #include "ppapi/c/dev/ppp_graphics_3d_dev.h" |
| 8 #include "ppapi/proxy/host_dispatcher.h" | 8 #include "ppapi/proxy/host_dispatcher.h" |
| 9 #include "ppapi/proxy/plugin_dispatcher.h" | 9 #include "ppapi/proxy/plugin_dispatcher.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| 11 | 11 |
| 12 namespace ppapi { | 12 namespace ppapi { |
| 13 namespace proxy { | 13 namespace proxy { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 void ContextLost(PP_Instance instance) { | 17 void ContextLost(PP_Instance instance) { |
| 18 HostDispatcher::GetForInstance(instance)->Send( | 18 HostDispatcher::GetForInstance(instance)->Send( |
| 19 new PpapiMsg_PPPGraphics3D_ContextLost(INTERFACE_ID_PPP_GRAPHICS_3D, | 19 new PpapiMsg_PPPGraphics3D_ContextLost(INTERFACE_ID_PPP_GRAPHICS_3D_DEV, |
| 20 instance)); | 20 instance)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 static const PPP_Graphics3D graphics_3d_interface = { | 23 static const PPP_Graphics3D_Dev graphics_3d_interface = { |
| 24 &ContextLost | 24 &ContextLost |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher, | 27 InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher, |
| 28 const void* target_interface) { | 28 const void* target_interface) { |
| 29 return new PPP_Graphics3D_Proxy(dispatcher, target_interface); | 29 return new PPP_Graphics3D_Proxy(dispatcher, target_interface); |
| 30 } | 30 } |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 PPP_Graphics3D_Proxy::PPP_Graphics3D_Proxy(Dispatcher* dispatcher, | 34 PPP_Graphics3D_Proxy::PPP_Graphics3D_Proxy(Dispatcher* dispatcher, |
| 35 const void* target_interface) | 35 const void* target_interface) |
| 36 : InterfaceProxy(dispatcher, target_interface) { | 36 : InterfaceProxy(dispatcher, target_interface) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 PPP_Graphics3D_Proxy::~PPP_Graphics3D_Proxy() { | 39 PPP_Graphics3D_Proxy::~PPP_Graphics3D_Proxy() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 const InterfaceProxy::Info* PPP_Graphics3D_Proxy::GetInfo() { | 43 const InterfaceProxy::Info* PPP_Graphics3D_Proxy::GetInfo() { |
| 44 static const Info info = { | 44 static const Info info = { |
| 45 &graphics_3d_interface, | 45 &graphics_3d_interface, |
| 46 PPP_GRAPHICS_3D_INTERFACE, | 46 PPP_GRAPHICS_3D_DEV_INTERFACE, |
| 47 INTERFACE_ID_PPP_GRAPHICS_3D, | 47 INTERFACE_ID_PPP_GRAPHICS_3D_DEV, |
| 48 false, | 48 false, |
| 49 &CreateGraphics3DProxy, | 49 &CreateGraphics3DProxy, |
| 50 }; | 50 }; |
| 51 return &info; | 51 return &info; |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool PPP_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { | 54 bool PPP_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 55 bool handled = true; | 55 bool handled = true; |
| 56 IPC_BEGIN_MESSAGE_MAP(PPP_Graphics3D_Proxy, msg) | 56 IPC_BEGIN_MESSAGE_MAP(PPP_Graphics3D_Proxy, msg) |
| 57 IPC_MESSAGE_HANDLER(PpapiMsg_PPPGraphics3D_ContextLost, | 57 IPC_MESSAGE_HANDLER(PpapiMsg_PPPGraphics3D_ContextLost, |
| 58 OnMsgContextLost) | 58 OnMsgContextLost) |
| 59 IPC_MESSAGE_UNHANDLED(handled = false) | 59 IPC_MESSAGE_UNHANDLED(handled = false) |
| 60 IPC_END_MESSAGE_MAP() | 60 IPC_END_MESSAGE_MAP() |
| 61 return handled; | 61 return handled; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void PPP_Graphics3D_Proxy::OnMsgContextLost(PP_Instance instance) { | 64 void PPP_Graphics3D_Proxy::OnMsgContextLost(PP_Instance instance) { |
| 65 if (ppp_graphics_3d_target()) | 65 if (ppp_graphics_3d_target()) |
| 66 ppp_graphics_3d_target()->Graphics3DContextLost(instance); | 66 ppp_graphics_3d_target()->Graphics3DContextLost(instance); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace proxy | 69 } // namespace proxy |
| 70 } // namespace ppapi | 70 } // namespace ppapi |
| OLD | NEW |