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

Side by Side Diff: ppapi/shared_impl/resource_tracker.h

Issue 9015009: Use the new callback tracker and delete the old one (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 12 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_ 5 #ifndef PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_
6 #define PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_ 6 #define PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // resource will have 0 plugin refcount. This is called by the resource 52 // resource will have 0 plugin refcount. This is called by the resource
53 // constructor. 53 // constructor.
54 // 54 //
55 // Returns 0 if the resource could not be added. 55 // Returns 0 if the resource could not be added.
56 virtual PP_Resource AddResource(Resource* object); 56 virtual PP_Resource AddResource(Resource* object);
57 57
58 // The opposite of AddResource, this removes the tracking information for 58 // The opposite of AddResource, this removes the tracking information for
59 // the given resource. It's called from the resource destructor. 59 // the given resource. It's called from the resource destructor.
60 virtual void RemoveResource(Resource* object); 60 virtual void RemoveResource(Resource* object);
61 61
62 // Calls LastPluginRefWasDeleted on the given resource object. This is 62 // Calls LastPluginRefWasDeleted on the given resource object and cancels
63 // provided because the derived class in webkit/plugins/ppapi needs to 63 // pending callbacks for the resource.
64 // perform additional operations at this time. 64 void LastPluginRefWasDeleted(Resource* object);
65 virtual void LastPluginRefWasDeleted(Resource* object);
66 65
67 private: 66 private:
68 typedef std::set<PP_Resource> ResourceSet; 67 typedef std::set<PP_Resource> ResourceSet;
69 68
70 struct InstanceData { 69 struct InstanceData {
71 // Lists all resources associated with the given instance as non-owning 70 // Lists all resources associated with the given instance as non-owning
72 // pointers. This allows us to notify those resources that the instance is 71 // pointers. This allows us to notify those resources that the instance is
73 // going away (otherwise, they may crash if they outlive the instance). 72 // going away (otherwise, they may crash if they outlive the instance).
74 ResourceSet resources; 73 ResourceSet resources;
75 }; 74 };
(...skipping 14 matching lines...) Expand all
90 ResourceMap live_resources_; 89 ResourceMap live_resources_;
91 90
92 int32 last_resource_value_; 91 int32 last_resource_value_;
93 92
94 DISALLOW_COPY_AND_ASSIGN(ResourceTracker); 93 DISALLOW_COPY_AND_ASSIGN(ResourceTracker);
95 }; 94 };
96 95
97 } // namespace ppapi 96 } // namespace ppapi
98 97
99 #endif // PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_ 98 #endif // PPAPI_SHARED_IMPL_RESOURCE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698