diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 21:58:02 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 21:58:02 +0000 |
commit | 4d2efd2e100bc961d3e19e0a6f242c7914917690 (patch) | |
tree | c29e1a627687c0ef29a207378ff19fcd9927fb67 /ppapi/proxy/plugin_resource_tracker.h | |
parent | 6fa9e6f0c0fd3a66789de9df381cc16c36ca6da1 (diff) | |
download | chromium_src-4d2efd2e100bc961d3e19e0a6f242c7914917690.zip chromium_src-4d2efd2e100bc961d3e19e0a6f242c7914917690.tar.gz chromium_src-4d2efd2e100bc961d3e19e0a6f242c7914917690.tar.bz2 |
Convert the pp::proxy namespace to the ppapi::proxy namespace.
This is more consistent with the stuff in shared_impl, and removes a lot of
namespace using goop.
Add a unified resource tracker shared between the proxy and the impl.
This renames the old ResourceObjectBase to Resource and removes the old
PluginResource. It moves the resource tracker from the impl to the
shared_impl, and makes the proxy use it.
Some things become a little less neat because there's no proxy resource base
class. In particular GetDispatcher() is now gone. I considered whether to
add a helper base class that provides this function, but decided against it
and had individual resource classes implement this when their implementation
would find it useful. This is because ultimately I want more of this
functionality to move into the shared_impl, and it's easier to do that if
there are fewer proxy-specific things in the resources.
This changes the way that plugins are added to the tracker. Previously they
would only be in the tracker if the plugin had a reference to them, although
they could be alive if the impl had a scoped_ptr referencing an object. This
actually has the bug that if we then give the resource back to the plugin,
it wouldn't be refcounted properly and everything would get confused.
Now the tracker tracks all live resource objects whether or not the plugin
has a ref. This works basically like the var tracker (it would be nice if
the var and resource trackers shared more code, but that would further
complicate this already overcomplicated patch). The resource tracker takes an
extra ref whenever the plugin has one or more, and otherwise just tracks live
resources.
BUG=
TEST=
Review URL: http://codereview.chromium.org/7655002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97367 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/plugin_resource_tracker.h')
-rw-r--r-- | ppapi/proxy/plugin_resource_tracker.h | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/ppapi/proxy/plugin_resource_tracker.h b/ppapi/proxy/plugin_resource_tracker.h index ccc6d70..d45ef6d 100644 --- a/ppapi/proxy/plugin_resource_tracker.h +++ b/ppapi/proxy/plugin_resource_tracker.h @@ -22,16 +22,14 @@ template<typename T> struct DefaultSingletonTraits; namespace ppapi { + class Var; -} -namespace pp { namespace proxy { class PluginDispatcher; -class PluginResourceTracker : public ppapi::TrackerBase, - public ppapi::ResourceTracker { +class PluginResourceTracker : public TrackerBase, public 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 @@ -40,12 +38,12 @@ class PluginResourceTracker : public ppapi::TrackerBase, // Returns the global singleton resource tracker for the plugin. static PluginResourceTracker* GetInstance(); - static ::ppapi::TrackerBase* GetTrackerBaseInstance(); + static TrackerBase* GetTrackerBaseInstance(); // Given a host resource, maps it to an existing plugin resource ID if it // exists, or returns 0 on failure. PP_Resource PluginResourceForHostResource( - const ppapi::HostResource& resource) const; + const HostResource& resource) const; PluginVarTracker& var_tracker() { return var_tracker_test_override_ ? *var_tracker_test_override_ @@ -57,16 +55,15 @@ class PluginResourceTracker : public ppapi::TrackerBase, } // TrackerBase. - virtual ppapi::FunctionGroupBase* GetFunctionAPI( - PP_Instance inst, - pp::proxy::InterfaceID id) OVERRIDE; - virtual ppapi::VarTracker* GetVarTracker() OVERRIDE; - virtual ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; + virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, + InterfaceID id) OVERRIDE; + virtual VarTracker* GetVarTracker() OVERRIDE; + virtual ResourceTracker* GetResourceTracker() OVERRIDE; protected: // ResourceTracker overrides. - virtual PP_Resource AddResource(ppapi::Resource* object) OVERRIDE; - virtual void RemoveResource(ppapi::Resource* object) OVERRIDE; + virtual PP_Resource AddResource(Resource* object) OVERRIDE; + virtual void RemoveResource(Resource* object) OVERRIDE; private: friend struct DefaultSingletonTraits<PluginResourceTracker>; @@ -88,13 +85,13 @@ class PluginResourceTracker : public ppapi::TrackerBase, PluginVarTracker* var_tracker_test_override_; // Map of host instance/resource pairs to a plugin resource ID. - typedef std::map<ppapi::HostResource, PP_Resource> HostResourceMap; + typedef std::map<HostResource, PP_Resource> HostResourceMap; HostResourceMap host_resource_map_; DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker); }; } // namespace proxy -} // namespace pp +} // namespace ppapi #endif // PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_ |