diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-30 05:13:17 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-30 05:13:17 +0000 |
commit | 4f2006122fa1a0bb91c3d0451ca123061cfee271 (patch) | |
tree | 4939d74c4032d7e188fc41692a9404c647a9ea1a /ppapi | |
parent | f3f8f3488944ae47bf705a8986b6b73431a19b7d (diff) | |
download | chromium_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')
58 files changed, 208 insertions, 323 deletions
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index 24570e9..3d7ea8a 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -58,8 +58,6 @@ 'shared_impl/callback_tracker.h', 'shared_impl/file_type_conversion.cc', 'shared_impl/file_type_conversion.h', - 'shared_impl/function_group_base.cc', - 'shared_impl/function_group_base.h', 'shared_impl/host_resource.h', 'shared_impl/id_assignment.cc', 'shared_impl/id_assignment.h', 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, 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; diff --git a/ppapi/thunk/enter.cc b/ppapi/thunk/enter.cc index 6b2208a..a511711 100644 --- a/ppapi/thunk/enter.cc +++ b/ppapi/thunk/enter.cc @@ -67,11 +67,6 @@ int32_t EnterBase::SetResult(int32_t result) { return retval_; } -FunctionGroupBase* EnterBase::GetFunctions(PP_Instance instance, - ApiID id) const { - return PpapiGlobals::Get()->GetFunctionAPI(instance, id); -} - Resource* EnterBase::GetResource(PP_Resource resource) const { return PpapiGlobals::Get()->GetResourceTracker()->GetResource(resource); } @@ -144,31 +139,48 @@ void EnterBase::SetStateForFunctionError(PP_Instance pp_instance, } // namespace subtle -EnterResourceCreation::EnterResourceCreation(PP_Instance instance) - : EnterFunction<ResourceCreationAPI>(instance, true) { -} - -EnterResourceCreation::~EnterResourceCreation() { -} - EnterInstance::EnterInstance(PP_Instance instance) - : EnterFunction<PPB_Instance_FunctionAPI>(instance, true) { + : EnterBase(), + functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) { + SetStateForFunctionError(instance, functions_, true); } EnterInstance::EnterInstance(PP_Instance instance, const PP_CompletionCallback& callback) - : EnterFunction<PPB_Instance_FunctionAPI>(instance, callback, true) { + : EnterBase(callback), + functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) { + SetStateForFunctionError(instance, functions_, true); } EnterInstance::~EnterInstance() { } EnterInstanceNoLock::EnterInstanceNoLock(PP_Instance instance) - : EnterFunctionNoLock<PPB_Instance_FunctionAPI>(instance, true) { + : EnterBase(), + functions_(PpapiGlobals::Get()->GetInstanceAPI(instance)) { + SetStateForFunctionError(instance, functions_, true); } EnterInstanceNoLock::~EnterInstanceNoLock() { } +EnterResourceCreation::EnterResourceCreation(PP_Instance instance) + : EnterBase(), + functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) { + SetStateForFunctionError(instance, functions_, true); +} + +EnterResourceCreation::~EnterResourceCreation() { +} + +EnterResourceCreationNoLock::EnterResourceCreationNoLock(PP_Instance instance) + : EnterBase(), + functions_(PpapiGlobals::Get()->GetResourceCreationAPI(instance)) { + SetStateForFunctionError(instance, functions_, true); +} + +EnterResourceCreationNoLock::~EnterResourceCreationNoLock() { +} + } // namespace thunk } // namespace ppapi diff --git a/ppapi/thunk/enter.h b/ppapi/thunk/enter.h index 5c69acf..1693977 100644 --- a/ppapi/thunk/enter.h +++ b/ppapi/thunk/enter.h @@ -8,7 +8,6 @@ #include "base/basictypes.h" #include "ppapi/c/pp_resource.h" #include "ppapi/shared_impl/api_id.h" -#include "ppapi/shared_impl/function_group_base.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/shared_impl/resource.h" @@ -33,10 +32,6 @@ namespace thunk { // some case like |IsFoo(PP_Resource)| the caller is questioning whether their // handle is this type, and we don't want to report an error if it's not. // -// Standalone functions: EnterFunction -// Automatically gets the implementation for the function API for the -// supplied PP_Instance. -// // Resource member functions: EnterResource // Automatically interprets the given PP_Resource as a resource ID and sets // up the resource object for you. @@ -84,11 +79,6 @@ class PPAPI_THUNK_EXPORT EnterBase { int32_t retval() const { return retval_; } protected: - // Helper function to return a function group from a PP_Instance. Having this - // code be in the non-templatized base keeps us from having to instantiate - // it in every template. - FunctionGroupBase* GetFunctions(PP_Instance instance, ApiID id) const; - // Helper function to return a Resource from a PP_Resource. Having this // code be in the non-templatized base keeps us from having to instantiate // it in every template. @@ -124,72 +114,6 @@ class PPAPI_THUNK_EXPORT EnterBase { } // namespace subtle -// EnterFunction -------------------------------------------------------------- - -template<typename FunctionsT, bool lock_on_entry = true> -class EnterFunction : public subtle::EnterBase, - public subtle::LockOnEntry<lock_on_entry> { - public: - EnterFunction(PP_Instance instance, bool report_error) - : EnterBase() { - Init(instance, report_error); - } - EnterFunction(PP_Instance instance, - const PP_CompletionCallback& callback, - bool report_error) - : EnterBase(callback) { - Init(instance, report_error); - } - - ~EnterFunction() {} - - bool succeeded() const { return !!functions_; } - bool failed() const { return !functions_; } - - FunctionsT* functions() { return functions_; } - - private: - void Init(PP_Instance instance, bool report_error) { - FunctionGroupBase* base = GetFunctions(instance, FunctionsT::kApiID); - if (base) - functions_ = base->GetAs<FunctionsT>(); - else - functions_ = NULL; - SetStateForFunctionError(instance, functions_, report_error); - } - - FunctionsT* functions_; - - DISALLOW_COPY_AND_ASSIGN(EnterFunction); -}; - -// Like EnterFunction but assumes the lock is already held. -template<typename FunctionsT> -class EnterFunctionNoLock : public EnterFunction<FunctionsT, false> { - public: - EnterFunctionNoLock(PP_Instance instance, bool report_error) - : EnterFunction<FunctionsT, false>(instance, report_error) { - } -}; - -// Used when a caller has a resource, and wants to do EnterFunction for the -// instance corresponding to that resource. -template<typename FunctionsT> -class EnterFunctionGivenResource : public EnterFunction<FunctionsT> { - public: - EnterFunctionGivenResource(PP_Resource resource, bool report_error) - : EnterFunction<FunctionsT>(GetInstanceForResource(resource), - report_error) { - } - - private: - static PP_Instance GetInstanceForResource(PP_Resource resource) { - Resource* object = - PpapiGlobals::Get()->GetResourceTracker()->GetResource(resource); - return object ? object->pp_instance() : 0; - } -}; - // EnterResource --------------------------------------------------------------- template<typename ResourceT, bool lock_on_entry = true> @@ -241,32 +165,76 @@ class EnterResourceNoLock : public EnterResource<ResourceT, false> { } }; -// Simpler wrapper to enter the resource creation API. This is used for every -// class so we have this helper function to save template instantiations and -// typing. -class PPAPI_THUNK_EXPORT EnterResourceCreation - : public EnterFunction<ResourceCreationAPI> { - public: - EnterResourceCreation(PP_Instance instance); - ~EnterResourceCreation(); -}; +// EnterInstance --------------------------------------------------------------- -// Simpler wrapper to enter the instance API from proxy code. This is used for -// many interfaces so we have this helper function to save template -// instantiations and typing. class PPAPI_THUNK_EXPORT EnterInstance - : public EnterFunction<PPB_Instance_FunctionAPI> { + : public subtle::EnterBase, + public subtle::LockOnEntry<true> { public: EnterInstance(PP_Instance instance); - EnterInstance(PP_Instance instance, const PP_CompletionCallback& callback); + EnterInstance(PP_Instance instance, + const PP_CompletionCallback& callback); ~EnterInstance(); + + bool succeeded() const { return !!functions_; } + bool failed() const { return !functions_; } + + PPB_Instance_API* functions() { return functions_; } + + private: + PPB_Instance_API* functions_; }; class PPAPI_THUNK_EXPORT EnterInstanceNoLock - : public EnterFunctionNoLock<PPB_Instance_FunctionAPI> { + : public subtle::EnterBase, + public subtle::LockOnEntry<false> { public: EnterInstanceNoLock(PP_Instance instance); + //EnterInstanceNoLock(PP_Instance instance, + // const PP_CompletionCallback& callback); ~EnterInstanceNoLock(); + + bool succeeded() const { return !!functions_; } + bool failed() const { return !functions_; } + + PPB_Instance_API* functions() { return functions_; } + + private: + PPB_Instance_API* functions_; +}; + +// EnterResourceCreation ------------------------------------------------------- + +class PPAPI_THUNK_EXPORT EnterResourceCreation + : public subtle::EnterBase, + public subtle::LockOnEntry<true> { + public: + EnterResourceCreation(PP_Instance instance); + ~EnterResourceCreation(); + + bool succeeded() const { return !!functions_; } + bool failed() const { return !functions_; } + + ResourceCreationAPI* functions() { return functions_; } + + private: + ResourceCreationAPI* functions_; +}; + +class PPAPI_THUNK_EXPORT EnterResourceCreationNoLock + : public subtle::EnterBase, + public subtle::LockOnEntry<false> { + public: + EnterResourceCreationNoLock(PP_Instance instance); + ~EnterResourceCreationNoLock(); + + bool succeeded() const { return !!functions_; } + bool failed() const { return !functions_; } + + ResourceCreationAPI* functions() { return functions_; } + + private: + ResourceCreationAPI* functions_; }; } // namespace thunk diff --git a/ppapi/thunk/ppb_audio_config_thunk.cc b/ppapi/thunk/ppb_audio_config_thunk.cc index 123d148..2dfa112 100644 --- a/ppapi/thunk/ppb_audio_config_thunk.cc +++ b/ppapi/thunk/ppb_audio_config_thunk.cc @@ -16,7 +16,7 @@ namespace { PP_Resource CreateStereo16bit(PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateAudioConfig(instance, sample_rate, diff --git a/ppapi/thunk/ppb_audio_input_trusted_thunk.cc b/ppapi/thunk/ppb_audio_input_trusted_thunk.cc index b17e1bd..f1f1ef9 100644 --- a/ppapi/thunk/ppb_audio_input_trusted_thunk.cc +++ b/ppapi/thunk/ppb_audio_input_trusted_thunk.cc @@ -17,7 +17,7 @@ namespace { typedef EnterResource<PPB_AudioInput_API> EnterAudioInput; PP_Resource Create(PP_Instance instance_id) { - EnterFunction<ResourceCreationAPI> enter(instance_id, true); + EnterResourceCreation enter(instance_id); if (enter.failed()) return 0; return enter.functions()->CreateAudioInput(instance_id); diff --git a/ppapi/thunk/ppb_audio_thunk.cc b/ppapi/thunk/ppb_audio_thunk.cc index 33ddacd..28740e5 100644 --- a/ppapi/thunk/ppb_audio_thunk.cc +++ b/ppapi/thunk/ppb_audio_thunk.cc @@ -18,7 +18,7 @@ PP_Resource Create(PP_Instance instance, PP_Resource config_id, PPB_Audio_Callback callback, void* user_data) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateAudio(instance, config_id, diff --git a/ppapi/thunk/ppb_audio_trusted_thunk.cc b/ppapi/thunk/ppb_audio_trusted_thunk.cc index a990415..d87d84d 100644 --- a/ppapi/thunk/ppb_audio_trusted_thunk.cc +++ b/ppapi/thunk/ppb_audio_trusted_thunk.cc @@ -17,7 +17,7 @@ namespace { typedef EnterResource<PPB_Audio_API> EnterAudio; PP_Resource Create(PP_Instance instance_id) { - EnterFunction<ResourceCreationAPI> enter(instance_id, true); + EnterResourceCreation enter(instance_id); if (enter.failed()) return 0; return enter.functions()->CreateAudioTrusted(instance_id); diff --git a/ppapi/thunk/ppb_broker_thunk.cc b/ppapi/thunk/ppb_broker_thunk.cc index a3ef579..9fb115f 100644 --- a/ppapi/thunk/ppb_broker_thunk.cc +++ b/ppapi/thunk/ppb_broker_thunk.cc @@ -15,7 +15,7 @@ namespace thunk { namespace { PP_Resource CreateTrusted(PP_Instance instance) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateBroker(instance); diff --git a/ppapi/thunk/ppb_buffer_thunk.cc b/ppapi/thunk/ppb_buffer_thunk.cc index 177a342..9c6698d 100644 --- a/ppapi/thunk/ppb_buffer_thunk.cc +++ b/ppapi/thunk/ppb_buffer_thunk.cc @@ -14,7 +14,7 @@ namespace thunk { namespace { PP_Resource Create(PP_Instance instance, uint32_t size) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateBuffer(instance, size); diff --git a/ppapi/thunk/ppb_directory_reader_thunk.cc b/ppapi/thunk/ppb_directory_reader_thunk.cc index 369283c..eb58684 100644 --- a/ppapi/thunk/ppb_directory_reader_thunk.cc +++ b/ppapi/thunk/ppb_directory_reader_thunk.cc @@ -16,7 +16,11 @@ namespace thunk { namespace { PP_Resource Create(PP_Resource directory_ref) { - EnterFunctionGivenResource<ResourceCreationAPI> enter(directory_ref, true); + Resource* object = + PpapiGlobals::Get()->GetResourceTracker()->GetResource(directory_ref); + if (!object) + return 0; + EnterResourceCreation enter(object->pp_instance()); if (enter.failed()) return 0; return enter.functions()->CreateDirectoryReader(directory_ref); diff --git a/ppapi/thunk/ppb_file_ref_thunk.cc b/ppapi/thunk/ppb_file_ref_thunk.cc index 8752b7f..d2a2a53 100644 --- a/ppapi/thunk/ppb_file_ref_thunk.cc +++ b/ppapi/thunk/ppb_file_ref_thunk.cc @@ -20,7 +20,11 @@ namespace { typedef EnterResource<PPB_FileRef_API> EnterFileRef; PP_Resource Create(PP_Resource file_system, const char* path) { - EnterFunctionGivenResource<ResourceCreationAPI> enter(file_system, true); + Resource* object = + PpapiGlobals::Get()->GetResourceTracker()->GetResource(file_system); + if (!object) + return 0; + EnterResourceCreation enter(object->pp_instance()); if (enter.failed()) return 0; return enter.functions()->CreateFileRef(file_system, path); diff --git a/ppapi/thunk/ppb_flash_message_loop_thunk.cc b/ppapi/thunk/ppb_flash_message_loop_thunk.cc index 8fc4258..583bc49 100644 --- a/ppapi/thunk/ppb_flash_message_loop_thunk.cc +++ b/ppapi/thunk/ppb_flash_message_loop_thunk.cc @@ -15,7 +15,7 @@ namespace thunk { namespace { PP_Resource Create(PP_Instance instance) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateFlashMessageLoop(instance); diff --git a/ppapi/thunk/ppb_fullscreen_thunk.cc b/ppapi/thunk/ppb_fullscreen_thunk.cc index b241938..d8904f2 100644 --- a/ppapi/thunk/ppb_fullscreen_thunk.cc +++ b/ppapi/thunk/ppb_fullscreen_thunk.cc @@ -15,7 +15,7 @@ namespace thunk { namespace { PP_Bool IsFullscreen(PP_Instance instance) { - EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); + EnterInstance enter(instance); if (enter.failed()) return PP_FALSE; const ViewData* view = enter.functions()->GetViewData(instance); @@ -25,14 +25,14 @@ PP_Bool IsFullscreen(PP_Instance instance) { } PP_Bool SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { - EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); + EnterInstance enter(instance); if (enter.failed()) return PP_FALSE; return enter.functions()->SetFullscreen(instance, fullscreen); } PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) { - EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); + EnterInstance enter(instance); if (enter.failed()) return PP_FALSE; return enter.functions()->GetScreenSize(instance, size); diff --git a/ppapi/thunk/ppb_gamepad_thunk.cc b/ppapi/thunk/ppb_gamepad_thunk.cc index fb68012..61b3195 100644 --- a/ppapi/thunk/ppb_gamepad_thunk.cc +++ b/ppapi/thunk/ppb_gamepad_thunk.cc @@ -14,7 +14,7 @@ namespace thunk { namespace { void SampleGamepads(PP_Instance instance, PP_GamepadsSampleData* data) { - EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); + EnterInstance enter(instance); if (enter.failed()) return; enter.functions()->SampleGamepads(instance, data); diff --git a/ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc b/ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc index 8933d12..48f6ed1 100644 --- a/ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc +++ b/ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc @@ -23,7 +23,7 @@ PP_Graphics3DTrustedState GetErrorState() { PP_Resource CreateRaw(PP_Instance instance, PP_Resource share_context, const int32_t* attrib_list) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateGraphics3DRaw( diff --git a/ppapi/thunk/ppb_host_resolver_private_thunk.cc b/ppapi/thunk/ppb_host_resolver_private_thunk.cc index 424cee92..2de4dd0 100644 --- a/ppapi/thunk/ppb_host_resolver_private_thunk.cc +++ b/ppapi/thunk/ppb_host_resolver_private_thunk.cc @@ -17,7 +17,7 @@ namespace { typedef EnterResource<PPB_HostResolver_Private_API> EnterHostResolver; PP_Resource Create(PP_Instance instance) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateHostResolverPrivate(instance); diff --git a/ppapi/thunk/ppb_image_data_thunk.cc b/ppapi/thunk/ppb_image_data_thunk.cc index 71c94f7..f50842e 100644 --- a/ppapi/thunk/ppb_image_data_thunk.cc +++ b/ppapi/thunk/ppb_image_data_thunk.cc @@ -28,7 +28,7 @@ PP_Resource Create(PP_Instance instance, PP_ImageDataFormat format, const PP_Size* size, PP_Bool init_to_zero) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateImageData(instance, format, diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc index 78b9cd1..8f3f65c 100644 --- a/ppapi/thunk/ppb_input_event_thunk.cc +++ b/ppapi/thunk/ppb_input_event_thunk.cc @@ -14,13 +14,12 @@ namespace thunk { namespace { -typedef EnterFunction<PPB_Instance_FunctionAPI> EnterInstance; typedef EnterResource<PPB_InputEvent_API> EnterInputEvent; // InputEvent ------------------------------------------------------------------ int32_t RequestInputEvents(PP_Instance instance, uint32_t event_classes) { - EnterInstance enter(instance, true); + EnterInstance enter(instance); if (enter.failed()) return enter.retval(); return enter.functions()->RequestInputEvents(instance, event_classes); @@ -28,7 +27,7 @@ int32_t RequestInputEvents(PP_Instance instance, uint32_t event_classes) { int32_t RequestFilteringInputEvents(PP_Instance instance, uint32_t event_classes) { - EnterInstance enter(instance, true); + EnterInstance enter(instance); if (enter.failed()) return enter.retval(); return enter.functions()->RequestFilteringInputEvents(instance, @@ -37,7 +36,7 @@ int32_t RequestFilteringInputEvents(PP_Instance instance, void ClearInputEventRequest(PP_Instance instance, uint32_t event_classes) { - EnterInstance enter(instance, true); + EnterInstance enter(instance); if (enter.succeeded()) enter.functions()->ClearInputEventRequest(instance, event_classes); } @@ -87,7 +86,7 @@ PP_Resource CreateMouseInputEvent1_0(PP_Instance instance, PP_InputEvent_MouseButton mouse_button, const PP_Point* mouse_position, int32_t click_count) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; @@ -106,7 +105,7 @@ PP_Resource CreateMouseInputEvent1_1(PP_Instance instance, const PP_Point* mouse_position, int32_t click_count, const PP_Point* mouse_movement) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateMouseInputEvent(instance, type, time_stamp, @@ -180,7 +179,7 @@ PP_Resource CreateWheelInputEvent(PP_Instance instance, const PP_FloatPoint* wheel_delta, const PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateWheelInputEvent(instance, time_stamp, @@ -232,7 +231,7 @@ PP_Resource CreateKeyboardInputEvent(PP_Instance instance, uint32_t modifiers, uint32_t key_code, struct PP_Var character_text) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateKeyboardInputEvent(instance, type, time_stamp, diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h index 6a51648..c8cc230 100644 --- a/ppapi/thunk/ppb_instance_api.h +++ b/ppapi/thunk/ppb_instance_api.h @@ -32,9 +32,9 @@ namespace thunk { class PPB_Flash_API; -class PPB_Instance_FunctionAPI { +class PPB_Instance_API { public: - virtual ~PPB_Instance_FunctionAPI() {} + virtual ~PPB_Instance_API() {} virtual PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) = 0; virtual PP_Bool IsFullFrame(PP_Instance instance) = 0; diff --git a/ppapi/thunk/ppb_messaging_thunk.cc b/ppapi/thunk/ppb_messaging_thunk.cc index 6880d3e..c3f464e 100644 --- a/ppapi/thunk/ppb_messaging_thunk.cc +++ b/ppapi/thunk/ppb_messaging_thunk.cc @@ -13,7 +13,7 @@ namespace thunk { namespace { void PostMessage(PP_Instance instance, PP_Var message) { - EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); + EnterInstance enter(instance); if (enter.succeeded()) enter.functions()->PostMessage(instance, message); } diff --git a/ppapi/thunk/ppb_network_monitor_private_thunk.cc b/ppapi/thunk/ppb_network_monitor_private_thunk.cc index e692601..0382e92 100644 --- a/ppapi/thunk/ppb_network_monitor_private_thunk.cc +++ b/ppapi/thunk/ppb_network_monitor_private_thunk.cc @@ -18,7 +18,7 @@ typedef EnterResource<PPB_NetworkMonitor_Private_API> EnterNetworkMonitor; PP_Resource Create(PP_Instance instance, PPB_NetworkMonitor_Callback callback, void* user_data) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateNetworkMonitor(instance, callback, user_data); diff --git a/ppapi/thunk/ppb_resource_array_thunk.cc b/ppapi/thunk/ppb_resource_array_thunk.cc index 1526028..03b7108 100644 --- a/ppapi/thunk/ppb_resource_array_thunk.cc +++ b/ppapi/thunk/ppb_resource_array_thunk.cc @@ -15,7 +15,7 @@ namespace { PP_Resource Create(PP_Instance instance, const PP_Resource elements[], uint32_t size) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateResourceArray(instance, elements, size); diff --git a/ppapi/thunk/ppb_scrollbar_thunk.cc b/ppapi/thunk/ppb_scrollbar_thunk.cc index 5eb040f..589948c 100644 --- a/ppapi/thunk/ppb_scrollbar_thunk.cc +++ b/ppapi/thunk/ppb_scrollbar_thunk.cc @@ -15,7 +15,7 @@ typedef EnterResource<PPB_Scrollbar_API> EnterScrollbar; namespace { PP_Resource Create(PP_Instance instance, PP_Bool vertical) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateScrollbar(instance, vertical); diff --git a/ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc b/ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc index c4b6bd8..fcff45e 100644 --- a/ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc +++ b/ppapi/thunk/ppb_tcp_server_socket_private_thunk.cc @@ -17,7 +17,7 @@ namespace { typedef EnterResource<PPB_TCPServerSocket_Private_API> EnterTCPServer; PP_Resource Create(PP_Instance instance) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateTCPServerSocketPrivate(instance); diff --git a/ppapi/thunk/ppb_tcp_socket_private_thunk.cc b/ppapi/thunk/ppb_tcp_socket_private_thunk.cc index bd9703e..fe01e66 100644 --- a/ppapi/thunk/ppb_tcp_socket_private_thunk.cc +++ b/ppapi/thunk/ppb_tcp_socket_private_thunk.cc @@ -18,7 +18,7 @@ namespace { typedef EnterResource<PPB_TCPSocket_Private_API> EnterTCP; PP_Resource Create(PP_Instance instance) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateTCPSocketPrivate(instance); diff --git a/ppapi/thunk/ppb_transport_thunk.cc b/ppapi/thunk/ppb_transport_thunk.cc index 31266e8..d739e89 100644 --- a/ppapi/thunk/ppb_transport_thunk.cc +++ b/ppapi/thunk/ppb_transport_thunk.cc @@ -18,7 +18,7 @@ typedef EnterResource<PPB_Transport_API> EnterTransport; PP_Resource Create(PP_Instance instance, const char* name, PP_TransportType type) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateTransport(instance, name, type); diff --git a/ppapi/thunk/ppb_udp_socket_private_thunk.cc b/ppapi/thunk/ppb_udp_socket_private_thunk.cc index 4f12a3f..d0452c0 100644 --- a/ppapi/thunk/ppb_udp_socket_private_thunk.cc +++ b/ppapi/thunk/ppb_udp_socket_private_thunk.cc @@ -18,7 +18,7 @@ namespace { typedef EnterResource<PPB_UDPSocket_Private_API> EnterUDP; PP_Resource Create(PP_Instance instance) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateUDPSocketPrivate(instance); diff --git a/ppapi/thunk/ppb_url_request_info_thunk.cc b/ppapi/thunk/ppb_url_request_info_thunk.cc index 536753d..95d8b8b 100644 --- a/ppapi/thunk/ppb_url_request_info_thunk.cc +++ b/ppapi/thunk/ppb_url_request_info_thunk.cc @@ -14,7 +14,7 @@ namespace thunk { namespace { PP_Resource Create(PP_Instance instance) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateURLRequestInfo( diff --git a/ppapi/thunk/ppb_video_capture_thunk.cc b/ppapi/thunk/ppb_video_capture_thunk.cc index 66ea4bc..2471446 100644 --- a/ppapi/thunk/ppb_video_capture_thunk.cc +++ b/ppapi/thunk/ppb_video_capture_thunk.cc @@ -18,7 +18,7 @@ namespace { typedef EnterResource<PPB_VideoCapture_API> EnterVideoCapture; PP_Resource Create(PP_Instance instance) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateVideoCapture(instance); diff --git a/ppapi/thunk/ppb_video_decoder_thunk.cc b/ppapi/thunk/ppb_video_decoder_thunk.cc index 3895c71..594b336 100644 --- a/ppapi/thunk/ppb_video_decoder_thunk.cc +++ b/ppapi/thunk/ppb_video_decoder_thunk.cc @@ -18,7 +18,7 @@ typedef EnterResource<PPB_VideoDecoder_API> EnterVideoDecoder; PP_Resource Create(PP_Instance instance, PP_Resource graphics_3d, PP_VideoDecoder_Profile profile) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateVideoDecoder(instance, graphics_3d, profile); diff --git a/ppapi/thunk/ppb_video_layer_thunk.cc b/ppapi/thunk/ppb_video_layer_thunk.cc index dc1e842..8b97364 100644 --- a/ppapi/thunk/ppb_video_layer_thunk.cc +++ b/ppapi/thunk/ppb_video_layer_thunk.cc @@ -15,7 +15,7 @@ namespace { typedef EnterResource<PPB_VideoLayer_API> EnterVideoLayer; PP_Resource Create(PP_Instance instance, PP_VideoLayerMode_Dev mode) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateVideoLayer(instance, mode); diff --git a/ppapi/thunk/ppb_x509_certificate_private_thunk.cc b/ppapi/thunk/ppb_x509_certificate_private_thunk.cc index 2826b88..50e0708 100644 --- a/ppapi/thunk/ppb_x509_certificate_private_thunk.cc +++ b/ppapi/thunk/ppb_x509_certificate_private_thunk.cc @@ -17,7 +17,7 @@ typedef EnterResource<PPB_X509Certificate_Private_API> EnterX509CertificatePrivate; PP_Resource Create(PP_Instance instance) { - EnterFunction<ResourceCreationAPI> enter(instance, true); + EnterResourceCreation enter(instance); if (enter.failed()) return 0; return enter.functions()->CreateX509CertificatePrivate(instance); diff --git a/ppapi/thunk/ppb_zoom_thunk.cc b/ppapi/thunk/ppb_zoom_thunk.cc index 7ea903c..193e856 100644 --- a/ppapi/thunk/ppb_zoom_thunk.cc +++ b/ppapi/thunk/ppb_zoom_thunk.cc @@ -13,7 +13,7 @@ namespace thunk { namespace { void ZoomChanged(PP_Instance instance, double factor) { - EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); + EnterInstance enter(instance); if (enter.succeeded()) enter.functions()->ZoomChanged(instance, factor); } @@ -21,7 +21,7 @@ void ZoomChanged(PP_Instance instance, double factor) { void ZoomLimitsChanged(PP_Instance instance, double minimum_factor, double maximum_factor) { - EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true); + EnterInstance enter(instance); if (enter.succeeded()) { enter.functions()->ZoomLimitsChanged(instance, minimum_factor, maximum_factor); |