Add a new globals object for PPAPI tracking information.
[ Reland of 106142: http://codereview.chromium.org/8316008 ]
This adds a specialization on the host and plugin side of the proxy. This
replaces the ad-hoc singleton tracking done by the resource and var trackers
with just being getters on this global object.
Most code can use the single PpapiGlobals class. I also allow code to get the
host and plugin specializations since some code needs access to some specific
features of each side.
In a later pass I'll move the other stuff out of TrackerBase and delete it.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/8344025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106537 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/plugin_resource_tracker.h b/ppapi/proxy/plugin_resource_tracker.h
index 30fafb2..cf87787 100644
--- a/ppapi/proxy/plugin_resource_tracker.h
+++ b/ppapi/proxy/plugin_resource_tracker.h
@@ -15,7 +15,6 @@
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
-#include "ppapi/proxy/plugin_var_tracker.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/resource_tracker.h"
@@ -34,13 +33,9 @@
class PPAPI_PROXY_EXPORT 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
- // around across tests.
- static void SetInstanceForTest(PluginResourceTracker* tracker);
+ PluginResourceTracker();
+ virtual ~PluginResourceTracker();
- // Returns the global singleton resource tracker for the plugin.
- static PluginResourceTracker* GetInstance();
static TrackerBase* GetTrackerBaseInstance();
// Given a host resource, maps it to an existing plugin resource ID if it
@@ -48,20 +43,9 @@
PP_Resource PluginResourceForHostResource(
const HostResource& resource) const;
- PluginVarTracker& var_tracker() {
- return var_tracker_test_override_ ? *var_tracker_test_override_
- : var_tracker_;
- }
-
- void set_var_tracker_test_override(PluginVarTracker* t) {
- var_tracker_test_override_ = t;
- }
-
// TrackerBase.
virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst,
InterfaceID id) OVERRIDE;
- virtual VarTracker* GetVarTracker() OVERRIDE;
- virtual ResourceTracker* GetResourceTracker() OVERRIDE;
virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
protected:
@@ -70,24 +54,6 @@
virtual void RemoveResource(Resource* object) OVERRIDE;
private:
- friend struct DefaultSingletonTraits<PluginResourceTracker>;
- friend class PluginResourceTrackerTest;
- friend class PluginProxyTestHarness;
-
- PluginResourceTracker();
- virtual ~PluginResourceTracker();
-
- // 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
- // of some global object that manages PPAPI globals, including separate var
- // and resource trackers.
- PluginVarTracker var_tracker_;
-
- // Non-owning pointer to a var tracker mock used by tests. NULL when no
- // test implementation is provided.
- PluginVarTracker* var_tracker_test_override_;
-
// Map of host instance/resource pairs to a plugin resource ID.
typedef std::map<HostResource, PP_Resource> HostResourceMap;
HostResourceMap host_resource_map_;