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/logging.h" | 9 #include "base/logging.h" |
10 #include "gpu/common/gpu_trace_event.h" | 10 #include "gpu/common/gpu_trace_event.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 DCHECK(ppb_proxy_) << "The proxy interface should always be supported."; | 83 DCHECK(ppb_proxy_) << "The proxy interface should always be supported."; |
84 | 84 |
85 ppb_proxy_->SetReserveInstanceIDCallback(pp_module_, &ReserveInstanceID); | 85 ppb_proxy_->SetReserveInstanceIDCallback(pp_module_, &ReserveInstanceID); |
86 } | 86 } |
87 | 87 |
88 HostDispatcher::~HostDispatcher() { | 88 HostDispatcher::~HostDispatcher() { |
89 g_module_to_dispatcher->erase(pp_module_); | 89 g_module_to_dispatcher->erase(pp_module_); |
90 } | 90 } |
91 | 91 |
92 bool HostDispatcher::InitHostWithChannel( | 92 bool HostDispatcher::InitHostWithChannel( |
93 ProxyChannel::Delegate* delegate, | 93 Delegate* delegate, |
94 const IPC::ChannelHandle& channel_handle, | 94 const IPC::ChannelHandle& channel_handle, |
95 bool is_client) { | 95 bool is_client) { |
96 return Dispatcher::InitWithChannel(delegate, channel_handle, is_client); | 96 if (!Dispatcher::InitWithChannel(delegate, channel_handle, is_client)) |
| 97 return false; |
| 98 SetDelegate(delegate); |
| 99 return true; |
97 } | 100 } |
98 | 101 |
99 // static | 102 // static |
100 HostDispatcher* HostDispatcher::GetForInstance(PP_Instance instance) { | 103 HostDispatcher* HostDispatcher::GetForInstance(PP_Instance instance) { |
101 if (!g_instance_to_dispatcher) | 104 if (!g_instance_to_dispatcher) |
102 return NULL; | 105 return NULL; |
103 InstanceToDispatcherMap::iterator found = g_instance_to_dispatcher->find( | 106 InstanceToDispatcherMap::iterator found = g_instance_to_dispatcher->find( |
104 instance); | 107 instance); |
105 if (found == g_instance_to_dispatcher->end()) | 108 if (found == g_instance_to_dispatcher->end()) |
106 return NULL; | 109 return NULL; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); | 269 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); |
267 } | 270 } |
268 | 271 |
269 ScopedModuleReference::~ScopedModuleReference() { | 272 ScopedModuleReference::~ScopedModuleReference() { |
270 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); | 273 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); |
271 } | 274 } |
272 | 275 |
273 } // namespace proxy | 276 } // namespace proxy |
274 } // namespace pp | 277 } // namespace pp |
275 | 278 |
OLD | NEW |