Index: ppapi/proxy/plugin_resource_tracker.h |
diff --git a/ppapi/proxy/plugin_resource_tracker.h b/ppapi/proxy/plugin_resource_tracker.h |
index f788c6c135b6989e86d0b82b892fea920e4c0bd9..ccc6d700b69e2b037c82d9552453510b955f57db 100644 |
--- a/ppapi/proxy/plugin_resource_tracker.h |
+++ b/ppapi/proxy/plugin_resource_tracker.h |
@@ -16,6 +16,7 @@ |
#include "ppapi/c/pp_var.h" |
#include "ppapi/proxy/plugin_var_tracker.h" |
#include "ppapi/shared_impl/host_resource.h" |
+#include "ppapi/shared_impl/resource_tracker.h" |
#include "ppapi/shared_impl/tracker_base.h" |
template<typename T> struct DefaultSingletonTraits; |
@@ -28,9 +29,9 @@ namespace pp { |
namespace proxy { |
class PluginDispatcher; |
-class PluginResource; |
-class PluginResourceTracker : public ::ppapi::TrackerBase { |
+class PluginResourceTracker : public ppapi::TrackerBase, |
+ public ppapi::ResourceTracker { |
public: |
// Called by tests that want to specify a specific ResourceTracker. This |
// allows them to use a unique one each time and avoids singletons sticking |
@@ -41,21 +42,6 @@ class PluginResourceTracker : public ::ppapi::TrackerBase { |
static PluginResourceTracker* GetInstance(); |
static ::ppapi::TrackerBase* GetTrackerBaseInstance(); |
- // Returns the object associated with the given resource ID, or NULL if |
- // there isn't one. |
- PluginResource* GetResourceObject(PP_Resource pp_resource); |
- |
- // Adds the given resource object to the tracked list, and returns the |
- // plugin-local PP_Resource ID that identifies the resource. Note that this |
- // PP_Resource is not valid to send to the host, use |
- // PluginResource.host_resource() to get that. |
- // |
- // The resource tracker will take a reference to the given object. |
- PP_Resource AddResource(PluginResource* object); |
- |
- void AddRefResource(PP_Resource resource); |
- void ReleaseResource(PP_Resource resource); |
- |
// Given a host resource, maps it to an existing plugin resource ID if it |
// exists, or returns 0 on failure. |
PP_Resource PluginResourceForHostResource( |
@@ -71,13 +57,16 @@ class PluginResourceTracker : public ::ppapi::TrackerBase { |
} |
// TrackerBase. |
- virtual ppapi::ResourceObjectBase* GetResourceAPI( |
- PP_Resource res) OVERRIDE; |
virtual ppapi::FunctionGroupBase* GetFunctionAPI( |
PP_Instance inst, |
pp::proxy::InterfaceID id) OVERRIDE; |
- virtual PP_Instance GetInstanceForResource(PP_Resource resource) OVERRIDE; |
virtual ppapi::VarTracker* GetVarTracker() OVERRIDE; |
+ virtual ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; |
+ |
+ protected: |
+ // ResourceTracker overrides. |
+ virtual PP_Resource AddResource(ppapi::Resource* object) OVERRIDE; |
+ virtual void RemoveResource(ppapi::Resource* object) OVERRIDE; |
private: |
friend struct DefaultSingletonTraits<PluginResourceTracker>; |
@@ -87,21 +76,6 @@ class PluginResourceTracker : public ::ppapi::TrackerBase { |
PluginResourceTracker(); |
virtual ~PluginResourceTracker(); |
- struct ResourceInfo { |
- ResourceInfo(); |
- ResourceInfo(int ref_count, PluginResource* r); |
- ResourceInfo(const ResourceInfo& other); |
- ~ResourceInfo(); |
- |
- ResourceInfo& operator=(const ResourceInfo& other); |
- |
- int ref_count; |
- scoped_refptr<PluginResource> resource; // May be NULL. |
- }; |
- |
- void ReleasePluginResourceRef(const PP_Resource& var, |
- bool notify_browser_on_release); |
- |
// Use the var_tracker_test_override_ instead if it's non-NULL. |
// |
// TODO(brettw) this should be somehow separated out from here. I'm thinking |
@@ -113,18 +87,10 @@ class PluginResourceTracker : public ::ppapi::TrackerBase { |
// test implementation is provided. |
PluginVarTracker* var_tracker_test_override_; |
- // Map of plugin resource IDs to the information tracking that resource. |
- typedef std::map<PP_Resource, ResourceInfo> ResourceMap; |
- ResourceMap resource_map_; |
- |
// Map of host instance/resource pairs to a plugin resource ID. |
typedef std::map<ppapi::HostResource, PP_Resource> HostResourceMap; |
HostResourceMap host_resource_map_; |
- // Tracks the last ID we've sent out as a plugin resource so we don't send |
- // duplicates. |
- PP_Resource last_resource_id_; |
- |
DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker); |
}; |