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
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index 24570e95d..3d7ea8a9 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 @@
   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..b87a184a 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 @@
 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..c5cb90e4 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -246,8 +246,14 @@
   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 88d3763a..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 @@
 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 @@
   // 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..cfc3b791 100644
--- a/ppapi/proxy/plugin_globals.cc
+++ b/ppapi/proxy/plugin_globals.cc
@@ -48,10 +48,18 @@
   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..e3424b0c 100644
--- a/ppapi/proxy/plugin_globals.h
+++ b/ppapi/proxy/plugin_globals.h
@@ -39,8 +39,10 @@
   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 @@
                                   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..9c91830f 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -368,7 +368,7 @@
   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 @@
   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::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..b508a25a 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 @@
   // 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..de537354 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 @@
   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 @@
   // 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 @@
 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 @@
                                       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 @@
   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 @@
   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 @@
   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 @@
 
 }  // 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 @@
 // 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 @@
   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 @@
 
 }  // 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 @@
   }
 };
 
-// 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 @@
 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 b17e1bde..f1f1ef94 100644
--- a/ppapi/thunk/ppb_audio_input_trusted_thunk.cc
+++ b/ppapi/thunk/ppb_audio_input_trusted_thunk.cc
@@ -17,7 +17,7 @@
 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 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 a9904153..d87d84d6 100644
--- a/ppapi/thunk/ppb_audio_trusted_thunk.cc
+++ b/ppapi/thunk/ppb_audio_trusted_thunk.cc
@@ -17,7 +17,7 @@
 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 a3ef579d..9fb115f0 100644
