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

Unified Diff: webkit/plugins/ppapi/resource_tracker.h

Issue 8316008: Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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: webkit/plugins/ppapi/resource_tracker.h
diff --git a/webkit/plugins/ppapi/resource_tracker.h b/webkit/plugins/ppapi/resource_tracker.h
index 79de8be58163f38e92ddc9c8ad9dc5bfc2acf6c8..221a8f9bf944d6e8840de6eb806e6105a871f0e0 100644
--- a/webkit/plugins/ppapi/resource_tracker.h
+++ b/webkit/plugins/ppapi/resource_tracker.h
@@ -45,8 +45,8 @@ class ResourceTrackerTest;
class ResourceTracker : public ::ppapi::TrackerBase,
public ::ppapi::ResourceTracker {
public:
- // Returns the pointer to the singleton object.
- static ResourceTracker* Get();
+ ResourceTracker();
+ virtual ~ResourceTracker();
// PP_Resources --------------------------------------------------------------
@@ -54,8 +54,6 @@ class ResourceTracker : public ::ppapi::TrackerBase,
virtual ::ppapi::FunctionGroupBase* GetFunctionAPI(
PP_Instance pp_instance,
::ppapi::proxy::InterfaceID id) OVERRIDE;
- virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE;
- virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE;
virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
// ppapi::ResourceTracker overrides.
@@ -119,46 +117,11 @@ class ResourceTracker : public ::ppapi::TrackerBase,
// Per-instance data we track.
struct InstanceData;
- // Prohibit creation other then by the Singleton class.
- ResourceTracker();
- virtual ~ResourceTracker();
-
// Force frees all vars and resources associated with the given instance.
// If delete_instance is true, the instance tracking information will also
// be deleted.
void CleanupInstanceData(PP_Instance instance, bool delete_instance);
- // Overrides the singleton object. This is used for tests which want to
- // specify their own tracker (otherwise, you can get cross-talk between
- // tests since the data will live into the subsequent tests).
- static void SetSingletonOverride(ResourceTracker* tracker);
- static void ClearSingletonOverride();
-
- // The lazy-initialized global instance of this object. This is created in
- // ::Get() if there is no singleton_override_ specified.
- //
- // It would be nice to use LazyInstance for this since it manages the
- // creation properly, and also cleans up on shutdown. However, the shutdown
- // cleanup causes problems in some cases.
- //
- // For example, say the browser crashes or is killed. The renderer then
- // decides to exit. Normally resources are bound to an instance and are
- // cleaned up when WebKit deletes the instance (when you go to a different
- // page or close that view). In this case, WebKit doesn't clean up. If the
- // ResourceTracker was cleaned up by the AtExitManager (which would be the
- // case with LazyInstance/Singleton) then we'd try to call up to the renderer
- // layer via the delegate, which may be in a random state of shutdown.
- //
- // So effectively our rule is: any resources still around at shutdown are
- // associated with leaked plugins in WebKit, so it's also OK to leak those
- // resources from here (avoiding the shutdown race).
- static ResourceTracker* global_tracker_;
-
- // See SetSingletonOverride above.
- static ResourceTracker* singleton_override_;
-
- ::ppapi::VarTracker var_tracker_;
-
// Like ResourceAndRefCount but for vars, which are associated with modules.
typedef std::pair<scoped_refptr< ::ppapi::Var>, size_t> VarAndRefCount;
typedef base::hash_map<int32, VarAndRefCount> VarMap;

Powered by Google App Engine
This is Rietveld 408576698