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 bool previous_reentrancy_value = allow_plugin_reentrancy_; | 227 Send(new PpapiMsg_IsInterfaceSupported(iface_name, &supported)); |
228 allow_plugin_reentrancy_ = true; | |
229 Send(new PpapiMsg_SupportsInterface(iface_name, &supported)); | |
230 allow_plugin_reentrancy_ = previous_reentrancy_value; | |
231 | 228 |
232 std::pair<PluginSupportedMap::iterator, bool> iter_success_pair; | 229 std::pair<PluginSupportedMap::iterator, bool> iter_success_pair; |
233 iter_success_pair = plugin_supported_.insert( | 230 iter_success_pair = plugin_supported_.insert( |
234 PluginSupportedMap::value_type(iface_name, supported)); | 231 PluginSupportedMap::value_type(iface_name, supported)); |
235 iter = iter_success_pair.first; | 232 iter = iter_success_pair.first; |
236 } | 233 } |
237 if (iter->second) | 234 if (iter->second) |
238 return proxied_interface; | 235 return proxied_interface; |
239 return NULL; | 236 return NULL; |
240 } | 237 } |
(...skipping 26 matching lines...) Expand all Loading... |
267 const std::string& value) { | 264 const std::string& value) { |
268 PP_LogLevel level = static_cast<PP_LogLevel>(int_log_level); | 265 PP_LogLevel level = static_cast<PP_LogLevel>(int_log_level); |
269 if (instance) { | 266 if (instance) { |
270 PpapiGlobals::Get()->LogWithSource(instance, level, source, value); | 267 PpapiGlobals::Get()->LogWithSource(instance, level, source, value); |
271 } else { | 268 } else { |
272 PpapiGlobals::Get()->BroadcastLogWithSource(pp_module_, level, | 269 PpapiGlobals::Get()->BroadcastLogWithSource(pp_module_, level, |
273 source, value); | 270 source, value); |
274 } | 271 } |
275 } | 272 } |
276 | 273 |
| 274 void HostDispatcher::OnHostMsgPluginSupportsInterface( |
| 275 const std::string& interface_name) { |
| 276 plugin_supported_[interface_name] = true; |
| 277 } |
| 278 |
277 // ScopedModuleReference ------------------------------------------------------- | 279 // ScopedModuleReference ------------------------------------------------------- |
278 | 280 |
279 ScopedModuleReference::ScopedModuleReference(Dispatcher* dispatcher) | 281 ScopedModuleReference::ScopedModuleReference(Dispatcher* dispatcher) |
280 : dispatcher_(NULL) { | 282 : dispatcher_(NULL) { |
281 if (!dispatcher->IsPlugin()) { | 283 if (!dispatcher->IsPlugin()) { |
282 dispatcher_ = static_cast<HostDispatcher*>(dispatcher); | 284 dispatcher_ = static_cast<HostDispatcher*>(dispatcher); |
283 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); | 285 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); |
284 } | 286 } |
285 } | 287 } |
286 | 288 |
287 ScopedModuleReference::~ScopedModuleReference() { | 289 ScopedModuleReference::~ScopedModuleReference() { |
288 if (dispatcher_) | 290 if (dispatcher_) |
289 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); | 291 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); |
290 } | 292 } |
291 | 293 |
292 } // namespace proxy | 294 } // namespace proxy |
293 } // namespace ppapi | 295 } // namespace ppapi |
OLD | NEW |