OLD | NEW |
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_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "third_party/ppapi/c/pp_resource.h" | 10 #include "third_party/ppapi/c/pp_resource.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 class Transport; | 31 class Transport; |
32 class URLLoader; | 32 class URLLoader; |
33 class URLRequestInfo; | 33 class URLRequestInfo; |
34 class URLResponseInfo; | 34 class URLResponseInfo; |
35 class Var; | 35 class Var; |
36 class VideoDecoder; | 36 class VideoDecoder; |
37 class Widget; | 37 class Widget; |
38 | 38 |
39 class Resource : public base::RefCountedThreadSafe<Resource> { | 39 class Resource : public base::RefCountedThreadSafe<Resource> { |
40 public: | 40 public: |
41 explicit Resource(PluginModule* module) : resource_id_(0), module_(module) {} | 41 explicit Resource(PluginModule* module); |
42 virtual ~Resource() {} | 42 virtual ~Resource(); |
43 | 43 |
44 // Returns NULL if the resource is invalid or is a different type. | 44 // Returns NULL if the resource is invalid or is a different type. |
45 template<typename T> | 45 template<typename T> |
46 static scoped_refptr<T> GetAs(PP_Resource res) { | 46 static scoped_refptr<T> GetAs(PP_Resource res) { |
47 scoped_refptr<Resource> resource = ResourceTracker::Get()->GetResource(res); | 47 scoped_refptr<Resource> resource = ResourceTracker::Get()->GetResource(res); |
48 return resource ? resource->Cast<T>() : NULL; | 48 return resource ? resource->Cast<T>() : NULL; |
49 } | 49 } |
50 | 50 |
51 PluginModule* module() const { return module_; } | 51 PluginModule* module() const { return module_; } |
52 | 52 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 DEFINE_RESOURCE_CAST(URLRequestInfo) | 149 DEFINE_RESOURCE_CAST(URLRequestInfo) |
150 DEFINE_RESOURCE_CAST(URLResponseInfo) | 150 DEFINE_RESOURCE_CAST(URLResponseInfo) |
151 DEFINE_RESOURCE_CAST(Var) | 151 DEFINE_RESOURCE_CAST(Var) |
152 DEFINE_RESOURCE_CAST(VideoDecoder) | 152 DEFINE_RESOURCE_CAST(VideoDecoder) |
153 DEFINE_RESOURCE_CAST(Widget) | 153 DEFINE_RESOURCE_CAST(Widget) |
154 | 154 |
155 #undef DEFINE_RESOURCE_CAST | 155 #undef DEFINE_RESOURCE_CAST |
156 } // namespace pepper | 156 } // namespace pepper |
157 | 157 |
158 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ | 158 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ |
OLD | NEW |