| 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/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 | |
| 26 } | 21 } |
| 27 | 22 |
| 28 PluginResourceTracker::~PluginResourceTracker() { | 23 PluginResourceTracker::~PluginResourceTracker() { |
| 29 #ifdef ENABLE_PEPPER_THREADING | |
| 30 ppapi::ProxyLock::Reset(); | |
| 31 #endif | |
| 32 } | 24 } |
| 33 | 25 |
| 34 PP_Resource PluginResourceTracker::PluginResourceForHostResource( | 26 PP_Resource PluginResourceTracker::PluginResourceForHostResource( |
| 35 const HostResource& resource) const { | 27 const HostResource& resource) const { |
| 36 HostResourceMap::const_iterator found = host_resource_map_.find(resource); | 28 HostResourceMap::const_iterator found = host_resource_map_.find(resource); |
| 37 if (found == host_resource_map_.end()) | 29 if (found == host_resource_map_.end()) |
| 38 return 0; | 30 return 0; |
| 39 return found->second; | 31 return found->second; |
| 40 } | 32 } |
| 41 | 33 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 65 // the instance was destroyed. In that case the browser-side resource has | 57 // the instance was destroyed. In that case the browser-side resource has |
| 66 // already been freed correctly on the browser side. | 58 // already been freed correctly on the browser side. |
| 67 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource( | 59 dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource( |
| 68 API_ID_PPB_CORE, object->host_resource())); | 60 API_ID_PPB_CORE, object->host_resource())); |
| 69 } | 61 } |
| 70 } | 62 } |
| 71 } | 63 } |
| 72 | 64 |
| 73 } // namespace proxy | 65 } // namespace proxy |
| 74 } // namespace ppapi | 66 } // namespace ppapi |
| OLD | NEW |