| 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_instance_private_proxy.h" | 5 #include "ppapi/proxy/ppp_instance_private_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ppapi/c/pp_var.h" | 9 #include "ppapi/c/pp_var.h" |
| 10 #include "ppapi/c/private/ppp_instance_private.h" | 10 #include "ppapi/c/private/ppp_instance_private.h" |
| 11 #include "ppapi/proxy/host_dispatcher.h" | 11 #include "ppapi/proxy/host_dispatcher.h" |
| 12 #include "ppapi/proxy/plugin_dispatcher.h" | 12 #include "ppapi/proxy/plugin_dispatcher.h" |
| 13 #include "ppapi/proxy/plugin_resource_tracker.h" | 13 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 14 #include "ppapi/proxy/ppapi_messages.h" | 14 #include "ppapi/proxy/ppapi_messages.h" |
| 15 | 15 |
| 16 namespace ppapi { | 16 namespace ppapi { |
| 17 namespace proxy { | 17 namespace proxy { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 PP_Var GetInstanceObject(PP_Instance instance) { | 21 PP_Var GetInstanceObject(PP_Instance instance) { |
| 22 Dispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 22 Dispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 23 ReceiveSerializedVarReturnValue result; | 23 ReceiveSerializedVarReturnValue result; |
| 24 dispatcher->Send(new PpapiMsg_PPPInstancePrivate_GetInstanceObject( | 24 dispatcher->Send(new PpapiMsg_PPPInstancePrivate_GetInstanceObject( |
| 25 INTERFACE_ID_PPP_INSTANCE_PRIVATE, instance, &result)); | 25 API_ID_PPP_INSTANCE_PRIVATE, instance, &result)); |
| 26 return result.Return(dispatcher); | 26 return result.Return(dispatcher); |
| 27 } | 27 } |
| 28 | 28 |
| 29 static const PPP_Instance_Private instance_private_interface = { | 29 static const PPP_Instance_Private instance_private_interface = { |
| 30 &GetInstanceObject | 30 &GetInstanceObject |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 InterfaceProxy* CreateInstancePrivateProxy(Dispatcher* dispatcher) { | 33 InterfaceProxy* CreateInstancePrivateProxy(Dispatcher* dispatcher) { |
| 34 return new PPP_Instance_Private_Proxy(dispatcher); | 34 return new PPP_Instance_Private_Proxy(dispatcher); |
| 35 } | 35 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 PPP_Instance_Private_Proxy::~PPP_Instance_Private_Proxy() { | 48 PPP_Instance_Private_Proxy::~PPP_Instance_Private_Proxy() { |
| 49 } | 49 } |
| 50 | 50 |
| 51 // static | 51 // static |
| 52 const InterfaceProxy::Info* PPP_Instance_Private_Proxy::GetInfo() { | 52 const InterfaceProxy::Info* PPP_Instance_Private_Proxy::GetInfo() { |
| 53 static const Info info = { | 53 static const Info info = { |
| 54 &instance_private_interface, | 54 &instance_private_interface, |
| 55 PPP_INSTANCE_PRIVATE_INTERFACE, | 55 PPP_INSTANCE_PRIVATE_INTERFACE, |
| 56 INTERFACE_ID_PPP_INSTANCE_PRIVATE, | 56 API_ID_PPP_INSTANCE_PRIVATE, |
| 57 false, | 57 false, |
| 58 &CreateInstancePrivateProxy, | 58 &CreateInstancePrivateProxy, |
| 59 }; | 59 }; |
| 60 return &info; | 60 return &info; |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool PPP_Instance_Private_Proxy::OnMessageReceived(const IPC::Message& msg) { | 63 bool PPP_Instance_Private_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 64 bool handled = true; | 64 bool handled = true; |
| 65 IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Private_Proxy, msg) | 65 IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Private_Proxy, msg) |
| 66 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstancePrivate_GetInstanceObject, | 66 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstancePrivate_GetInstanceObject, |
| 67 OnMsgGetInstanceObject) | 67 OnMsgGetInstanceObject) |
| 68 IPC_MESSAGE_UNHANDLED(handled = false) | 68 IPC_MESSAGE_UNHANDLED(handled = false) |
| 69 IPC_END_MESSAGE_MAP() | 69 IPC_END_MESSAGE_MAP() |
| 70 return handled; | 70 return handled; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void PPP_Instance_Private_Proxy::OnMsgGetInstanceObject( | 73 void PPP_Instance_Private_Proxy::OnMsgGetInstanceObject( |
| 74 PP_Instance instance, | 74 PP_Instance instance, |
| 75 SerializedVarReturnValue result) { | 75 SerializedVarReturnValue result) { |
| 76 result.Return(dispatcher(), | 76 result.Return(dispatcher(), |
| 77 ppp_instance_private_impl_->GetInstanceObject(instance)); | 77 ppp_instance_private_impl_->GetInstanceObject(instance)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace proxy | 80 } // namespace proxy |
| 81 } // namespace ppapi | 81 } // namespace ppapi |
| OLD | NEW |