| OLD | NEW |
| 1 // Copyright (c) 2012 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/plugin_resource_tracker.h" | 5 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "ppapi/proxy/plugin_dispatcher.h" | 9 #include "ppapi/proxy/plugin_dispatcher.h" |
| 10 #include "ppapi/proxy/plugin_globals.h" | 10 #include "ppapi/proxy/plugin_globals.h" |
| 11 #include "ppapi/proxy/ppapi_messages.h" | 11 #include "ppapi/proxy/ppapi_messages.h" |
| 12 #include "ppapi/proxy/serialized_var.h" | 12 #include "ppapi/proxy/serialized_var.h" |
| 13 #include "ppapi/shared_impl/proxy_lock.h" | 13 #include "ppapi/shared_impl/proxy_lock.h" |
| 14 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
| 15 #include "ppapi/shared_impl/var.h" | 15 #include "ppapi/shared_impl/var.h" |
| 16 | 16 |
| 17 namespace ppapi { | 17 namespace ppapi { |
| 18 namespace proxy { | 18 namespace proxy { |
| 19 | 19 |
| 20 PluginResourceTracker::PluginResourceTracker() { | 20 PluginResourceTracker::PluginResourceTracker() { |
| 21 #ifdef ENABLE_PEPPER_THREADING |
| 22 // Set the global proxy lock, since the plugin-side of the proxy needs to be |
| 23 // synchronized. |
| 24 ppapi::ProxyLock::Set(&proxy_lock_); |
| 25 #endif |
| 21 } | 26 } |
| 22 | 27 |
| 23 PluginResourceTracker::~PluginResourceTracker() { | 28 PluginResourceTracker::~PluginResourceTracker() { |
| 29 #ifdef ENABLE_PEPPER_THREADING |
| 30 ppapi::ProxyLock::Reset(); |
| 31 #endif |
| 24 } | 32 } |
| 25 | 33 |
| 26 PP_Resource PluginResourceTracker::PluginResourceForHostResource( | 34 PP_Resource PluginResourceTracker::PluginResourceForHostResource( |
| 27 const HostResource& resource) const { | 35 const HostResource& resource) const { |
| 28 HostResourceMap::const_iterator found = host_resource_map_.find(resource); | 36 HostResourceMap::const_iterator found = host_resource_map_.find(resource); |
| 29 if (found == host_resource_map_.end()) | 37 if (found == host_resource_map_.end()) |
| 30 return 0; | 38 return 0; |
| 31 return found->second; | 39 return found->second; |
| 32 } | 40 } |
| 33 | 41 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 57 // the instance was destroyed. In that case the browser-side resource has | 65 // the instance was destroyed. In that case the browser-side resource has |
| 58 // already been freed correctly on the browser side. | 66 // already been freed correctly on the browser side. |
| 59 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource( | 67 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource( |
| 60 API_ID_PPB_CORE, object->host_resource())); | 68 API_ID_PPB_CORE, object->host_resource())); |
| 61 } | 69 } |
| 62 } | 70 } |
| 63 } | 71 } |
| 64 | 72 |
| 65 } // namespace proxy | 73 } // namespace proxy |
| 66 } // namespace ppapi | 74 } // namespace ppapi |
| OLD | NEW |