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

Side by Side Diff: webkit/plugins/ppapi/resource_tracker.h

Issue 5828003: Move the Pepper implementation from webkit/glue/plugins/pepper_* to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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
« no previous file with comments | « webkit/plugins/ppapi/resource.cc ('k') | webkit/plugins/ppapi/resource_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_RESOURCE_TRACKER_H_
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_ 6 #define WEBKIT_PLUGINS_PPAPI_RESOURCE_TRACKER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/hash_tables.h" 13 #include "base/hash_tables.h"
14 #include "base/ref_counted.h" 14 #include "base/ref_counted.h"
15 #include "base/singleton.h"
16 #include "ppapi/c/pp_instance.h" 15 #include "ppapi/c/pp_instance.h"
17 #include "ppapi/c/pp_module.h" 16 #include "ppapi/c/pp_module.h"
18 #include "ppapi/c/pp_resource.h" 17 #include "ppapi/c/pp_resource.h"
19 18
20 namespace pepper { 19 namespace base {
20 template <typename T> struct DefaultLazyInstanceTraits;
21 }
22
23 namespace webkit {
24 namespace ppapi {
21 25
22 class PluginInstance; 26 class PluginInstance;
23 class PluginModule; 27 class PluginModule;
24 class Resource; 28 class Resource;
25 class ResourceTrackerTest; 29 class ResourceTrackerTest;
26 30
27 // This class maintains a global list of all live pepper resources. It allows 31 // This class maintains a global list of all live pepper resources. It allows
28 // us to check resource ID validity and to map them to a specific module. 32 // us to check resource ID validity and to map them to a specific module.
29 // 33 //
30 // This object is threadsafe. 34 // This object is threadsafe.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 88
85 // Called when a plugin instance was deleted and should no longer be tracked. 89 // Called when a plugin instance was deleted and should no longer be tracked.
86 // The given handle should be one generated by AddInstance. 90 // The given handle should be one generated by AddInstance.
87 void InstanceDeleted(PP_Instance instance); 91 void InstanceDeleted(PP_Instance instance);
88 92
89 // Returns a pointer to the plugin instance object associated with the given 93 // Returns a pointer to the plugin instance object associated with the given
90 // instance handle. The return value will be NULL if the handle is invalid. 94 // instance handle. The return value will be NULL if the handle is invalid.
91 PluginInstance* GetInstance(PP_Instance instance); 95 PluginInstance* GetInstance(PP_Instance instance);
92 96
93 private: 97 private:
94 friend struct DefaultSingletonTraits<ResourceTracker>; 98 friend struct base::DefaultLazyInstanceTraits<ResourceTracker>;
95 friend class Resource; 99 friend class Resource;
96 friend class ResourceTrackerTest; 100 friend class ResourceTrackerTest;
97 101
98 // Prohibit creation other then by the Singleton class. 102 // Prohibit creation other then by the Singleton class.
99 ResourceTracker(); 103 ResourceTracker();
100 ~ResourceTracker(); 104 ~ResourceTracker();
101 105
102 // Adds the given resource to the tracker and assigns it a resource ID and 106 // Adds the given resource to the tracker and assigns it a resource ID and
103 // refcount of 1. The assigned resource ID will be returned. Used only by the 107 // refcount of 1. The assigned resource ID will be returned. Used only by the
104 // Resource class. 108 // Resource class.
(...skipping 27 matching lines...) Expand all
132 InstanceMap instance_map_; 136 InstanceMap instance_map_;
133 137
134 // Tracks all live modules. The pointers are non-owning, the PluginModule 138 // Tracks all live modules. The pointers are non-owning, the PluginModule
135 // destructor will notify us when the module is deleted. 139 // destructor will notify us when the module is deleted.
136 typedef std::map<PP_Module, PluginModule*> ModuleMap; 140 typedef std::map<PP_Module, PluginModule*> ModuleMap;
137 ModuleMap module_map_; 141 ModuleMap module_map_;
138 142
139 DISALLOW_COPY_AND_ASSIGN(ResourceTracker); 143 DISALLOW_COPY_AND_ASSIGN(ResourceTracker);
140 }; 144 };
141 145
142 } // namespace pepper 146 } // namespace ppapi
147 } // namespace webkit
143 148
144 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_ 149 #endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_TRACKER_H_
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/resource.cc ('k') | webkit/plugins/ppapi/resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698