| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_PLUGINS_PPAPI_RESOURCE_TRACKER_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_RESOURCE_TRACKER_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_RESOURCE_TRACKER_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_RESOURCE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 friend class Resource; | 96 friend class Resource; |
| 97 friend class ResourceTrackerTest; | 97 friend class ResourceTrackerTest; |
| 98 friend class Var; | 98 friend class Var; |
| 99 | 99 |
| 100 typedef std::set<PP_Resource> ResourceSet; | 100 typedef std::set<PP_Resource> ResourceSet; |
| 101 | 101 |
| 102 // Indexed by the var ID. | 102 // Indexed by the var ID. |
| 103 typedef std::set<int32> VarSet; | 103 typedef std::set<int32> VarSet; |
| 104 | 104 |
| 105 // Per-instance data we track. | 105 // Per-instance data we track. |
| 106 struct InstanceData { | 106 struct InstanceData; |
| 107 InstanceData() : instance(0) {} | |
| 108 | |
| 109 // Non-owning pointer to the instance object. When a PluginInstance is | |
| 110 // destroyed, it will notify us and we'll delete all associated data. | |
| 111 PluginInstance* instance; | |
| 112 | |
| 113 // Resources and object vars associated with the instance. | |
| 114 ResourceSet resources; | |
| 115 VarSet object_vars; | |
| 116 }; | |
| 117 | 107 |
| 118 // Prohibit creation other then by the Singleton class. | 108 // Prohibit creation other then by the Singleton class. |
| 119 ResourceTracker(); | 109 ResourceTracker(); |
| 120 ~ResourceTracker(); | 110 ~ResourceTracker(); |
| 121 | 111 |
| 122 // Adds the given resource to the tracker and assigns it a resource ID and | 112 // Adds the given resource to the tracker and assigns it a resource ID and |
| 123 // refcount of 1. The assigned resource ID will be returned. Used only by the | 113 // refcount of 1. The assigned resource ID will be returned. Used only by the |
| 124 // Resource class. | 114 // Resource class. |
| 125 PP_Resource AddResource(Resource* resource); | 115 PP_Resource AddResource(Resource* resource); |
| 126 | 116 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 typedef std::map<PP_Module, PluginModule*> ModuleMap; | 154 typedef std::map<PP_Module, PluginModule*> ModuleMap; |
| 165 ModuleMap module_map_; | 155 ModuleMap module_map_; |
| 166 | 156 |
| 167 DISALLOW_COPY_AND_ASSIGN(ResourceTracker); | 157 DISALLOW_COPY_AND_ASSIGN(ResourceTracker); |
| 168 }; | 158 }; |
| 169 | 159 |
| 170 } // namespace ppapi | 160 } // namespace ppapi |
| 171 } // namespace webkit | 161 } // namespace webkit |
| 172 | 162 |
| 173 #endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_TRACKER_H_ | 163 #endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_TRACKER_H_ |
| OLD | NEW |