--- a/ppapi/thunk/ppb_broker_thunk.cc
+++ b/ppapi/thunk/ppb_broker_thunk.cc
@@ -15,7 +15,7 @@
 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 {
 
 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 369283cc..eb58684 100644
--- a/ppapi/thunk/ppb_directory_reader_thunk.cc
+++ b/ppapi/thunk/ppb_directory_reader_thunk.cc
@@ -16,7 +16,11 @@
 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 @@
 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..583bc49a 100644
--- a/ppapi/thunk/ppb_flash_message_loop_thunk.cc
+++ b/ppapi/thunk/ppb_flash_message_loop_thunk.cc
@@ -15,7 +15,7 @@
 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 {
 
 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 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..61b3195a 100644
--- a/ppapi/thunk/ppb_gamepad_thunk.cc
+++ b/ppapi/thunk/ppb_gamepad_thunk.cc
@@ -14,7 +14,7 @@
 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..48f6ed1d 100644
--- a/ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc
+++ b/ppapi/thunk/ppb_graphics_3d_trusted_thunk.cc
@@ -23,7 +23,7 @@
 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..2de4dd07 100644
--- a/ppapi/thunk/ppb_host_resolver_private_thunk.cc
+++ b/ppapi/thunk/ppb_host_resolver_private_thunk.cc
@@ -17,7 +17,7 @@
 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..f50842e8 100644
--- a/ppapi/thunk/ppb_image_data_thunk.cc
+++ b/ppapi/thunk/ppb_image_data_thunk.cc
@@ -28,7 +28,7 @@
                    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..8f3f65c3 100644
--- a/ppapi/thunk/ppb_input_event_thunk.cc
+++ b/ppapi/thunk/ppb_input_event_thunk.cc
@@ -14,13 +14,12 @@
 
 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 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 @@
 
 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_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 @@
                                      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 @@
                                   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 @@
                                      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 6a516483..c8cc2303 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -32,9 +32,9 @@
 
 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 {
 
 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 e692601e..0382e923 100644
--- a/ppapi/thunk/ppb_network_monitor_private_thunk.cc
+++ b/ppapi/thunk/ppb_network_monitor_private_thunk.cc
@@ -18,7 +18,7 @@
 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 @@
 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..589948c1 100644
--- a/ppapi/thunk/ppb_scrollbar_thunk.cc
+++ b/ppapi/thunk/ppb_scrollbar_thunk.cc
@@ -15,7 +15,7 @@
 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 @@
 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 bd9703e7..fe01e66 100644
--- a/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
+++ b/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
@@ -18,7 +18,7 @@
 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 31266e89..d739e89 100644
--- a/ppapi/thunk/ppb_transport_thunk.cc
+++ b/ppapi/thunk/ppb_transport_thunk.cc
@@ -18,7 +18,7 @@
 
 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 @@
 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 {
 
 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 @@
 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 @@
 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 @@
 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 2826b881..50e0708 100644
--- a/ppapi/thunk/ppb_x509_certificate_private_thunk.cc
+++ b/ppapi/thunk/ppb_x509_certificate_private_thunk.cc
@@ -17,7 +17,7 @@
     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 {
 
 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 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);
diff --git a/webkit/plugins/ppapi/host_globals.cc b/webkit/plugins/ppapi/host_globals.cc
index 5620b84..610ff153 100644
--- a/webkit/plugins/ppapi/host_globals.cc
+++ b/webkit/plugins/ppapi/host_globals.cc
@@ -11,7 +11,6 @@
 #include "base/rand_util.h"
 #include "base/utf_string_conversions.h"
 #include "ppapi/shared_impl/api_id.h"
-#include "ppapi/shared_impl/function_group_base.h"
 #include "ppapi/shared_impl/id_assignment.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
@@ -22,7 +21,6 @@
 #include "webkit/plugins/plugin_switches.h"
 #include "webkit/plugins/ppapi/plugin_module.h"
 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/resource_creation_impl.h"
 
 using ppapi::CheckIdType;
 using ppapi::MakeTypedId;
@@ -74,18 +72,6 @@
 
 }  // namespace
 
-struct HostGlobals::InstanceData {
-  InstanceData() : instance(0) {}
-
-  // Non-owning pointer to the instance object. When a PluginInstance is
-  // destroyed, it will notify us and we'll delete all associated data.
-  PluginInstance* instance;
-
-  // Lazily allocated function proxies for the different interfaces.
-  scoped_ptr< ::ppapi::FunctionGroupBase >
-      function_proxies[::ppapi::API_ID_COUNT];
-};
-
 HostGlobals* HostGlobals::host_globals_ = NULL;
 
 HostGlobals::HostGlobals() : ::ppapi::PpapiGlobals() {
@@ -113,41 +99,24 @@
 
 ::ppapi::CallbackTracker* HostGlobals::GetCallbackTrackerForInstance(
     PP_Instance instance) {
-  std::map<PP_Instance, linked_ptr<InstanceData> >::iterator found =
-      instance_map_.find(instance);
+  InstanceMap::iterator found = instance_map_.find(instance);
   if (found == instance_map_.end())
     return NULL;
-
-  return found->second->instance->module()->GetCallbackTracker();
+  return found->second->module()->GetCallbackTracker();
 }
 
-::ppapi::FunctionGroupBase* HostGlobals::GetFunctionAPI(PP_Instance pp_instance,
-                                                        ::ppapi::ApiID id) {
-  // Get the instance object. This also ensures that the instance data is in
-  // the map, since we need it below.
+::ppapi::thunk::PPB_Instance_API* HostGlobals::GetInstanceAPI(
+    PP_Instance instance) {
+  // The InstanceAPI is just implemented by the PluginInstance object.
+  return GetInstance(instance);
+}
+
+::ppapi::thunk::ResourceCreationAPI* HostGlobals::GetResourceCreationAPI(
+    PP_Instance pp_instance) {
   PluginInstance* instance = GetInstance(pp_instance);
   if (!instance)
     return NULL;
-
-  // The instance one is special, since it's just implemented by the instance
-  // object.
-  if (id == ::ppapi::API_ID_PPB_INSTANCE)
-    return instance;
-
-  scoped_ptr< ::ppapi::FunctionGroupBase >& proxy =
-      instance_map_[pp_instance]->function_proxies[id];
-  if (proxy.get())
-    return proxy.get();
-
-  switch (id) {
-    case ::ppapi::API_ID_RESOURCE_CREATION:
-      proxy.reset(new ResourceCreationImpl(instance));
-      break;
-    default:
-      NOTREACHED();
-  }
-
-  return proxy.get();
+  return &instance->resource_creation();
 }
 
 PP_Module HostGlobals::GetModuleForInstance(PP_Instance instance) {
@@ -263,8 +232,7 @@
            instance_map_.find(new_instance) != instance_map_.end() ||
            !instance->module()->ReserveInstanceID(new_instance));
 
-  instance_map_[new_instance] = linked_ptr<InstanceData>(new InstanceData);
-  instance_map_[new_instance]->instance = instance;
+  instance_map_[new_instance] = instance;
 
   resource_tracker_.DidCreateInstance(new_instance);
   return new_instance;
@@ -287,7 +255,7 @@
   InstanceMap::iterator found = instance_map_.find(instance);
   if (found == instance_map_.end())
     return NULL;
-  return found->second->instance;
+  return found->second;
 }
 
 bool HostGlobals::IsHostGlobals() const {
diff --git a/webkit/plugins/ppapi/host_globals.h b/webkit/plugins/ppapi/host_globals.h
index 226f91c..fb46d70 100644
--- a/webkit/plugins/ppapi/host_globals.h
+++ b/webkit/plugins/ppapi/host_globals.h
@@ -38,9 +38,10 @@
   virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE;
   virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance(
       PP_Instance instance) OVERRIDE;
-  virtual ::ppapi::FunctionGroupBase* GetFunctionAPI(
-      PP_Instance inst,
-      ::ppapi::ApiID id) OVERRIDE;
+  virtual ::ppapi::thunk::PPB_Instance_API* GetInstanceAPI(
+      PP_Instance instance) OVERRIDE;
+  virtual ::ppapi::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;
@@ -93,16 +94,13 @@
   // PpapiGlobals overrides.
   virtual bool IsHostGlobals() const OVERRIDE;
 
-  // Per-instance data we track.
-  struct InstanceData;
-
   WEBKIT_PLUGINS_EXPORT static HostGlobals* host_globals_;
 
   ::ppapi::ResourceTracker resource_tracker_;
   HostVarTracker host_var_tracker_;
 
-  // Tracks all live instances and their associated data.
-  typedef std::map<PP_Instance, linked_ptr<InstanceData> > InstanceMap;
+  // Tracks all live instances and their associated object.
+  typedef std::map<PP_Instance, PluginInstance*> InstanceMap;
   InstanceMap instance_map_;
 
   // Tracks all live modules. The pointers are non-owning, the PluginModule
diff --git a/webkit/plugins/ppapi/host_var_tracker.h b/webkit/plugins/ppapi/host_var_tracker.h
index ece0659..4fc1d3c 100644
--- a/webkit/plugins/ppapi/host_var_tracker.h
+++ b/webkit/plugins/ppapi/host_var_tracker.h
@@ -17,7 +17,6 @@
 #include "base/memory/weak_ptr.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
-#include "ppapi/shared_impl/function_group_base.h"
 #include "ppapi/shared_impl/resource_tracker.h"
 #include "ppapi/shared_impl/var_tracker.h"
 #include "webkit/plugins/webkit_plugins_export.h"
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index a89c3e9..72135a9 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -109,7 +109,6 @@
 using ppapi::thunk::PPB_Graphics2D_API;
 using ppapi::thunk::PPB_Graphics3D_API;
 using ppapi::thunk::PPB_ImageData_API;
-using ppapi::thunk::PPB_Instance_FunctionAPI;
 using ppapi::Var;
 using ppapi::ViewData;
 using WebKit::WebBindings;
@@ -306,6 +305,7 @@
       has_webkit_focus_(false),
       has_content_area_focus_(false),
       find_identifier_(-1),
+      resource_creation_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
       plugin_find_interface_(NULL),
       plugin_messaging_interface_(NULL),
       plugin_mouse_lock_interface_(NULL),
@@ -1599,10 +1599,6 @@
     pending_user_gesture_ = 0.0;
 }
 
-PPB_Instance_FunctionAPI* PluginInstance::AsPPB_Instance_FunctionAPI() {
-  return this;
-}
-
 PP_Bool PluginInstance::BindGraphics(PP_Instance instance,
                                      PP_Resource device) {
   if (bound_graphics_.get()) {
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 82770df..e05ca63 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -35,7 +35,6 @@
 #include "ppapi/c/ppp_messaging.h"
 #include "ppapi/c/ppp_mouse_lock.h"
 #include "ppapi/c/private/ppp_instance_private.h"
-#include "ppapi/shared_impl/function_group_base.h"
 #include "ppapi/shared_impl/ppb_instance_shared.h"
 #include "ppapi/shared_impl/ppb_view_shared.h"
 #include "third_party/skia/include/core/SkRefCnt.h"
@@ -47,6 +46,7 @@
 #include "webkit/plugins/ppapi/plugin_delegate.h"
 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
 #include "webkit/plugins/ppapi/ppp_pdf.h"
+#include "webkit/plugins/ppapi/resource_creation_impl.h"
 #include "webkit/plugins/webkit_plugins_export.h"
 
 struct PP_Point;
@@ -93,7 +93,6 @@
 class WEBKIT_PLUGINS_EXPORT PluginInstance :
     public base::RefCounted<PluginInstance>,
     public base::SupportsWeakPtr<PluginInstance>,
-    public ::ppapi::FunctionGroupBase,
     public ::ppapi::PPB_Instance_Shared {
  public:
   // Create and return a PluginInstance object which supports the
@@ -120,6 +119,8 @@
   // nonzero.
   PP_Instance pp_instance() const { return pp_instance_; }
 
+  ResourceCreationImpl& resource_creation() { return resource_creation_; }
+
   // Does some pre-destructor cleanup on the instance. This is necessary
   // because some cleanup depends on the plugin instance still existing (like
   // calling the plugin's DidDestroy function). This function is called from
@@ -324,11 +325,7 @@
   // which sends it back up to the plugin as if it came from the user.
   void SimulateInputEvent(const ::ppapi::InputEventData& input_event);
 
-  // FunctionGroupBase overrides.
-  virtual ::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;
@@ -525,6 +522,9 @@
   // The id of the current find operation, or -1 if none is in process.
   int find_identifier_;
 
+  // Helper object that creates resources.
+  ResourceCreationImpl resource_creation_;
+
   // The plugin-provided interfaces.
   const PPP_Find_Dev* plugin_find_interface_;
   const PPP_Messaging* plugin_messaging_interface_;
diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc
index d946d9f..17ef13b6 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.cc
+++ b/webkit/plugins/ppapi/resource_creation_impl.cc
@@ -55,11 +55,6 @@
 ResourceCreationImpl::~ResourceCreationImpl() {
 }
 
-::ppapi::thunk::ResourceCreationAPI*
-ResourceCreationImpl::AsResourceCreationAPI() {
-  return this;
-}
-
 PP_Resource ResourceCreationImpl::CreateAudio(
     PP_Instance instance,
     PP_Resource config_id,
diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h
index 10b562a..44dae8e 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.h
+++ b/webkit/plugins/ppapi/resource_creation_impl.h
@@ -7,7 +7,6 @@
 
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
-#include "ppapi/shared_impl/function_group_base.h"
 #include "ppapi/thunk/resource_creation_api.h"
 
 namespace webkit {
@@ -15,15 +14,11 @@
 
 class PluginInstance;
 
-class ResourceCreationImpl : public ::ppapi::FunctionGroupBase,
-                             public ::ppapi::thunk::ResourceCreationAPI {
+class ResourceCreationImpl : public ::ppapi::thunk::ResourceCreationAPI {
  public:
   explicit ResourceCreationImpl(PluginInstance* instance);
   virtual ~ResourceCreationImpl();
 
-  // FunctionGroupBase implementation.
-  virtual ::ppapi::thunk::ResourceCreationAPI* AsResourceCreationAPI();
-
   // ResourceCreationAPI implementation.
   virtual PP_Resource CreateAudio(PP_Instance instance,
                                   PP_Resource config_id,