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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return proxy->OnMessageReceived(msg); | 191 return proxy->OnMessageReceived(msg); |
192 } | 192 } |
193 | 193 |
194 void HostDispatcher::OnChannelError() { | 194 void HostDispatcher::OnChannelError() { |
195 Dispatcher::OnChannelError(); // Stop using the channel. | 195 Dispatcher::OnChannelError(); // Stop using the channel. |
196 | 196 |
197 // Tell the host about the crash so it can clean up and display notification. | 197 // Tell the host about the crash so it can clean up and display notification. |
198 ppb_proxy_->PluginCrashed(pp_module()); | 198 ppb_proxy_->PluginCrashed(pp_module()); |
199 } | 199 } |
200 | 200 |
201 const void* HostDispatcher::GetProxiedInterface(const std::string& interface) { | 201 const void* HostDispatcher::GetProxiedInterface( |
| 202 const std::string& proxied_interface) { |
202 // First see if we even have a proxy for this interface. | 203 // First see if we even have a proxy for this interface. |
203 const InterfaceProxy::Info* info = GetPPPInterfaceInfo(interface); | 204 const InterfaceProxy::Info* info = GetPPPInterfaceInfo(proxied_interface); |
204 if (!info) | 205 if (!info) |
205 return NULL; | 206 return NULL; |
206 | 207 |
207 PluginIFSupportedMap::iterator iter(plugin_if_supported_.find(interface)); | 208 PluginIFSupportedMap::iterator iter(plugin_if_supported_.find( |
| 209 proxied_interface)); |
208 if (iter == plugin_if_supported_.end()) { | 210 if (iter == plugin_if_supported_.end()) { |
209 // Need to query. Cache the result so we only do this once. | 211 // Need to query. Cache the result so we only do this once. |
210 bool supported = false; | 212 bool supported = false; |
211 | 213 |
212 bool previous_reentrancy_value = allow_plugin_reentrancy_; | 214 bool previous_reentrancy_value = allow_plugin_reentrancy_; |
213 allow_plugin_reentrancy_ = true; | 215 allow_plugin_reentrancy_ = true; |
214 Send(new PpapiMsg_SupportsInterface(interface, &supported)); | 216 Send(new PpapiMsg_SupportsInterface(proxied_interface, &supported)); |
215 allow_plugin_reentrancy_ = previous_reentrancy_value; | 217 allow_plugin_reentrancy_ = previous_reentrancy_value; |
216 | 218 |
217 std::pair<PluginIFSupportedMap::iterator, bool> iter_success_pair; | 219 std::pair<PluginIFSupportedMap::iterator, bool> iter_success_pair; |
218 iter_success_pair = plugin_if_supported_.insert( | 220 iter_success_pair = plugin_if_supported_.insert( |
219 PluginIFSupportedMap::value_type(interface, supported)); | 221 PluginIFSupportedMap::value_type(proxied_interface, supported)); |
220 iter = iter_success_pair.first; | 222 iter = iter_success_pair.first; |
221 } | 223 } |
222 if (iter->second) | 224 if (iter->second) |
223 return info->interface_ptr; | 225 return info->interface_ptr; |
224 return NULL; | 226 return NULL; |
225 } | 227 } |
226 | 228 |
227 InterfaceProxy* HostDispatcher::GetOrCreatePPBInterfaceProxy( | 229 InterfaceProxy* HostDispatcher::GetOrCreatePPBInterfaceProxy( |
228 InterfaceID id) { | 230 InterfaceID id) { |
229 InterfaceProxy* proxy = target_proxies_[id].get(); | 231 InterfaceProxy* proxy = target_proxies_[id].get(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 dispatcher_ = static_cast<HostDispatcher*>(dispatcher); | 268 dispatcher_ = static_cast<HostDispatcher*>(dispatcher); |
267 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); | 269 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); |
268 } | 270 } |
269 | 271 |
270 ScopedModuleReference::~ScopedModuleReference() { | 272 ScopedModuleReference::~ScopedModuleReference() { |
271 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); | 273 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); |
272 } | 274 } |
273 | 275 |
274 } // namespace proxy | 276 } // namespace proxy |
275 } // namespace ppapi | 277 } // namespace ppapi |
OLD | NEW |