OLD | NEW |
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_PLUGINS_PPAPI_RESOURCE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_RESOURCE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_RESOURCE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_RESOURCE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/shared_impl/resource_object_base.h" | 11 #include "ppapi/shared_impl/resource_object_base.h" |
12 #include "webkit/plugins/ppapi/resource_tracker.h" | 12 #include "webkit/plugins/ppapi/resource_tracker.h" |
13 | 13 |
14 namespace webkit { | 14 namespace webkit { |
15 namespace ppapi { | 15 namespace ppapi { |
16 | 16 |
17 // If you inherit from resource, make sure you add the class name here. | 17 // Support the old way of doing resource casts for those resources that have |
| 18 // not been converted to the new system. |
18 #define FOR_ALL_RESOURCES(F) \ | 19 #define FOR_ALL_RESOURCES(F) \ |
19 F(MockResource) \ | 20 F(MockResource) \ |
20 F(PPB_AudioConfig_Impl) \ | 21 F(PPB_Scrollbar_Impl) |
21 F(PPB_Audio_Impl) \ | |
22 F(PPB_Broker_Impl) \ | |
23 F(PPB_Buffer_Impl) \ | |
24 F(PPB_Context3D_Impl) \ | |
25 F(PPB_DirectoryReader_Impl) \ | |
26 F(PPB_FileChooser_Impl) \ | |
27 F(PPB_FileIO_Impl) \ | |
28 F(PPB_FileRef_Impl) \ | |
29 F(PPB_FileSystem_Impl) \ | |
30 F(PPB_Flash_Menu_Impl) \ | |
31 F(PPB_Flash_NetConnector_Impl) \ | |
32 F(PPB_Font_Impl) \ | |
33 F(PPB_Graphics2D_Impl) \ | |
34 F(PPB_Graphics3D_Impl) \ | |
35 F(PPB_ImageData_Impl) \ | |
36 F(PPB_LayerCompositor_Impl) \ | |
37 F(PPB_Scrollbar_Impl) \ | |
38 F(PPB_Surface3D_Impl) \ | |
39 F(PPB_Transport_Impl) \ | |
40 F(PPB_URLLoader_Impl) \ | |
41 F(PPB_URLRequestInfo_Impl) \ | |
42 F(PPB_URLResponseInfo_Impl) \ | |
43 F(PPB_VideoDecoder_Impl) \ | |
44 F(PPB_VideoLayer_Impl) \ | |
45 F(PPB_Widget_Impl) | |
46 | 22 |
47 // Forward declaration of Resource classes. | 23 // Forward declaration of Resource classes. |
48 #define DECLARE_RESOURCE_CLASS(RESOURCE) class RESOURCE; | 24 #define DECLARE_RESOURCE_CLASS(RESOURCE) class RESOURCE; |
49 FOR_ALL_RESOURCES(DECLARE_RESOURCE_CLASS) | 25 FOR_ALL_RESOURCES(DECLARE_RESOURCE_CLASS) |
50 #undef DECLARE_RESOURCE_CLASS | 26 #undef DECLARE_RESOURCE_CLASS |
51 | 27 |
52 class Resource : public base::RefCountedThreadSafe<Resource>, | 28 class Resource : public base::RefCountedThreadSafe<Resource>, |
53 public ::ppapi::ResourceObjectBase { | 29 public ::ppapi::ResourceObjectBase { |
54 public: | 30 public: |
55 explicit Resource(PluginInstance* instance); | 31 explicit Resource(PluginInstance* instance); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return As##Type(); \ | 126 return As##Type(); \ |
151 } | 127 } |
152 | 128 |
153 FOR_ALL_RESOURCES(DEFINE_RESOURCE_CAST) | 129 FOR_ALL_RESOURCES(DEFINE_RESOURCE_CAST) |
154 #undef DEFINE_RESOURCE_CAST | 130 #undef DEFINE_RESOURCE_CAST |
155 | 131 |
156 } // namespace ppapi | 132 } // namespace ppapi |
157 } // namespace webkit | 133 } // namespace webkit |
158 | 134 |
159 #endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_H_ | 135 #endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_H_ |
OLD | NEW |