diff options
Diffstat (limited to 'webkit/glue/plugins/pepper_resource.h')
-rw-r--r-- | webkit/glue/plugins/pepper_resource.h | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/webkit/glue/plugins/pepper_resource.h b/webkit/glue/plugins/pepper_resource.h index 417a06b..cab6f32 100644 --- a/webkit/glue/plugins/pepper_resource.h +++ b/webkit/glue/plugins/pepper_resource.h @@ -5,7 +5,6 @@ #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ #define WEBKIT_GLUE_PLUGINS_PEPPER_RESOURCE_H_ -#include "base/logging.h" #include "base/basictypes.h" #include "base/ref_counted.h" #include "third_party/ppapi/c/pp_resource.h" @@ -14,24 +13,33 @@ namespace pepper { class Buffer; -class DeviceContext2D; +class Audio; +class AudioConfig; class DirectoryReader; class FileChooser; class FileIO; class FileRef; class Font; +class Graphics2D; +class Graphics3D; class ImageData; +class ObjectVar; class PluginModule; +class PrivateFontFile; class Scrollbar; +class StringVar; +class Transport; class URLLoader; class URLRequestInfo; class URLResponseInfo; +class Var; +class VideoDecoder; class Widget; class Resource : public base::RefCountedThreadSafe<Resource> { public: - explicit Resource(PluginModule* module) : resource_id_(0), module_(module) {} - virtual ~Resource() {} + explicit Resource(PluginModule* module); + virtual ~Resource(); // Returns NULL if the resource is invalid or is a different type. template<typename T> @@ -72,18 +80,27 @@ class Resource : public base::RefCountedThreadSafe<Resource> { // Type-specific getters for individual resource types. These will return // NULL if the resource does not match the specified type. Used by the Cast() // function. + virtual Audio* AsAudio() { return NULL; } + virtual AudioConfig* AsAudioConfig() { return NULL; } virtual Buffer* AsBuffer() { return NULL; } - virtual DeviceContext2D* AsDeviceContext2D() { return NULL; } virtual DirectoryReader* AsDirectoryReader() { return NULL; } virtual FileChooser* AsFileChooser() { return NULL; } virtual FileIO* AsFileIO() { return NULL; } virtual FileRef* AsFileRef() { return NULL; } virtual Font* AsFont() { return NULL; } + virtual Graphics2D* AsGraphics2D() { return NULL; } + virtual Graphics3D* AsGraphics3D() { return NULL; } virtual ImageData* AsImageData() { return NULL; } + virtual ObjectVar* AsObjectVar() { return NULL; } + virtual PrivateFontFile* AsPrivateFontFile() { return NULL; } virtual Scrollbar* AsScrollbar() { return NULL; } + virtual StringVar* AsStringVar() { return NULL; } + virtual Transport* AsTransport() { return NULL; } virtual URLLoader* AsURLLoader() { return NULL; } virtual URLRequestInfo* AsURLRequestInfo() { return NULL; } virtual URLResponseInfo* AsURLResponseInfo() { return NULL; } + virtual Var* AsVar() { return NULL; } + virtual VideoDecoder* AsVideoDecoder() { return NULL; } virtual Widget* AsWidget() { return NULL; } private: @@ -101,10 +118,7 @@ class Resource : public base::RefCountedThreadSafe<Resource> { // Called by the resource tracker when the last plugin reference has been // dropped. friend class ResourceTracker; - void StoppedTracking() { - DCHECK(resource_id_ != 0); - resource_id_ = 0; - } + void StoppedTracking(); DISALLOW_COPY_AND_ASSIGN(Resource); }; @@ -115,18 +129,27 @@ class Resource : public base::RefCountedThreadSafe<Resource> { return As##Type(); \ } +DEFINE_RESOURCE_CAST(Audio) +DEFINE_RESOURCE_CAST(AudioConfig) DEFINE_RESOURCE_CAST(Buffer) -DEFINE_RESOURCE_CAST(DeviceContext2D) DEFINE_RESOURCE_CAST(DirectoryReader) DEFINE_RESOURCE_CAST(FileChooser) DEFINE_RESOURCE_CAST(FileIO) DEFINE_RESOURCE_CAST(FileRef) DEFINE_RESOURCE_CAST(Font) +DEFINE_RESOURCE_CAST(Graphics2D) +DEFINE_RESOURCE_CAST(Graphics3D) DEFINE_RESOURCE_CAST(ImageData) +DEFINE_RESOURCE_CAST(ObjectVar) +DEFINE_RESOURCE_CAST(PrivateFontFile) DEFINE_RESOURCE_CAST(Scrollbar) +DEFINE_RESOURCE_CAST(StringVar); +DEFINE_RESOURCE_CAST(Transport) DEFINE_RESOURCE_CAST(URLLoader) DEFINE_RESOURCE_CAST(URLRequestInfo) DEFINE_RESOURCE_CAST(URLResponseInfo) +DEFINE_RESOURCE_CAST(Var) +DEFINE_RESOURCE_CAST(VideoDecoder) DEFINE_RESOURCE_CAST(Widget) #undef DEFINE_RESOURCE_CAST |