| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 INTERFACE_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 const void* target_interface) { | 34 return new PPP_Instance_Private_Proxy(dispatcher); |
| 35 return new PPP_Instance_Private_Proxy(dispatcher, target_interface); | |
| 36 } | 35 } |
| 37 | 36 |
| 38 } // namespace | 37 } // namespace |
| 39 | 38 |
| 40 PPP_Instance_Private_Proxy::PPP_Instance_Private_Proxy( | 39 PPP_Instance_Private_Proxy::PPP_Instance_Private_Proxy(Dispatcher* dispatcher) |
| 41 Dispatcher* dispatcher, const void* target_interface) | 40 : InterfaceProxy(dispatcher), |
| 42 : InterfaceProxy(dispatcher, target_interface) { | 41 ppp_instance_private_impl_(NULL) { |
| 42 if (dispatcher->IsPlugin()) { |
| 43 ppp_instance_private_impl_ = static_cast<const PPP_Instance_Private*>( |
| 44 dispatcher->local_get_interface()(PPP_INSTANCE_PRIVATE_INTERFACE)); |
| 45 } |
| 43 } | 46 } |
| 44 | 47 |
| 45 PPP_Instance_Private_Proxy::~PPP_Instance_Private_Proxy() { | 48 PPP_Instance_Private_Proxy::~PPP_Instance_Private_Proxy() { |
| 46 } | 49 } |
| 47 | 50 |
| 48 // static | 51 // static |
| 49 const InterfaceProxy::Info* PPP_Instance_Private_Proxy::GetInfo() { | 52 const InterfaceProxy::Info* PPP_Instance_Private_Proxy::GetInfo() { |
| 50 static const Info info = { | 53 static const Info info = { |
| 51 &instance_private_interface, | 54 &instance_private_interface, |
| 52 PPP_INSTANCE_PRIVATE_INTERFACE, | 55 PPP_INSTANCE_PRIVATE_INTERFACE, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 OnMsgGetInstanceObject) | 67 OnMsgGetInstanceObject) |
| 65 IPC_MESSAGE_UNHANDLED(handled = false) | 68 IPC_MESSAGE_UNHANDLED(handled = false) |
| 66 IPC_END_MESSAGE_MAP() | 69 IPC_END_MESSAGE_MAP() |
| 67 return handled; | 70 return handled; |
| 68 } | 71 } |
| 69 | 72 |
| 70 void PPP_Instance_Private_Proxy::OnMsgGetInstanceObject( | 73 void PPP_Instance_Private_Proxy::OnMsgGetInstanceObject( |
| 71 PP_Instance instance, | 74 PP_Instance instance, |
| 72 SerializedVarReturnValue result) { | 75 SerializedVarReturnValue result) { |
| 73 result.Return(dispatcher(), | 76 result.Return(dispatcher(), |
| 74 ppp_instance_private_target()->GetInstanceObject(instance)); | 77 ppp_instance_private_impl_->GetInstanceObject(instance)); |
| 75 } | 78 } |
| 76 | 79 |
| 77 } // namespace proxy | 80 } // namespace proxy |
| 78 } // namespace ppapi | 81 } // namespace ppapi |
| OLD | NEW |