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

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

Issue 2822031: File API boilerplate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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.h ('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')
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 <set> 8 #include <set>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/lock.h" 12 #include "base/lock.h"
13 #include "base/ref_counted.h" 13 #include "base/ref_counted.h"
14 #include "base/singleton.h" 14 #include "base/singleton.h"
15 #include "third_party/ppapi/c/pp_resource.h" 15 #include "third_party/ppapi/c/pp_resource.h"
16 16
17 namespace pepper { 17 namespace pepper {
18 18
19 class Buffer; 19 class Buffer;
20 class DeviceContext2D; 20 class DeviceContext2D;
21 class DirectoryReader;
22 class FileChooser;
23 class FileIO;
24 class FileRef;
21 class ImageData; 25 class ImageData;
22 class Resource; 26 class Resource;
23 class URLLoader; 27 class URLLoader;
24 class URLRequestInfo; 28 class URLRequestInfo;
25 class URLResponseInfo; 29 class URLResponseInfo;
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 10 matching lines...) Expand all
41 scoped_refptr<Resource> GetResource(PP_Resource res) const; 45 scoped_refptr<Resource> GetResource(PP_Resource res) const;
42 46
43 // Adds the given resource to the tracker and assigns it a resource ID. The 47 // Adds the given resource to the tracker and assigns it a resource ID. The
44 // assigned resource ID will be returned. 48 // assigned resource ID will be returned.
45 void AddResource(Resource* resource); 49 void AddResource(Resource* resource);
46 50
47 void DeleteResource(Resource* resource); 51 void DeleteResource(Resource* resource);
48 52
49 // Helpers for converting resources to a specific type. Returns NULL if the 53 // Helpers for converting resources to a specific type. Returns NULL if the
50 // resource is invalid or is a different type. 54 // resource is invalid or is a different type.
55 scoped_refptr<Buffer> GetAsBuffer(PP_Resource res) const;
51 scoped_refptr<DeviceContext2D> GetAsDeviceContext2D(PP_Resource res) const; 56 scoped_refptr<DeviceContext2D> GetAsDeviceContext2D(PP_Resource res) const;
57 scoped_refptr<DirectoryReader> GetAsDirectoryReader(PP_Resource res) const;
58 scoped_refptr<FileChooser> GetAsFileChooser(PP_Resource res) const;
59 scoped_refptr<FileIO> GetAsFileIO(PP_Resource res) const;
60 scoped_refptr<FileRef> GetAsFileRef(PP_Resource res) const;
52 scoped_refptr<ImageData> GetAsImageData(PP_Resource res) const; 61 scoped_refptr<ImageData> GetAsImageData(PP_Resource res) const;
53 scoped_refptr<URLLoader> GetAsURLLoader(PP_Resource res) const; 62 scoped_refptr<URLLoader> GetAsURLLoader(PP_Resource res) const;
54 scoped_refptr<URLRequestInfo> GetAsURLRequestInfo(PP_Resource res) const; 63 scoped_refptr<URLRequestInfo> GetAsURLRequestInfo(PP_Resource res) const;
55 scoped_refptr<URLResponseInfo> GetAsURLResponseInfo(PP_Resource res) const; 64 scoped_refptr<URLResponseInfo> GetAsURLResponseInfo(PP_Resource res) const;
56 scoped_refptr<Buffer> GetAsBuffer(PP_Resource res) const;
57 65
58 private: 66 private:
59 friend struct DefaultSingletonTraits<ResourceTracker>; 67 friend struct DefaultSingletonTraits<ResourceTracker>;
60 68
61 ResourceTracker(); 69 ResourceTracker();
62 ~ResourceTracker(); 70 ~ResourceTracker();
63 71
64 // Hold this lock when accessing this object's members. 72 // Hold this lock when accessing this object's members.
65 mutable Lock lock_; 73 mutable Lock lock_;
66 74
67 typedef std::set<Resource*> ResourceSet; 75 typedef std::set<Resource*> ResourceSet;
68 ResourceSet live_resources_; 76 ResourceSet live_resources_;
69 77
70 DISALLOW_COPY_AND_ASSIGN(ResourceTracker); 78 DISALLOW_COPY_AND_ASSIGN(ResourceTracker);
71 }; 79 };
72 80
73 } // namespace pepper 81 } // namespace pepper
74 82
75 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_ 83 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_TRACKER_H_
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_resource.h ('k') | webkit/glue/plugins/pepper_resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698