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/logging.h" | |
9 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
10 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
11 #include "third_party/ppapi/c/pp_resource.h" | 10 #include "third_party/ppapi/c/pp_resource.h" |
12 #include "webkit/glue/plugins/pepper_resource_tracker.h" | 11 #include "webkit/glue/plugins/pepper_resource_tracker.h" |
13 | 12 |
14 namespace pepper { | 13 namespace pepper { |
15 | 14 |
16 class Buffer; | 15 class Buffer; |
17 class Audio; | 16 class Audio; |
18 class AudioConfig; | 17 class AudioConfig; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // refcount, or TemporaryReference when you do not want to increase the | 103 // refcount, or TemporaryReference when you do not want to increase the |
105 // refcount. | 104 // refcount. |
106 PP_Resource resource_id_; | 105 PP_Resource resource_id_; |
107 | 106 |
108 // Non-owning pointer to our module. | 107 // Non-owning pointer to our module. |
109 PluginModule* module_; | 108 PluginModule* module_; |
110 | 109 |
111 // Called by the resource tracker when the last plugin reference has been | 110 // Called by the resource tracker when the last plugin reference has been |
112 // dropped. | 111 // dropped. |
113 friend class ResourceTracker; | 112 friend class ResourceTracker; |
114 void StoppedTracking() { | 113 void StoppedTracking(); |
115 DCHECK(resource_id_ != 0); | |
116 resource_id_ = 0; | |
117 } | |
118 | 114 |
119 DISALLOW_COPY_AND_ASSIGN(Resource); | 115 DISALLOW_COPY_AND_ASSIGN(Resource); |
120 }; | 116 }; |
121 | 117 |
122 // Cast() specializations. | 118 // Cast() specializations. |
123 #define DEFINE_RESOURCE_CAST(Type) \ | 119 #define DEFINE_RESOURCE_CAST(Type) \ |
124 template <> inline Type* Resource::Cast<Type>() { \ | 120 template <> inline Type* Resource::Cast<Type>() { \ |
125 return As##Type(); \ | 121 return As##Type(); \ |
126 } | 122 } |
127 | 123 |
(...skipping 13 matching lines...) Expand all Loading... |
141 DEFINE_RESOURCE_CAST(URLLoader) | 137 DEFINE_RESOURCE_CAST(URLLoader) |
142 DEFINE_RESOURCE_CAST(URLRequestInfo) | 138 DEFINE_RESOURCE_CAST(URLRequestInfo) |
143 DEFINE_RESOURCE_CAST(URLResponseInfo) | 139 DEFINE_RESOURCE_CAST(URLResponseInfo) |
144 DEFINE_RESOURCE_CAST(VideoDecoder) | 140 DEFINE_RESOURCE_CAST(VideoDecoder) |
145 DEFINE_RESOURCE_CAST(Widget) | 141 DEFINE_RESOURCE_CAST(Widget) |
146 | 142 |
147 #undef DEFINE_RESOURCE_CAST | 143 #undef DEFINE_RESOURCE_CAST |
148 } // namespace pepper | 144 } // namespace pepper |
149 | 145 |
150 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ | 146 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ |
OLD | NEW |