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

Side by Side Diff: webkit/glue/plugins/pepper_resource_tracker.h

Issue 5682008: Make members of Singleton<T> private and only visible to the singleton type. (Closed) Base URL: svn://svn.chromium.org/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
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_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_ 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_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
19 namespace base {
20 template <typename T> struct DefaultLazyInstanceTraits;
21 }
22
20 namespace pepper { 23 namespace pepper {
21 24
22 class PluginInstance; 25 class PluginInstance;
23 class PluginModule; 26 class PluginModule;
24 class Resource; 27 class Resource;
25 class ResourceTrackerTest; 28 class ResourceTrackerTest;
26 29
27 // This class maintains a global list of all live pepper resources. It allows 30 // 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. 31 // us to check resource ID validity and to map them to a specific module.
29 // 32 //
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 87
85 // Called when a plugin instance was deleted and should no longer be tracked. 88 // Called when a plugin instance was deleted and should no longer be tracked.
86 // The given handle should be one generated by AddInstance. 89 // The given handle should be one generated by AddInstance.
87 void InstanceDeleted(PP_Instance instance); 90 void InstanceDeleted(PP_Instance instance);
88 91
89 // Returns a pointer to the plugin instance object associated with the given 92 // 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. 93 // instance handle. The return value will be NULL if the handle is invalid.
91 PluginInstance* GetInstance(PP_Instance instance); 94 PluginInstance* GetInstance(PP_Instance instance);
92 95
93 private: 96 private:
94 friend struct DefaultSingletonTraits<ResourceTracker>; 97 friend struct base::DefaultLazyInstanceTraits<ResourceTracker>;
95 friend class Resource; 98 friend class Resource;
96 friend class ResourceTrackerTest; 99 friend class ResourceTrackerTest;
97 100
98 // Prohibit creation other then by the Singleton class. 101 // Prohibit creation other then by the Singleton class.
99 ResourceTracker(); 102 ResourceTracker();
100 ~ResourceTracker(); 103 ~ResourceTracker();
101 104
102 // Adds the given resource to the tracker and assigns it a resource ID and 105 // 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 106 // refcount of 1. The assigned resource ID will be returned. Used only by the
104 // Resource class. 107 // Resource class.
(...skipping 30 matching lines...) Expand all
135 // destructor will notify us when the module is deleted. 138 // destructor will notify us when the module is deleted.
136 typedef std::map<PP_Module, PluginModule*> ModuleMap; 139 typedef std::map<PP_Module, PluginModule*> ModuleMap;
137 ModuleMap module_map_; 140 ModuleMap module_map_;
138 141
139 DISALLOW_COPY_AND_ASSIGN(ResourceTracker); 142 DISALLOW_COPY_AND_ASSIGN(ResourceTracker);
140 }; 143 };
141 144
142 } // namespace pepper 145 } // namespace pepper
143 146
144 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_ 147 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698