| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 16 matching lines...) Expand all Loading... |
| 27 ReceiveSerializedVarReturnValue result; | 27 ReceiveSerializedVarReturnValue result; |
| 28 dispatcher->Send(new PpapiMsg_PPPInstancePrivate_GetInstanceObject( | 28 dispatcher->Send(new PpapiMsg_PPPInstancePrivate_GetInstanceObject( |
| 29 API_ID_PPP_INSTANCE_PRIVATE, instance, &result)); | 29 API_ID_PPP_INSTANCE_PRIVATE, instance, &result)); |
| 30 return result.Return(dispatcher); | 30 return result.Return(dispatcher); |
| 31 } | 31 } |
| 32 | 32 |
| 33 static const PPP_Instance_Private instance_private_interface = { | 33 static const PPP_Instance_Private instance_private_interface = { |
| 34 &GetInstanceObject | 34 &GetInstanceObject |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 InterfaceProxy* CreateInstancePrivateProxy(Dispatcher* dispatcher) { | |
| 38 return new PPP_Instance_Private_Proxy(dispatcher); | |
| 39 } | |
| 40 | |
| 41 } // namespace | 37 } // namespace |
| 42 | 38 |
| 43 PPP_Instance_Private_Proxy::PPP_Instance_Private_Proxy(Dispatcher* dispatcher) | 39 PPP_Instance_Private_Proxy::PPP_Instance_Private_Proxy(Dispatcher* dispatcher) |
| 44 : InterfaceProxy(dispatcher), | 40 : InterfaceProxy(dispatcher), |
| 45 ppp_instance_private_impl_(NULL) { | 41 ppp_instance_private_impl_(NULL) { |
| 46 if (dispatcher->IsPlugin()) { | 42 if (dispatcher->IsPlugin()) { |
| 47 ppp_instance_private_impl_ = static_cast<const PPP_Instance_Private*>( | 43 ppp_instance_private_impl_ = static_cast<const PPP_Instance_Private*>( |
| 48 dispatcher->local_get_interface()(PPP_INSTANCE_PRIVATE_INTERFACE)); | 44 dispatcher->local_get_interface()(PPP_INSTANCE_PRIVATE_INTERFACE)); |
| 49 } | 45 } |
| 50 } | 46 } |
| 51 | 47 |
| 52 PPP_Instance_Private_Proxy::~PPP_Instance_Private_Proxy() { | 48 PPP_Instance_Private_Proxy::~PPP_Instance_Private_Proxy() { |
| 53 } | 49 } |
| 54 | 50 |
| 55 // static | 51 // static |
| 56 const InterfaceProxy::Info* PPP_Instance_Private_Proxy::GetInfo() { | 52 const PPP_Instance_Private* PPP_Instance_Private_Proxy::GetProxyInterface() { |
| 57 static const Info info = { | 53 return &instance_private_interface; |
| 58 &instance_private_interface, | |
| 59 PPP_INSTANCE_PRIVATE_INTERFACE, | |
| 60 API_ID_PPP_INSTANCE_PRIVATE, | |
| 61 false, | |
| 62 &CreateInstancePrivateProxy, | |
| 63 }; | |
| 64 return &info; | |
| 65 } | 54 } |
| 66 | 55 |
| 67 bool PPP_Instance_Private_Proxy::OnMessageReceived(const IPC::Message& msg) { | 56 bool PPP_Instance_Private_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 68 if (!dispatcher()->IsPlugin()) | 57 if (!dispatcher()->IsPlugin()) |
| 69 return false; | 58 return false; |
| 70 | 59 |
| 71 bool handled = true; | 60 bool handled = true; |
| 72 IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Private_Proxy, msg) | 61 IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Private_Proxy, msg) |
| 73 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstancePrivate_GetInstanceObject, | 62 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstancePrivate_GetInstanceObject, |
| 74 OnMsgGetInstanceObject) | 63 OnMsgGetInstanceObject) |
| 75 IPC_MESSAGE_UNHANDLED(handled = false) | 64 IPC_MESSAGE_UNHANDLED(handled = false) |
| 76 IPC_END_MESSAGE_MAP() | 65 IPC_END_MESSAGE_MAP() |
| 77 return handled; | 66 return handled; |
| 78 } | 67 } |
| 79 | 68 |
| 80 void PPP_Instance_Private_Proxy::OnMsgGetInstanceObject( | 69 void PPP_Instance_Private_Proxy::OnMsgGetInstanceObject( |
| 81 PP_Instance instance, | 70 PP_Instance instance, |
| 82 SerializedVarReturnValue result) { | 71 SerializedVarReturnValue result) { |
| 83 result.Return(dispatcher(), | 72 result.Return(dispatcher(), |
| 84 CallWhileUnlocked(ppp_instance_private_impl_->GetInstanceObject, | 73 CallWhileUnlocked(ppp_instance_private_impl_->GetInstanceObject, |
| 85 instance)); | 74 instance)); |
| 86 } | 75 } |
| 87 | 76 |
| 88 } // namespace proxy | 77 } // namespace proxy |
| 89 } // namespace ppapi | 78 } // namespace ppapi |
| OLD | NEW |