Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.cc

Issue 9148044: Add NaCl proxy for pepper gamepad (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing build file entry Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.cc
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.cc
new file mode 100644
index 0000000000000000000000000000000000000000..83b0f9d981e652e2af46a679e49fe0eb4c374179
--- /dev/null
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2012 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 "native_client/src/shared/ppapi_proxy/plugin_instance_data.h"
+#include "native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.h"
+#include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
+#include "native_client/src/shared/ppapi_proxy/utility.h"
+#include "ppapi/c/pp_size.h"
+#include "ppapi/c/dev/ppb_fullscreen_dev.h"
+#include "srpcgen/ppb_rpc.h"
+
+namespace ppapi_proxy {
+
+namespace {
+
+void SampleGamepads(PP_Instance instance, struct PP_GamepadsData_Dev* pads) {
+ DebugPrintf("PPB_Gamepad::SampleGamepads: instance=%"NACL_PRIu32"\n",
+ instance);
+ if (pads == NULL)
+ return;
+
+ nacl_abi_size_t pads_bytes =
+ static_cast<nacl_abi_size_t>(sizeof(struct PP_GamepadsData_Dev));
+ NaClSrpcError srpc_result =
+ PpbGamepadRpcClient::PPB_Gamepad_SampleGamepads(
+ GetMainSrpcChannel(),
+ instance,
+ &pads_bytes,
+ reinterpret_cast<char*>(pads));
+ DebugPrintf("PPB_Gamepad::SampleGamepads: %s\n",
+ NaClSrpcErrorString(srpc_result));
+
+ if (srpc_result != NACL_SRPC_RESULT_OK)
+ pads->length = 0;
+}
+
+} // namespace
+
+const PPB_Gamepad_Dev* PluginGamepad::GetInterface() {
+ static const PPB_Gamepad_Dev gamepad_interface = {
+ SampleGamepads
+ };
+ return &gamepad_interface;
+}
+
+} // namespace ppapi_proxy

Powered by Google App Engine
This is Rietveld 408576698