summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
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/proxy
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/proxy')
-rw-r--r--ppapi/proxy/enter_proxy.h46
-rw-r--r--ppapi/proxy/host_dispatcher.h1
-rw-r--r--ppapi/proxy/interface_proxy.h4
-rw-r--r--ppapi/proxy/plugin_dispatcher.cc10
-rw-r--r--ppapi/proxy/plugin_dispatcher.h17
-rw-r--r--ppapi/proxy/plugin_globals.cc14
-rw-r--r--ppapi/proxy/plugin_globals.h6
-rw-r--r--ppapi/proxy/ppb_audio_proxy.cc3
-rw-r--r--ppapi/proxy/ppb_file_ref_proxy.cc1
-rw-r--r--ppapi/proxy/ppb_file_system_proxy.cc1
-rw-r--r--ppapi/proxy/ppb_flash_menu_proxy.cc1
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc2
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.cc1
-rw-r--r--ppapi/proxy/ppb_instance_proxy.cc26
-rw-r--r--ppapi/proxy/ppb_instance_proxy.h6
-rw-r--r--ppapi/proxy/ppb_url_loader_proxy.cc1
-rw-r--r--ppapi/proxy/resource_creation_proxy.cc5
-rw-r--r--ppapi/proxy/resource_creation_proxy.h2
18 files changed, 51 insertions, 96 deletions
diff --git a/ppapi/proxy/enter_proxy.h b/ppapi/proxy/enter_proxy.h
index 86ee7a0..6ee93a3 100644
--- a/ppapi/proxy/enter_proxy.h
+++ b/ppapi/proxy/enter_proxy.h
@@ -170,52 +170,6 @@ class EnterHostFromHostResourceForceCallback
pp::CompletionCallback callback_;
};
-// Like EnterHostFromHostResourceForceCallback but for Function APIs. It takes
-// an instance instead of a resource ID.
-template<typename FunctionT>
-class EnterHostFunctionForceCallback
- : public thunk::EnterFunctionNoLock<FunctionT> {
- public:
- EnterHostFunctionForceCallback(
- PP_Instance instance,
- const pp::CompletionCallback& callback)
- : thunk::EnterFunctionNoLock<FunctionT>(instance, false),
- needs_running_(true),
- callback_(callback) {
- if (this->failed())
- RunCallback(PP_ERROR_BADARGUMENT);
- }
-
- ~EnterHostFunctionForceCallback() {
- if (needs_running_) {
- NOTREACHED() << "Should always call SetResult except in the "
- "initialization failed case.";
- RunCallback(PP_ERROR_FAILED);
- }
- }
-
- void SetResult(int32_t result) {
- DCHECK(needs_running_) << "Don't call SetResult when there already is one.";
- needs_running_ = false;
- if (result != PP_OK_COMPLETIONPENDING)
- callback_.Run(result);
- }
-
- PP_CompletionCallback callback() {
- return callback_.pp_completion_callback();
- }
-
- private:
- void RunCallback(int32_t result) {
- DCHECK(needs_running_);
- needs_running_ = false;
- callback_.Run(result);
- }
-
- bool needs_running_;
- pp::CompletionCallback callback_;
-};
-
} // namespace proxy
} // namespace ppapi
diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h
index be9c426..82a0bf5 100644
--- a/ppapi/proxy/host_dispatcher.h
+++ b/ppapi/proxy/host_dispatcher.h
@@ -15,7 +15,6 @@
#include "ipc/ipc_channel_proxy.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/proxy/dispatcher.h"
-#include "ppapi/shared_impl/function_group_base.h"
struct PPB_Proxy_Private;
diff --git a/ppapi/proxy/interface_proxy.h b/ppapi/proxy/interface_proxy.h
index a35c63d..b87a184 100644
--- a/ppapi/proxy/interface_proxy.h
+++ b/ppapi/proxy/interface_proxy.h
@@ -12,7 +12,6 @@
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/shared_impl/api_id.h"
-#include "ppapi/shared_impl/function_group_base.h"
namespace ppapi {
namespace proxy {
@@ -20,8 +19,7 @@ namespace proxy {
class Dispatcher;
class InterfaceProxy : public IPC::Channel::Listener,
- public IPC::Message::Sender,
- public FunctionGroupBase {
+ public IPC::Message::Sender {
public:
// Factory function type for interfaces. Ownership of the returned pointer
// is transferred to the caller.
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index 94cd3df..c5cb90e 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -246,8 +246,14 @@ InstanceData* PluginDispatcher::GetInstanceData(PP_Instance instance) {
return (it == instance_map_.end()) ? NULL : &it->second;
}
-FunctionGroupBase* PluginDispatcher::GetFunctionAPI(ApiID id) {
- return GetInterfaceProxy(id);
+thunk::PPB_Instance_API* PluginDispatcher::GetInstanceAPI() {
+ return static_cast<PPB_Instance_Proxy*>(
+ GetInterfaceProxy(API_ID_PPB_INSTANCE));
+}
+
+thunk::ResourceCreationAPI* PluginDispatcher::GetResourceCreationAPI() {
+ return static_cast<ResourceCreationProxy*>(
+ GetInterfaceProxy(API_ID_RESOURCE_CREATION));
}
void PluginDispatcher::ForceFreeAllInstances() {
diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h
index 88d3763..129a37ca 100644
--- a/ppapi/proxy/plugin_dispatcher.h
+++ b/ppapi/proxy/plugin_dispatcher.h
@@ -18,7 +18,6 @@
#include "ppapi/c/pp_rect.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/proxy/dispatcher.h"
-#include "ppapi/shared_impl/function_group_base.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "ppapi/shared_impl/ppb_view_shared.h"
@@ -27,6 +26,11 @@ namespace ppapi {
struct Preferences;
class Resource;
+namespace thunk {
+class PPB_Instance_API;
+class ResourceCreationAPI;
+}
+
namespace proxy {
// Used to keep track of per-instance data.
@@ -118,15 +122,14 @@ class PPAPI_PROXY_EXPORT PluginDispatcher
// correspond to a known instance.
InstanceData* GetInstanceData(PP_Instance instance);
+ // Returns the corresponding API. These are APIs not associated with a
+ // resource. Guaranteed non-NULL.
+ thunk::PPB_Instance_API* GetInstanceAPI();
+ thunk::ResourceCreationAPI* GetResourceCreationAPI();
+
// Returns the Preferences.
const Preferences& preferences() const { return preferences_; }
- // Returns the "new-style" function API for the given interface ID, creating
- // it if necessary.
- // TODO(brettw) this is in progress. It should be merged with the target
- // proxies so there is one list to consult.
- FunctionGroupBase* GetFunctionAPI(ApiID id);
-
uint32 plugin_dispatcher_id() const { return plugin_dispatcher_id_; }
private:
diff --git a/ppapi/proxy/plugin_globals.cc b/ppapi/proxy/plugin_globals.cc
index 95c96ee..cfc3b79 100644
--- a/ppapi/proxy/plugin_globals.cc
+++ b/ppapi/proxy/plugin_globals.cc
@@ -48,10 +48,18 @@ CallbackTracker* PluginGlobals::GetCallbackTrackerForInstance(
return callback_tracker_.get();
}
-FunctionGroupBase* PluginGlobals::GetFunctionAPI(PP_Instance inst, ApiID id) {
- PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(inst);
+thunk::PPB_Instance_API* PluginGlobals::GetInstanceAPI(PP_Instance instance) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (dispatcher)
- return dispatcher->GetFunctionAPI(id);
+ return dispatcher->GetInstanceAPI();
+ return NULL;
+}
+
+thunk::ResourceCreationAPI* PluginGlobals::GetResourceCreationAPI(
+ PP_Instance instance) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+ if (dispatcher)
+ return dispatcher->GetResourceCreationAPI();
return NULL;
}
diff --git a/ppapi/proxy/plugin_globals.h b/ppapi/proxy/plugin_globals.h
index a349ba1..e3424b0 100644
--- a/ppapi/proxy/plugin_globals.h
+++ b/ppapi/proxy/plugin_globals.h
@@ -39,8 +39,10 @@ class PPAPI_PROXY_EXPORT PluginGlobals : 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;
diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc
index 0975cde..1000391 100644
--- a/ppapi/proxy/ppb_audio_proxy.cc
+++ b/ppapi/proxy/ppb_audio_proxy.cc
@@ -171,8 +171,7 @@ void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id,
int32_t sample_rate,
uint32_t sample_frame_count,
HostResource* result) {
- thunk::EnterFunction<thunk::ResourceCreationAPI> resource_creation(
- instance_id, true);
+ thunk::EnterResourceCreation resource_creation(instance_id);
if (resource_creation.failed())
return;
diff --git a/ppapi/proxy/ppb_file_ref_proxy.cc b/ppapi/proxy/ppb_file_ref_proxy.cc
index 9298eb2..26c3e15 100644
--- a/ppapi/proxy/ppb_file_ref_proxy.cc
+++ b/ppapi/proxy/ppb_file_ref_proxy.cc
@@ -21,7 +21,6 @@
#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
-using ppapi::thunk::EnterFunctionNoLock;
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_FileRef_API;
using ppapi::thunk::ResourceCreationAPI;
diff --git a/ppapi/proxy/ppb_file_system_proxy.cc b/ppapi/proxy/ppb_file_system_proxy.cc
index 993c468..370dcab 100644
--- a/ppapi/proxy/ppb_file_system_proxy.cc
+++ b/ppapi/proxy/ppb_file_system_proxy.cc
@@ -19,7 +19,6 @@
#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
-using ppapi::thunk::EnterFunctionNoLock;
using ppapi::thunk::PPB_FileSystem_API;
using ppapi::thunk::ResourceCreationAPI;
diff --git a/ppapi/proxy/ppb_flash_menu_proxy.cc b/ppapi/proxy/ppb_flash_menu_proxy.cc
index d7f5f16..276aaf8 100644
--- a/ppapi/proxy/ppb_flash_menu_proxy.cc
+++ b/ppapi/proxy/ppb_flash_menu_proxy.cc
@@ -13,7 +13,6 @@
#include "ppapi/thunk/ppb_flash_menu_api.h"
#include "ppapi/thunk/resource_creation_api.h"
-using ppapi::thunk::EnterFunctionNoLock;
using ppapi::thunk::PPB_Flash_Menu_API;
using ppapi::thunk::ResourceCreationAPI;
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index c6fc525..9c91830 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -368,7 +368,7 @@ void PPB_Flash_Proxy::OnHostMsgNavigate(PP_Instance instance,
host_dispatcher->set_allow_plugin_reentrancy();
// Make a temporary request resource.
- thunk::EnterFunctionNoLock<thunk::ResourceCreationAPI> enter(instance, true);
+ thunk::EnterResourceCreation enter(instance);
if (enter.failed()) {
*result = PP_ERROR_FAILED;
return;
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc
index 718aeb6..75f7d83 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc
@@ -14,7 +14,6 @@
#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
-using ppapi::thunk::EnterFunctionNoLock;
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_Graphics3D_API;
using ppapi::thunk::ResourceCreationAPI;
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 293ebf0..667a8a2 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -32,7 +32,7 @@
using ppapi::thunk::EnterInstanceNoLock;
using ppapi::thunk::EnterResourceNoLock;
-using ppapi::thunk::PPB_Instance_FunctionAPI;
+using ppapi::thunk::PPB_Instance_API;
namespace ppapi {
namespace proxy {
@@ -156,10 +156,6 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
return handled;
}
-PPB_Instance_FunctionAPI* PPB_Instance_Proxy::AsPPB_Instance_FunctionAPI() {
- return this;
-}
-
PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance,
PP_Resource device) {
Resource* object =
@@ -633,13 +629,19 @@ void PPB_Instance_Proxy::OnHostMsgPostMessage(
}
void PPB_Instance_Proxy::OnHostMsgLockMouse(PP_Instance instance) {
- EnterHostFunctionForceCallback<PPB_Instance_FunctionAPI> enter(
- instance,
- callback_factory_.NewCallback(
- &PPB_Instance_Proxy::MouseLockCompleteInHost,
- instance));
- if (enter.succeeded())
- enter.SetResult(enter.functions()->LockMouse(instance, enter.callback()));
+ // Need to be careful to always issue the callback.
+ pp::CompletionCallback cb = callback_factory_.NewCallback(
+ &PPB_Instance_Proxy::MouseLockCompleteInHost, instance);
+
+ EnterInstanceNoLock enter(instance);
+ if (enter.failed()) {
+ cb.Run(PP_ERROR_BADARGUMENT);
+ return;
+ }
+ int32_t result = enter.functions()->LockMouse(instance,
+ cb.pp_completion_callback());
+ if (result != PP_OK_COMPLETIONPENDING)
+ cb.Run(result);
}
void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) {
diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h
index 3c8ae49..b508a25 100644
--- a/ppapi/proxy/ppb_instance_proxy.h
+++ b/ppapi/proxy/ppb_instance_proxy.h
@@ -11,7 +11,6 @@
#include "ppapi/c/pp_var.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
-#include "ppapi/shared_impl/function_group_base.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/ppb_instance_shared.h"
#include "ppapi/thunk/ppb_instance_api.h"
@@ -40,10 +39,7 @@ class PPB_Instance_Proxy : public InterfaceProxy,
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
- // FunctionGroupBase overrides.
- ppapi::thunk::PPB_Instance_FunctionAPI* AsPPB_Instance_FunctionAPI() OVERRIDE;
-
- // PPB_Instance_FunctionAPI implementation.
+ // PPB_Instance_API implementation.
virtual PP_Bool BindGraphics(PP_Instance instance,
PP_Resource device) OVERRIDE;
virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc
index c300bb9..1eefe0c 100644
--- a/ppapi/proxy/ppb_url_loader_proxy.cc
+++ b/ppapi/proxy/ppb_url_loader_proxy.cc
@@ -34,7 +34,6 @@
#include <sys/shm.h>
#endif
-using ppapi::thunk::EnterFunctionNoLock;
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_URLLoader_API;
using ppapi::thunk::ResourceCreationAPI;
diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc
index d904813..de53735 100644
--- a/ppapi/proxy/resource_creation_proxy.cc
+++ b/ppapi/proxy/resource_creation_proxy.cc
@@ -34,7 +34,6 @@
#include "ppapi/proxy/ppb_video_decoder_proxy.h"
#include "ppapi/proxy/ppb_x509_certificate_private_proxy.h"
#include "ppapi/shared_impl/api_id.h"
-#include "ppapi/shared_impl/function_group_base.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/ppb_audio_config_shared.h"
#include "ppapi/shared_impl/ppb_input_event_shared.h"
@@ -62,10 +61,6 @@ InterfaceProxy* ResourceCreationProxy::Create(Dispatcher* dispatcher) {
return new ResourceCreationProxy(dispatcher);
}
-ResourceCreationAPI* ResourceCreationProxy::AsResourceCreationAPI() {
- return this;
-}
-
PP_Resource ResourceCreationProxy::CreateFileIO(PP_Instance instance) {
return PPB_FileIO_Proxy::CreateProxyResource(instance);
}
diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h
index 0bc9e72..e4fdb52 100644
--- a/ppapi/proxy/resource_creation_proxy.h
+++ b/ppapi/proxy/resource_creation_proxy.h
@@ -35,8 +35,6 @@ class ResourceCreationProxy : public InterfaceProxy,
// constructor).
static InterfaceProxy* Create(Dispatcher* dispatcher);
- virtual thunk::ResourceCreationAPI* AsResourceCreationAPI() OVERRIDE;
-
// ResourceCreationAPI (called in plugin).
virtual PP_Resource CreateFileIO(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateFileRef(PP_Resource file_system,