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

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.h

Issue 8574027: Remove 1 exit time destructor from ppapi, and possibly fix a bug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert gyp change Created 9 years, 1 month 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 | « no previous file | ppapi/native_client/src/shared/ppapi_proxy/plugin_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) 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 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 "native_client/src/include/nacl_base.h" 11 #include "native_client/src/include/nacl_base.h"
12 #include "native_client/src/include/ref_counted.h" 12 #include "native_client/src/include/ref_counted.h"
13 #include "ppapi/c/pp_instance.h" 13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_module.h" 14 #include "ppapi/c/pp_module.h"
15 #include "ppapi/c/pp_resource.h" 15 #include "ppapi/c/pp_resource.h"
16 16
17 namespace ppapi_proxy { 17 namespace ppapi_proxy {
18 18
19 class PluginResource; 19 class PluginResource;
20 20
21 // This class maintains a global list of all live pepper resources. It allows 21 // This class maintains a global list of all live pepper resources. It allows
22 // us to check resource ID validity and to map them to a specific module. 22 // us to check resource ID validity and to map them to a specific module.
23 // 23 //
24 // This object is threadsafe. 24 // This object is threadsafe.
25 class PluginResourceTracker { 25 class PluginResourceTracker {
26 public: 26 public:
27 // Returns the pointer to the singleton object. 27 // Returns the pointer to the singleton object.
28 static PluginResourceTracker* Get() { 28 static PluginResourceTracker* Get();
29 static PluginResourceTracker tracker;
30 return &tracker;
31 }
32 29
33 // PP_Resources -------------------------------------------------------------- 30 // PP_Resources --------------------------------------------------------------
34 31
35 // Increment resource's plugin refcount. See ResourceAndRefCount. 32 // Increment resource's plugin refcount. See ResourceAndRefCount.
36 bool AddRefResource(PP_Resource res); 33 bool AddRefResource(PP_Resource res);
37 bool UnrefResource(PP_Resource res); 34 bool UnrefResource(PP_Resource res);
38 35
39 private: 36 private:
40 friend class PluginResource; 37 friend class PluginResource;
41 38
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 }; 77 };
81 typedef std::map<PP_Resource, ResourceAndRefCounts> ResourceMap; 78 typedef std::map<PP_Resource, ResourceAndRefCounts> ResourceMap;
82 ResourceMap live_resources_; 79 ResourceMap live_resources_;
83 80
84 DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker); 81 DISALLOW_COPY_AND_ASSIGN(PluginResourceTracker);
85 }; 82 };
86 83
87 } // namespace ppapi_proxy 84 } // namespace ppapi_proxy
88 85
89 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_ 86 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/native_client/src/shared/ppapi_proxy/plugin_resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698