summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-30 05:13:17 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-30 05:13:17 +0000
commit4f2006122fa1a0bb91c3d0451ca123061cfee271 (patch)
tree4939d74c4032d7e188fc41692a9404c647a9ea1a /ppapi/shared_impl
parentf3f8f3488944ae47bf705a8986b6b73431a19b7d (diff)
downloadchromium_src-4f2006122fa1a0bb91c3d0451ca123061cfee271.zip
chromium_src-4f2006122fa1a0bb91c3d0451ca123061cfee271.tar.gz
chromium_src-4f2006122fa1a0bb91c3d0451ca123061cfee271.tar.bz2
Delete FunctionGroupBase from Pepper.
The FunctionGroupBase stuff was intended to used for our manual RTTI for interfaces not associated with resources. However, we've been putting most of those interfaces on the PPB_Instance_API which allows us to skip a whole lot of routing, setup, and boilerplate code. This patch moves the two remaining classes deriving from FunctionGroupBase and moves them to special getters on the globals class. We'll keep these classes around and since there are only two, it seems to warrant the special case. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10168026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r--ppapi/shared_impl/function_group_base.cc17
-rw-r--r--ppapi/shared_impl/function_group_base.h53
-rw-r--r--ppapi/shared_impl/ppapi_globals.h14
-rw-r--r--ppapi/shared_impl/ppb_audio_config_shared.cc1
-rw-r--r--ppapi/shared_impl/ppb_instance_shared.h2
-rw-r--r--ppapi/shared_impl/test_globals.cc8
-rw-r--r--ppapi/shared_impl/test_globals.h6
7 files changed, 23 insertions, 78 deletions
diff --git a/ppapi/shared_impl/function_group_base.cc b/ppapi/shared_impl/function_group_base.cc
deleted file mode 100644
index 8fb7ad5..0000000
--- a/ppapi/shared_impl/function_group_base.cc
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/shared_impl/function_group_base.h"
-
-namespace ppapi {
-
-FunctionGroupBase::~FunctionGroupBase() {
-}
-
-#define DEFINE_TYPE_GETTER(FUNCTIONS) \
- thunk::FUNCTIONS* FunctionGroupBase::As##FUNCTIONS() { return NULL; }
-FOR_ALL_PPAPI_FUNCTION_APIS(DEFINE_TYPE_GETTER)
-#undef DEFINE_TYPE_GETTER
-
-} // namespace ppapi
diff --git a/ppapi/shared_impl/function_group_base.h b/ppapi/shared_impl/function_group_base.h
deleted file mode 100644
index ce42a38..0000000
--- a/ppapi/shared_impl/function_group_base.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_
-#define PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_
-
-#include <stddef.h> // For NULL.
-
-#include "ppapi/shared_impl/ppapi_shared_export.h"
-
-#define FOR_ALL_PPAPI_FUNCTION_APIS(F) \
- F(PPB_Instance_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 PPAPI_SHARED_EXPORT FunctionGroupBase {
- public:
- 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
-
- // 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
-
-} // namespace ppapi
-
-#endif // PPAPI_SHARED_IMPL_FUNCTION_GROUP_BASE_H_
diff --git a/ppapi/shared_impl/ppapi_globals.h b/ppapi/shared_impl/ppapi_globals.h
index b1c3879..8e2b94a 100644
--- a/ppapi/shared_impl/ppapi_globals.h
+++ b/ppapi/shared_impl/ppapi_globals.h
@@ -22,10 +22,14 @@ class Lock;
namespace ppapi {
class CallbackTracker;
-class FunctionGroupBase;
class ResourceTracker;
class VarTracker;
+namespace thunk {
+class PPB_Instance_API;
+class ResourceCreationAPI;
+}
+
// Abstract base class
class PPAPI_SHARED_EXPORT PpapiGlobals {
public:
@@ -87,9 +91,11 @@ class PPAPI_SHARED_EXPORT PpapiGlobals {
const std::string& source,
const std::string& value) = 0;
- // Returns the function object corresponding to the given ID, or NULL if
- // there isn't one.
- virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, ApiID id) = 0;
+ // Returns the given API object associated with the given instance, or NULL
+ // if the instance is invalid.
+ virtual thunk::PPB_Instance_API* GetInstanceAPI(PP_Instance instance) = 0;
+ virtual thunk::ResourceCreationAPI* GetResourceCreationAPI(
+ PP_Instance instance) = 0;
// Returns the PP_Module associated with the given PP_Instance, or 0 on
// failure.
diff --git a/ppapi/shared_impl/ppb_audio_config_shared.cc b/ppapi/shared_impl/ppb_audio_config_shared.cc
index a88b851..6803c3c 100644
--- a/ppapi/shared_impl/ppb_audio_config_shared.cc
+++ b/ppapi/shared_impl/ppb_audio_config_shared.cc
@@ -4,6 +4,7 @@
#include "ppapi/shared_impl/ppb_audio_config_shared.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
namespace ppapi {
diff --git a/ppapi/shared_impl/ppb_instance_shared.h b/ppapi/shared_impl/ppb_instance_shared.h
index eed82e1..a1845d3 100644
--- a/ppapi/shared_impl/ppb_instance_shared.h
+++ b/ppapi/shared_impl/ppb_instance_shared.h
@@ -13,7 +13,7 @@
namespace ppapi {
class PPAPI_SHARED_EXPORT PPB_Instance_Shared
- : NON_EXPORTED_BASE(public thunk::PPB_Instance_FunctionAPI) {
+ : NON_EXPORTED_BASE(public thunk::PPB_Instance_API) {
public:
virtual ~PPB_Instance_Shared();
diff --git a/ppapi/shared_impl/test_globals.cc b/ppapi/shared_impl/test_globals.cc
index 9972d22..f8997dc 100644
--- a/ppapi/shared_impl/test_globals.cc
+++ b/ppapi/shared_impl/test_globals.cc
@@ -32,7 +32,13 @@ CallbackTracker* TestGlobals::GetCallbackTrackerForInstance(
return callback_tracker_.get();
}
-FunctionGroupBase* TestGlobals::GetFunctionAPI(PP_Instance inst, ApiID id) {
+thunk::PPB_Instance_API* TestGlobals::GetInstanceAPI(
+ PP_Instance instance) {
+ return NULL;
+}
+
+thunk::ResourceCreationAPI* TestGlobals::GetResourceCreationAPI(
+ PP_Instance instance) {
return NULL;
}
diff --git a/ppapi/shared_impl/test_globals.h b/ppapi/shared_impl/test_globals.h
index cf1be89..2fa2192 100644
--- a/ppapi/shared_impl/test_globals.h
+++ b/ppapi/shared_impl/test_globals.h
@@ -35,8 +35,10 @@ class TestGlobals : public PpapiGlobals {
virtual VarTracker* GetVarTracker() OVERRIDE;
virtual CallbackTracker* GetCallbackTrackerForInstance(
PP_Instance instance) OVERRIDE;
- virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst,
- ApiID id) OVERRIDE;
+ virtual thunk::PPB_Instance_API* GetInstanceAPI(
+ PP_Instance instance) OVERRIDE;
+ virtual thunk::ResourceCreationAPI* GetResourceCreationAPI(
+ PP_Instance instance) OVERRIDE;
virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
virtual std::string GetCmdLine() OVERRIDE;
virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE;