Rename GDataSystemService to DriveSystemService
[chromium-blink-merge.git] / ppapi / proxy / ppp_graphics_3d_proxy.cc
blob8143f318abd82a6014d6c66f0b17efed790811af
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ppapi/proxy/ppp_graphics_3d_proxy.h"
7 #include "ppapi/c/ppp_graphics_3d.h"
8 #include "ppapi/proxy/host_dispatcher.h"
9 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/ppapi_messages.h"
11 #include "ppapi/shared_impl/proxy_lock.h"
13 namespace ppapi {
14 namespace proxy {
16 namespace {
18 void ContextLost(PP_Instance instance) {
19 HostDispatcher::GetForInstance(instance)->Send(
20 new PpapiMsg_PPPGraphics3D_ContextLost(API_ID_PPP_GRAPHICS_3D, instance));
23 static const PPP_Graphics3D graphics_3d_interface = {
24 &ContextLost
27 InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher) {
28 return new PPP_Graphics3D_Proxy(dispatcher);
31 } // namespace
33 PPP_Graphics3D_Proxy::PPP_Graphics3D_Proxy(Dispatcher* dispatcher)
34 : InterfaceProxy(dispatcher),
35 ppp_graphics_3d_impl_(NULL) {
36 if (dispatcher->IsPlugin()) {
37 ppp_graphics_3d_impl_ = static_cast<const PPP_Graphics3D*>(
38 dispatcher->local_get_interface()(PPP_GRAPHICS_3D_INTERFACE));
42 PPP_Graphics3D_Proxy::~PPP_Graphics3D_Proxy() {
45 // static
46 const InterfaceProxy::Info* PPP_Graphics3D_Proxy::GetInfo() {
47 static const Info info = {
48 &graphics_3d_interface,
49 PPP_GRAPHICS_3D_INTERFACE,
50 API_ID_PPP_GRAPHICS_3D,
51 false,
52 &CreateGraphics3DProxy,
54 return &info;
57 bool PPP_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
58 bool handled = true;
59 IPC_BEGIN_MESSAGE_MAP(PPP_Graphics3D_Proxy, msg)
60 IPC_MESSAGE_HANDLER(PpapiMsg_PPPGraphics3D_ContextLost,
61 OnMsgContextLost)
62 IPC_MESSAGE_UNHANDLED(handled = false)
63 IPC_END_MESSAGE_MAP()
64 return handled;
67 void PPP_Graphics3D_Proxy::OnMsgContextLost(PP_Instance instance) {
68 if (ppp_graphics_3d_impl_)
69 CallWhileUnlocked(ppp_graphics_3d_impl_->Graphics3DContextLost, instance);
72 } // namespace proxy
73 } // namespace ppapi