| 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/host_dispatcher.h" | 5 #include "ppapi/proxy/host_dispatcher.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 PP_Module module, | 64 PP_Module module, |
| 65 GetInterfaceFunc local_get_interface) | 65 GetInterfaceFunc local_get_interface) |
| 66 : Dispatcher(remote_process_handle, local_get_interface), | 66 : Dispatcher(remote_process_handle, local_get_interface), |
| 67 pp_module_(module), | 67 pp_module_(module), |
| 68 ppb_proxy_(NULL), | 68 ppb_proxy_(NULL), |
| 69 allow_plugin_reentrancy_(false) { | 69 allow_plugin_reentrancy_(false) { |
| 70 if (!g_module_to_dispatcher) | 70 if (!g_module_to_dispatcher) |
| 71 g_module_to_dispatcher = new ModuleToDispatcherMap; | 71 g_module_to_dispatcher = new ModuleToDispatcherMap; |
| 72 (*g_module_to_dispatcher)[pp_module_] = this; | 72 (*g_module_to_dispatcher)[pp_module_] = this; |
| 73 | 73 |
| 74 const PPB_Var* var_interface = | 74 SetSerializationRules(new HostVarSerializationRules(module)); |
| 75 static_cast<const PPB_Var*>(local_get_interface(PPB_VAR_INTERFACE)); | |
| 76 SetSerializationRules(new HostVarSerializationRules(var_interface, module)); | |
| 77 | 75 |
| 78 ppb_proxy_ = reinterpret_cast<const PPB_Proxy_Private*>( | 76 ppb_proxy_ = reinterpret_cast<const PPB_Proxy_Private*>( |
| 79 local_get_interface(PPB_PROXY_PRIVATE_INTERFACE)); | 77 local_get_interface(PPB_PROXY_PRIVATE_INTERFACE)); |
| 80 DCHECK(ppb_proxy_) << "The proxy interface should always be supported."; | 78 DCHECK(ppb_proxy_) << "The proxy interface should always be supported."; |
| 81 | 79 |
| 82 ppb_proxy_->SetReserveInstanceIDCallback(pp_module_, &ReserveInstanceID); | 80 ppb_proxy_->SetReserveInstanceIDCallback(pp_module_, &ReserveInstanceID); |
| 83 } | 81 } |
| 84 | 82 |
| 85 HostDispatcher::~HostDispatcher() { | 83 HostDispatcher::~HostDispatcher() { |
| 86 g_module_to_dispatcher->erase(pp_module_); | 84 g_module_to_dispatcher->erase(pp_module_); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 dispatcher_ = static_cast<HostDispatcher*>(dispatcher); | 222 dispatcher_ = static_cast<HostDispatcher*>(dispatcher); |
| 225 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); | 223 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); |
| 226 } | 224 } |
| 227 | 225 |
| 228 ScopedModuleReference::~ScopedModuleReference() { | 226 ScopedModuleReference::~ScopedModuleReference() { |
| 229 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); | 227 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); |
| 230 } | 228 } |
| 231 | 229 |
| 232 } // namespace proxy | 230 } // namespace proxy |
| 233 } // namespace ppapi | 231 } // namespace ppapi |
| OLD | NEW |