Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: ppapi/shared_impl/function_group_base.h

Issue 7006022: Revert 87415 - Convert more interfaces to the new thunk system. This goes up to and including (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/audio_impl.cc ('k') | ppapi/shared_impl/function_group_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/function_group_base.h
===================================================================
--- ppapi/shared_impl/function_group_base.h (revision 87436)
+++ ppapi/shared_impl/function_group_base.h (working copy)
@@ -5,49 +5,53 @@
#ifndef PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_
#define PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_
-#include <stddef.h> // For NULL.
-
-#define FOR_ALL_PPAPI_FUNCTION_APIS(F) \
- F(PPB_CharSet_FunctionAPI) \
- F(PPB_CursorControl_FunctionAPI) \
- F(PPB_Find_FunctionAPI) \
- F(PPB_Font_FunctionAPI) \
- F(ResourceCreationAPI)
-
namespace ppapi {
-// Forward declare all the function APIs.
namespace thunk {
-#define DECLARE_FUNCTION_CLASS(FUNCTIONS) class FUNCTIONS;
-FOR_ALL_PPAPI_FUNCTION_APIS(DECLARE_FUNCTION_CLASS)
-#undef DECLARE_FUNCTION_CLASS
-} // namespace thunk
+class PPB_CharSet_FunctionAPI;
+class PPB_CursorControl_FunctionAPI;
+class PPB_Font_FunctionAPI;
+class ResourceCreationAPI;
+}
class FunctionGroupBase {
public:
- virtual ~FunctionGroupBase();
+ virtual ~FunctionGroupBase() {}
// Dynamic casting for this object. Returns the pointer to the given type if
- // Inheritance-based dynamic casting for this object. Returns the pointer to
- // the given type if it's supported. Derived classes override the functions
- // they support to return the interface.
- #define DEFINE_TYPE_GETTER(FUNCTIONS) \
- virtual thunk::FUNCTIONS* As##FUNCTIONS();
- FOR_ALL_PPAPI_FUNCTION_APIS(DEFINE_TYPE_GETTER)
- #undef DEFINE_TYPE_GETTER
+ // it's supported.
+ virtual thunk::PPB_CharSet_FunctionAPI* AsCharSet_FunctionAPI() {
+ return NULL;
+ }
+ virtual thunk::PPB_CursorControl_FunctionAPI* AsCursorControl_FunctionAPI() {
+ return NULL;
+ }
+ virtual thunk::PPB_Font_FunctionAPI* AsFont_FunctionAPI() {
+ return NULL;
+ }
+ virtual thunk::ResourceCreationAPI* AsResourceCreation() {
+ return NULL;
+ }
- // Template-based dynamic casting. See specializations below.
template <typename T> T* GetAs() { return NULL; }
};
-// Template-based dynamic casting. These specializations forward to the
-// AsXXX virtual functions to return whether the given type is supported.
-#define DEFINE_FUNCTION_CAST(FUNCTIONS) \
- template<> inline thunk::FUNCTIONS* FunctionGroupBase::GetAs() { \
- return As##FUNCTIONS(); \
- }
-FOR_ALL_PPAPI_FUNCTION_APIS(DEFINE_FUNCTION_CAST)
-#undef DEFINE_FUNCTION_CAST
+template<>
+inline thunk::PPB_CharSet_FunctionAPI* FunctionGroupBase::GetAs() {
+ return AsCharSet_FunctionAPI();
+}
+template<>
+inline thunk::PPB_CursorControl_FunctionAPI* FunctionGroupBase::GetAs() {
+ return AsCursorControl_FunctionAPI();
+}
+template<>
+inline thunk::PPB_Font_FunctionAPI* FunctionGroupBase::GetAs() {
+ return AsFont_FunctionAPI();
+}
+template<>
+inline ppapi::thunk::ResourceCreationAPI* FunctionGroupBase::GetAs() {
+ return AsResourceCreation();
+}
} // namespace ppapi
« no previous file with comments | « ppapi/shared_impl/audio_impl.cc ('k') | ppapi/shared_impl/function_group_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698