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/host_dispatcher.h" | 5 #include "ppapi/proxy/host_dispatcher.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ppapi/c/private/ppb_proxy_private.h" | 9 #include "ppapi/c/private/ppb_proxy_private.h" |
10 #include "ppapi/c/ppb_var.h" | 10 #include "ppapi/c/ppb_var.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 const void* proxied_interface = | 217 const void* proxied_interface = |
218 InterfaceList::GetInstance()->GetInterfaceForPPP(iface_name); | 218 InterfaceList::GetInstance()->GetInterfaceForPPP(iface_name); |
219 if (!proxied_interface) | 219 if (!proxied_interface) |
220 return NULL; // Don't have a proxy for this interface, don't query further. | 220 return NULL; // Don't have a proxy for this interface, don't query further. |
221 | 221 |
222 PluginSupportedMap::iterator iter(plugin_supported_.find(iface_name)); | 222 PluginSupportedMap::iterator iter(plugin_supported_.find(iface_name)); |
223 if (iter == plugin_supported_.end()) { | 223 if (iter == plugin_supported_.end()) { |
224 // Need to query. Cache the result so we only do this once. | 224 // Need to query. Cache the result so we only do this once. |
225 bool supported = false; | 225 bool supported = false; |
226 | 226 |
227 Send(new PpapiMsg_IsInterfaceSupported(iface_name, &supported)); | 227 bool previous_reentrancy_value = allow_plugin_reentrancy_; |
| 228 allow_plugin_reentrancy_ = true; |
| 229 Send(new PpapiMsg_SupportsInterface(iface_name, &supported)); |
| 230 allow_plugin_reentrancy_ = previous_reentrancy_value; |
228 | 231 |
229 std::pair<PluginSupportedMap::iterator, bool> iter_success_pair; | 232 std::pair<PluginSupportedMap::iterator, bool> iter_success_pair; |
230 iter_success_pair = plugin_supported_.insert( | 233 iter_success_pair = plugin_supported_.insert( |
231 PluginSupportedMap::value_type(iface_name, supported)); | 234 PluginSupportedMap::value_type(iface_name, supported)); |
232 iter = iter_success_pair.first; | 235 iter = iter_success_pair.first; |
233 } | 236 } |
234 if (iter->second) | 237 if (iter->second) |
235 return proxied_interface; | 238 return proxied_interface; |
236 return NULL; | 239 return NULL; |
237 } | 240 } |
(...skipping 26 matching lines...) Expand all Loading... |
264 const std::string& value) { | 267 const std::string& value) { |
265 PP_LogLevel level = static_cast<PP_LogLevel>(int_log_level); | 268 PP_LogLevel level = static_cast<PP_LogLevel>(int_log_level); |
266 if (instance) { | 269 if (instance) { |
267 PpapiGlobals::Get()->LogWithSource(instance, level, source, value); | 270 PpapiGlobals::Get()->LogWithSource(instance, level, source, value); |
268 } else { | 271 } else { |
269 PpapiGlobals::Get()->BroadcastLogWithSource(pp_module_, level, | 272 PpapiGlobals::Get()->BroadcastLogWithSource(pp_module_, level, |
270 source, value); | 273 source, value); |
271 } | 274 } |
272 } | 275 } |
273 | 276 |
274 void HostDispatcher::OnHostMsgPluginSupportsInterface( | |
275 const std::string& interface_name) { | |
276 plugin_supported_[interface_name] = true; | |
277 } | |
278 | |
279 // ScopedModuleReference ------------------------------------------------------- | 277 // ScopedModuleReference ------------------------------------------------------- |
280 | 278 |
281 ScopedModuleReference::ScopedModuleReference(Dispatcher* dispatcher) | 279 ScopedModuleReference::ScopedModuleReference(Dispatcher* dispatcher) |
282 : dispatcher_(NULL) { | 280 : dispatcher_(NULL) { |
283 if (!dispatcher->IsPlugin()) { | 281 if (!dispatcher->IsPlugin()) { |
284 dispatcher_ = static_cast<HostDispatcher*>(dispatcher); | 282 dispatcher_ = static_cast<HostDispatcher*>(dispatcher); |
285 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); | 283 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); |
286 } | 284 } |
287 } | 285 } |
288 | 286 |
289 ScopedModuleReference::~ScopedModuleReference() { | 287 ScopedModuleReference::~ScopedModuleReference() { |
290 if (dispatcher_) | 288 if (dispatcher_) |
291 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); | 289 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); |
292 } | 290 } |
293 | 291 |
294 } // namespace proxy | 292 } // namespace proxy |
295 } // namespace ppapi | 293 } // namespace ppapi |
OLD | NEW |