diff options
author | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 20:01:42 +0000 |
---|---|---|
committer | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 20:01:42 +0000 |
commit | 8c3bd1d8c71d8432beb624ce1434ca962665de90 (patch) | |
tree | 03cfc9842f7c75c1055895343d57b7ff709b90b8 | |
parent | 2bc27608c7957eb03a98cd3b6929d6e6c068b478 (diff) | |
download | chromium_src-8c3bd1d8c71d8432beb624ce1434ca962665de90.zip chromium_src-8c3bd1d8c71d8432beb624ce1434ca962665de90.tar.gz chromium_src-8c3bd1d8c71d8432beb624ce1434ca962665de90.tar.bz2 |
Add proxy for PPP_Graphics_3D_Dev
BUG=none
TEST=run OOP Flash, kill the GPU process, check that Flash got the message.
Review URL: http://codereview.chromium.org/6823069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81294 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ppapi/ppapi_shared_proxy.gypi | 2 | ||||
-rw-r--r-- | ppapi/proxy/dispatcher.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/interface_id.h | 1 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppp_graphics_3d_proxy.cc | 70 | ||||
-rw-r--r-- | ppapi/proxy/ppp_graphics_3d_proxy.h | 39 |
6 files changed, 118 insertions, 0 deletions
diff --git a/ppapi/ppapi_shared_proxy.gypi b/ppapi/ppapi_shared_proxy.gypi index f51fdd3..bdc1d6b 100644 --- a/ppapi/ppapi_shared_proxy.gypi +++ b/ppapi/ppapi_shared_proxy.gypi @@ -143,6 +143,8 @@ 'proxy/ppb_var_deprecated_proxy.h', 'proxy/ppp_class_proxy.cc', 'proxy/ppp_class_proxy.h', + 'proxy/ppp_graphics_3d_proxy.cc', + 'proxy/ppp_graphics_3d_proxy.h', 'proxy/ppp_instance_proxy.cc', 'proxy/ppp_instance_proxy.h', 'proxy/serialized_flash_menu.cc', diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index c0b71c6..f21a25c 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc @@ -77,6 +77,7 @@ #include "ppapi/proxy/ppb_url_util_proxy.h" #include "ppapi/proxy/ppb_var_deprecated_proxy.h" #include "ppapi/proxy/ppp_class_proxy.h" +#include "ppapi/proxy/ppp_graphics_3d_proxy.h" #include "ppapi/proxy/ppp_instance_proxy.h" #include "ppapi/proxy/var_serialization_rules.h" @@ -144,6 +145,7 @@ InterfaceList::InterfaceList() { #endif // PPP (plugin) interfaces. + AddPPP(PPP_Graphics3D_Proxy::GetInfo()); AddPPP(PPP_Instance_Proxy::GetInfo()); } diff --git a/ppapi/proxy/interface_id.h b/ppapi/proxy/interface_id.h index 3e33314..a573346 100644 --- a/ppapi/proxy/interface_id.h +++ b/ppapi/proxy/interface_id.h @@ -50,6 +50,7 @@ enum InterfaceID { INTERFACE_ID_PPB_VIDEO_DECODER_DEV, INTERFACE_ID_PPP_CLASS, + INTERFACE_ID_PPP_GRAPHICS_3D_DEV, INTERFACE_ID_PPP_INSTANCE, INTERFACE_ID_PPP_VIDEO_DECODER_DEV, diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 37baf9b..057874e 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -166,6 +166,10 @@ IPC_MESSAGE_ROUTED2(PpapiMsg_PPPClass_Deallocate, int64 /* ppp_class */, int64 /* object */) +// PPP_Graphics3D_Dev. +IPC_MESSAGE_ROUTED1(PpapiMsg_PPPGraphics3D_ContextLost, + PP_Instance /* instance */) + // PPP_Instance. IPC_SYNC_MESSAGE_ROUTED3_1(PpapiMsg_PPPInstance_DidCreate, PP_Instance /* instance */, diff --git a/ppapi/proxy/ppp_graphics_3d_proxy.cc b/ppapi/proxy/ppp_graphics_3d_proxy.cc new file mode 100644 index 0000000..ef31e92b --- /dev/null +++ b/ppapi/proxy/ppp_graphics_3d_proxy.cc @@ -0,0 +1,70 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/proxy/ppp_graphics_3d_proxy.h" + +#include "ppapi/c/dev/ppp_graphics_3d_dev.h" +#include "ppapi/proxy/host_dispatcher.h" +#include "ppapi/proxy/plugin_dispatcher.h" +#include "ppapi/proxy/ppapi_messages.h" + +namespace pp { +namespace proxy { + +namespace { + +void ContextLost(PP_Instance instance) { + HostDispatcher::GetForInstance(instance)->Send( + new PpapiMsg_PPPGraphics3D_ContextLost(INTERFACE_ID_PPP_GRAPHICS_3D_DEV, + instance)); +} + +static const PPP_Graphics3D_Dev graphics_3d_interface = { + &ContextLost +}; + +InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher, + const void* target_interface) { + return new PPP_Graphics3D_Proxy(dispatcher, target_interface); +} + +} // namespace + +PPP_Graphics3D_Proxy::PPP_Graphics3D_Proxy(Dispatcher* dispatcher, + const void* target_interface) + : InterfaceProxy(dispatcher, target_interface) { +} + +PPP_Graphics3D_Proxy::~PPP_Graphics3D_Proxy() { +} + +// static +const InterfaceProxy::Info* PPP_Graphics3D_Proxy::GetInfo() { + static const Info info = { + &graphics_3d_interface, + PPP_GRAPHICS_3D_DEV_INTERFACE, + INTERFACE_ID_PPP_GRAPHICS_3D_DEV, + false, + &CreateGraphics3DProxy, + }; + return &info; +} + +bool PPP_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(PPP_Graphics3D_Proxy, msg) + IPC_MESSAGE_HANDLER(PpapiMsg_PPPGraphics3D_ContextLost, + OnMsgContextLost) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + +void PPP_Graphics3D_Proxy::OnMsgContextLost(PP_Instance instance) { + if (ppp_graphics_3d_target()) + ppp_graphics_3d_target()->Graphics3DContextLost(instance); +} + +} // namespace proxy +} // namespace pp diff --git a/ppapi/proxy/ppp_graphics_3d_proxy.h b/ppapi/proxy/ppp_graphics_3d_proxy.h new file mode 100644 index 0000000..41c400a --- /dev/null +++ b/ppapi/proxy/ppp_graphics_3d_proxy.h @@ -0,0 +1,39 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_PROXY_PPP_GRAPHICS_3D_PROXY_H_ +#define PPAPI_PROXY_PPP_GRAPHICS_3D_PROXY_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/proxy/host_resource.h" +#include "ppapi/proxy/interface_proxy.h" + +struct PPP_Graphics3D_Dev; + +namespace pp { +namespace proxy { + +class PPP_Graphics3D_Proxy : public InterfaceProxy { + public: + PPP_Graphics3D_Proxy(Dispatcher* dispatcher, const void* target_interface); + virtual ~PPP_Graphics3D_Proxy(); + + static const Info* GetInfo(); + + const PPP_Graphics3D_Dev* ppp_graphics_3d_target() const { + return reinterpret_cast<const PPP_Graphics3D_Dev*>(target_interface()); + } + + // InterfaceProxy implementation. + virtual bool OnMessageReceived(const IPC::Message& msg); + + private: + // Message handlers. + void OnMsgContextLost(PP_Instance instance); +}; + +} // namespace proxy +} // namespace pp + +#endif // PPAPI_PROXY_PPP_GRAPHICS_3D_PROXY_H_ |