summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/gamepad_resource.cc
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 17:59:19 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 17:59:19 +0000
commit109dcfb3cb1c4aebcd1c8c7f8b13c07fb2b45a75 (patch)
treee7a0088fd0e903db09f9465ae72f66892894c49a /ppapi/proxy/gamepad_resource.cc
parent79b5a8c91a073cff723a00d40ab4d0acb95294b1 (diff)
downloadchromium_src-109dcfb3cb1c4aebcd1c8c7f8b13c07fb2b45a75.zip
chromium_src-109dcfb3cb1c4aebcd1c8c7f8b13c07fb2b45a75.tar.gz
chromium_src-109dcfb3cb1c4aebcd1c8c7f8b13c07fb2b45a75.tar.bz2
Refactor the way singleton-style resources are exposed via PPB_Instance
Currently a lot of boilerplate needs to be added everytime we add a new singleton style resource and as we add more of them this will accumulate. This patch reduces the amount of code needed by exposing a GetSingletonResource function in PPB_Instance_API which takes an ID specifying what type of resource is needed. A new Enter type, EnterInstanceAPI, is provided which is templated on the singleton API you want access to. BUG= Review URL: https://codereview.chromium.org/11359063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170221 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/gamepad_resource.cc')
-rw-r--r--ppapi/proxy/gamepad_resource.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/ppapi/proxy/gamepad_resource.cc b/ppapi/proxy/gamepad_resource.cc
index 8a49437..8bbf8cc 100644
--- a/ppapi/proxy/gamepad_resource.cc
+++ b/ppapi/proxy/gamepad_resource.cc
@@ -58,6 +58,10 @@ GamepadResource::GamepadResource(Connection connection, PP_Instance instance)
GamepadResource::~GamepadResource() {
}
+thunk::PPB_Gamepad_API* GamepadResource::AsPPB_Gamepad_API() {
+ return this;
+}
+
void GamepadResource::Sample(PP_GamepadsSampleData* data) {
if (!buffer_) {
// Browser hasn't sent back our shared memory, give the plugin gamepad