summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 20:44:27 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 20:44:27 +0000
commit9ff4fc760cecbd5709d16e01c05c08d338066caa (patch)
tree112d415f1155f77da5f3921cd379ce93c267f49f /ppapi
parent4852d456e642e948615403199903ffe03e865bac (diff)
downloadchromium_src-9ff4fc760cecbd5709d16e01c05c08d338066caa.zip
chromium_src-9ff4fc760cecbd5709d16e01c05c08d338066caa.tar.gz
chromium_src-9ff4fc760cecbd5709d16e01c05c08d338066caa.tar.bz2
Remove the old type system for proxied resources. These were no longer being used.
Review URL: http://codereview.chromium.org/7587011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96610 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/mock_resource.cc4
-rw-r--r--ppapi/proxy/mock_resource.h3
-rw-r--r--ppapi/proxy/plugin_resource.cc5
-rw-r--r--ppapi/proxy/plugin_resource.h55
-rw-r--r--ppapi/proxy/ppb_buffer_proxy.cc4
-rw-r--r--ppapi/proxy/ppb_buffer_proxy.h3
-rw-r--r--ppapi/proxy/ppb_font_proxy.cc4
-rw-r--r--ppapi/proxy/ppb_font_proxy.h3
-rw-r--r--ppapi/proxy/ppb_image_data_proxy.cc4
-rw-r--r--ppapi/proxy/ppb_image_data_proxy.h3
-rw-r--r--ppapi/proxy/ppb_pdf_proxy.cc17
-rw-r--r--ppapi/proxy/ppb_video_capture_proxy.cc7
-rw-r--r--ppapi/thunk/ppb_pdf_api.h9
13 files changed, 14 insertions, 107 deletions
diff --git a/ppapi/proxy/mock_resource.cc b/ppapi/proxy/mock_resource.cc
index 21e5381..dc7bc8a 100644
--- a/ppapi/proxy/mock_resource.cc
+++ b/ppapi/proxy/mock_resource.cc
@@ -14,9 +14,5 @@ MockResource::MockResource(const HostResource& resource)
MockResource::~MockResource() {
}
-MockResource* MockResource::AsMockResource() {
- return this;
-}
-
} // namespace proxy
} // namespace pp
diff --git a/ppapi/proxy/mock_resource.h b/ppapi/proxy/mock_resource.h
index 7e38be1..103aacc 100644
--- a/ppapi/proxy/mock_resource.h
+++ b/ppapi/proxy/mock_resource.h
@@ -16,9 +16,6 @@ class MockResource : public PluginResource {
MockResource(const HostResource& resource);
virtual ~MockResource();
- // Resource overrides.
- virtual MockResource* AsMockResource();
-
private:
DISALLOW_COPY_AND_ASSIGN(MockResource);
};
diff --git a/ppapi/proxy/plugin_resource.cc b/ppapi/proxy/plugin_resource.cc
index 186ff74..67a47f4 100644
--- a/ppapi/proxy/plugin_resource.cc
+++ b/ppapi/proxy/plugin_resource.cc
@@ -15,11 +15,6 @@ PluginResource::PluginResource(const HostResource& resource)
PluginResource::~PluginResource() {
}
-#define DEFINE_TYPE_GETTER(RESOURCE) \
- RESOURCE* PluginResource::As##RESOURCE() { return NULL; }
-FOR_ALL_PLUGIN_RESOURCES(DEFINE_TYPE_GETTER)
-#undef DEFINE_TYPE_GETTER
-
PluginDispatcher* PluginResource::GetDispatcher() {
PluginDispatcher* disp = PluginDispatcher::GetForInstance(instance());
CHECK(disp);
diff --git a/ppapi/proxy/plugin_resource.h b/ppapi/proxy/plugin_resource.h
index 3abe9cb..10dbf72 100644
--- a/ppapi/proxy/plugin_resource.h
+++ b/ppapi/proxy/plugin_resource.h
@@ -12,53 +12,14 @@
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/shared_impl/resource_object_base.h"
-// If you inherit from resource, make sure you add the class name here.
-#define FOR_ALL_PLUGIN_RESOURCES(F) \
- F(Audio) \
- F(AudioConfig) \
- F(Broker) \
- F(Buffer) \
- F(Context3D) \
- F(FileChooser) \
- F(FileRef) \
- F(FileSystem) \
- F(FlashMenu) \
- F(FlashNetConnector) \
- F(Font) \
- F(Graphics2D) \
- F(Graphics3D) \
- F(ImageData) \
- F(MockResource) \
- F(PrivateFontFile) \
- F(Surface3D) \
- F(URLLoader) \
- F(URLRequestInfo) \
- F(URLResponseInfo) \
- F(VideoCapture) \
- F(VideoDecoder)
-
namespace pp {
namespace proxy {
-// Forward declaration of Resource classes.
-#define DECLARE_RESOURCE_CLASS(RESOURCE) class RESOURCE;
-FOR_ALL_PLUGIN_RESOURCES(DECLARE_RESOURCE_CLASS)
-#undef DECLARE_RESOURCE_CLASS
-
class PluginResource : public ::ppapi::ResourceObjectBase {
public:
PluginResource(const HostResource& resource);
virtual ~PluginResource();
- // Returns NULL if the resource is invalid or is a different type.
- template<typename T> static T* GetAs(PP_Resource res) {
- PluginResource* resource =
- PluginResourceTracker::GetInstance()->GetResourceObject(res);
- return resource ? resource->Cast<T>() : NULL;
- }
-
- template <typename T> T* Cast() { return NULL; }
-
PP_Instance instance() const { return host_resource_.instance(); }
// Returns the host resource ID for sending to the host process.
@@ -69,14 +30,6 @@ class PluginResource : public ::ppapi::ResourceObjectBase {
PluginDispatcher* GetDispatcher();
private:
- // 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.
- #define DEFINE_TYPE_GETTER(RESOURCE) \
- virtual RESOURCE* As##RESOURCE();
- FOR_ALL_PLUGIN_RESOURCES(DEFINE_TYPE_GETTER)
- #undef DEFINE_TYPE_GETTER
-
// The resource ID in the host that this object corresponds to. Inside the
// plugin we'll remap the resource IDs so we can have many host processes
// each independently generating resources (which may conflict) but the IDs
@@ -86,14 +39,6 @@ class PluginResource : public ::ppapi::ResourceObjectBase {
DISALLOW_COPY_AND_ASSIGN(PluginResource);
};
-// Cast() specializations.
-#define DEFINE_RESOURCE_CAST(Type) \
- template <> inline Type* PluginResource::Cast<Type>() { \
- return As##Type(); \
- }
-FOR_ALL_PLUGIN_RESOURCES(DEFINE_RESOURCE_CAST)
-#undef DEFINE_RESOURCE_CAST
-
} // namespace proxy
} // namespace pp
diff --git a/ppapi/proxy/ppb_buffer_proxy.cc b/ppapi/proxy/ppb_buffer_proxy.cc
index 57dba6c..f25d7e2 100644
--- a/ppapi/proxy/ppb_buffer_proxy.cc
+++ b/ppapi/proxy/ppb_buffer_proxy.cc
@@ -45,10 +45,6 @@ Buffer::~Buffer() {
Unmap();
}
-Buffer* Buffer::AsBuffer() {
- return this;
-}
-
ppapi::thunk::PPB_Buffer_API* Buffer::AsPPB_Buffer_API() {
return this;
}
diff --git a/ppapi/proxy/ppb_buffer_proxy.h b/ppapi/proxy/ppb_buffer_proxy.h
index 552d422..18ddafc 100644
--- a/ppapi/proxy/ppb_buffer_proxy.h
+++ b/ppapi/proxy/ppb_buffer_proxy.h
@@ -26,9 +26,6 @@ class Buffer : public ppapi::thunk::PPB_Buffer_API,
uint32_t size);
virtual ~Buffer();
- // Resource overrides.
- virtual Buffer* AsBuffer() OVERRIDE;
-
// ResourceObjectBase overrides.
virtual ppapi::thunk::PPB_Buffer_API* AsPPB_Buffer_API() OVERRIDE;
diff --git a/ppapi/proxy/ppb_font_proxy.cc b/ppapi/proxy/ppb_font_proxy.cc
index 6202bab..a977a1f 100644
--- a/ppapi/proxy/ppb_font_proxy.cc
+++ b/ppapi/proxy/ppb_font_proxy.cc
@@ -118,10 +118,6 @@ ppapi::thunk::PPB_Font_API* Font::AsPPB_Font_API() {
return this;
}
-Font* Font::AsFont() {
- return this;
-}
-
PP_Bool Font::Describe(PP_FontDescription_Dev* description,
PP_FontMetrics_Dev* metrics) {
TRACE_EVENT0("ppapi proxy", "Font::Describe");
diff --git a/ppapi/proxy/ppb_font_proxy.h b/ppapi/proxy/ppb_font_proxy.h
index 05c0e7e..86c1fa8 100644
--- a/ppapi/proxy/ppb_font_proxy.h
+++ b/ppapi/proxy/ppb_font_proxy.h
@@ -56,9 +56,6 @@ class Font : public PluginResource,
// ResourceObjectBase.
virtual ppapi::thunk::PPB_Font_API* AsPPB_Font_API() OVERRIDE;
- // PluginResource overrides.
- virtual Font* AsFont() OVERRIDE;
-
// PPB_Font_API implementation.
virtual PP_Bool Describe(PP_FontDescription_Dev* description,
PP_FontMetrics_Dev* metrics) OVERRIDE;
diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc
index 18f9e02..46e44f4 100644
--- a/ppapi/proxy/ppb_image_data_proxy.cc
+++ b/ppapi/proxy/ppb_image_data_proxy.cc
@@ -80,10 +80,6 @@ ImageData::~ImageData() {
return this;
}
-ImageData* ImageData::AsImageData() {
- return this;
-}
-
PP_Bool ImageData::Describe(PP_ImageDataDesc* desc) {
memcpy(desc, &desc_, sizeof(PP_ImageDataDesc));
return PP_TRUE;
diff --git a/ppapi/proxy/ppb_image_data_proxy.h b/ppapi/proxy/ppb_image_data_proxy.h
index 23cf442..b23d725 100644
--- a/ppapi/proxy/ppb_image_data_proxy.h
+++ b/ppapi/proxy/ppb_image_data_proxy.h
@@ -57,9 +57,6 @@ class ImageData : public PluginResource,
// ResourceObjectBase overrides.
virtual ::ppapi::thunk::PPB_ImageData_API* AsPPB_ImageData_API() OVERRIDE;
- // Resource overrides.
- virtual ImageData* AsImageData() OVERRIDE;
-
// PPB_ImageData API.
virtual PP_Bool Describe(PP_ImageDataDesc* desc) OVERRIDE;
virtual void* Map() OVERRIDE;
diff --git a/ppapi/proxy/ppb_pdf_proxy.cc b/ppapi/proxy/ppb_pdf_proxy.cc
index 6df5355..14dcb8d 100644
--- a/ppapi/proxy/ppb_pdf_proxy.cc
+++ b/ppapi/proxy/ppb_pdf_proxy.cc
@@ -16,18 +16,23 @@
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_pdf_api.h"
+
+using ppapi::thunk::PPB_PDFFont_API;
+using ppapi::thunk::EnterResource;
namespace pp {
namespace proxy {
-class PrivateFontFile : public PluginResource {
+class PrivateFontFile : public PluginResource,
+ public PPB_PDFFont_API {
public:
PrivateFontFile(const HostResource& resource) : PluginResource(resource) {
}
virtual ~PrivateFontFile() {}
- // Resource overrides.
- virtual PrivateFontFile* AsPrivateFontFile() { return this; }
+ PPB_PDFFont_API* AsPPB_PDFFont_API() { return this; }
// Sees if we have a cache of the font table and returns a pointer to it.
// Returns NULL if we don't have it.
@@ -83,9 +88,11 @@ bool GetFontTableForPrivateFontFile(PP_Resource font_file,
uint32_t table,
void* output,
uint32_t* output_length) {
- PrivateFontFile* object = PluginResource::GetAs<PrivateFontFile>(font_file);
- if (!object)
+ EnterResource<PPB_PDFFont_API> enter(font_file, true);
+ if (enter.failed())
return false;
+
+ PrivateFontFile* object = static_cast<PrivateFontFile*>(enter.object());
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
object->instance());
if (!dispatcher)
diff --git a/ppapi/proxy/ppb_video_capture_proxy.cc b/ppapi/proxy/ppb_video_capture_proxy.cc
index e957315..7c5c8a0a 100644
--- a/ppapi/proxy/ppb_video_capture_proxy.cc
+++ b/ppapi/proxy/ppb_video_capture_proxy.cc
@@ -149,9 +149,6 @@ class VideoCapture : public ppapi::thunk::PPB_VideoCapture_API,
VideoCapture(const HostResource& resource);
virtual ~VideoCapture();
- // Resource overrides.
- virtual VideoCapture* AsVideoCapture() OVERRIDE;
-
// ResourceObjectBase overrides.
virtual ppapi::thunk::PPB_VideoCapture_API* AsPPB_VideoCapture_API() OVERRIDE;
@@ -261,10 +258,6 @@ VideoCapture::VideoCapture(const HostResource& resource)
VideoCapture::~VideoCapture() {
}
-VideoCapture* VideoCapture::AsVideoCapture() {
- return this;
-}
-
ppapi::thunk::PPB_VideoCapture_API* VideoCapture::AsPPB_VideoCapture_API() {
return this;
}
diff --git a/ppapi/thunk/ppb_pdf_api.h b/ppapi/thunk/ppb_pdf_api.h
index 9f102d5..b886929 100644
--- a/ppapi/thunk/ppb_pdf_api.h
+++ b/ppapi/thunk/ppb_pdf_api.h
@@ -11,14 +11,9 @@ namespace ppapi {
namespace thunk {
class PPB_PDFFont_API {
- private:
+ public:
virtual ~PPB_PDFFont_API() {}
-
- virtual bool GetFontTableForPrivateFontFile(PP_Resource font_file,
- uint32_t table,
- void* output,
- uint32_t* output_length) = 0;
-}
+};
} // namespace thunk
} // namespace ppapi