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