Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: ppapi/proxy/plugin_resource_tracker.cc

Issue 7608030: Convert the PluginResource to be refcounted. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/proxy/plugin_resource_tracker.cc
diff --git a/ppapi/proxy/plugin_resource_tracker.cc b/ppapi/proxy/plugin_resource_tracker.cc
index cabf9cbabccedcad53b52b9b8bb6e80cdb1d2073..a82ccef583e91d4d99fc6c20d75e7083ee5fb046 100644
--- a/ppapi/proxy/plugin_resource_tracker.cc
+++ b/ppapi/proxy/plugin_resource_tracker.cc
@@ -30,8 +30,7 @@ PluginResourceTracker* g_resource_tracker_override = NULL;
PluginResourceTracker::ResourceInfo::ResourceInfo() : ref_count(0) {
}
-PluginResourceTracker::ResourceInfo::ResourceInfo(int rc,
- linked_ptr<PluginResource> r)
+PluginResourceTracker::ResourceInfo::ResourceInfo(int rc, PluginResource* r)
: ref_count(rc),
resource(r) {
}
@@ -90,8 +89,7 @@ PluginResource* PluginResourceTracker::GetResourceObject(
return found->second.resource.get();
}
-PP_Resource PluginResourceTracker::AddResource(
- linked_ptr<PluginResource> object) {
+PP_Resource PluginResourceTracker::AddResource(PluginResource* object) {
PP_Resource plugin_resource = ++last_resource_id_;
DCHECK(resource_map_.find(plugin_resource) == resource_map_.end());
resource_map_[plugin_resource] = ResourceInfo(1, object);
@@ -164,14 +162,14 @@ void PluginResourceTracker::ReleasePluginResourceRef(
// Keep a reference while removing in case the destructor ends up
// re-entering. That way, when the destructor is called, it's out of the
// maps.
- linked_ptr<PluginResource> plugin_resource = found->second.resource;
+ scoped_refptr<PluginResource> plugin_resource = found->second.resource;
PluginDispatcher* dispatcher =
PluginDispatcher::GetForInstance(plugin_resource->instance());
HostResource host_resource = plugin_resource->host_resource();
if (!host_resource.is_null())
host_resource_map_.erase(host_resource);
resource_map_.erase(found);
- plugin_resource.reset();
+ plugin_resource = NULL;
// dispatcher can be NULL if the plugin held on to a resource after the
// instance was destroyed. In that case the browser-side resource has

Powered by Google App Engine
This is Rietveld 408576698