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

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

Issue 1697008: New Pepper API implementation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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
« no previous file with comments | « webkit/glue/plugins/pepper_resource.cc ('k') | webkit/glue/plugins/pepper_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')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
7
8 #include <set>
9
10 #include "base/atomic_sequence_num.h"
11 #include "base/basictypes.h"
12 #include "base/lock.h"
13 #include "base/ref_counted.h"
14 #include "base/singleton.h"
15
16 typedef struct _pp_Resource PP_Resource;
17
18 namespace pepper {
19
20 class Resource;
21
22 // This class maintains a global list of all live pepper resources. It allows
23 // us to check resource ID validity and to map them to a specific module.
24 //
25 // This object is threadsafe.
26 class ResourceTracker {
27 public:
28 // Returns the pointer to the singleton object.
29 static ResourceTracker* Get();
30
31 // The returned pointer will be NULL if there is no resource.
32 Resource* GetResource(PP_Resource res) const;
33
34 // Adds the given resource to the tracker and assigns it a resource ID. The
35 // assigned resource ID will be returned.
36 void AddResource(Resource* resource);
37
38 void DeleteResource(Resource* resource);
39
40 private:
41 friend struct DefaultSingletonTraits<ResourceTracker>;
42
43 ResourceTracker();
44 ~ResourceTracker();
45
46 // Hold this lock when accessing this object's members.
47 mutable Lock lock_;
48
49 typedef std::set<Resource*> ResourceSet;
50 ResourceSet live_resources_;
51
52 DISALLOW_COPY_AND_ASSIGN(ResourceTracker);
53 };
54
55 } // namespace pepper
56
57 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_resource.cc ('k') | webkit/glue/plugins/pepper_resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698