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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "native_client/src/shared/ppapi_proxy/plugin_instance_data.h"
6 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.h"
7 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
8 #include "native_client/src/shared/ppapi_proxy/utility.h"
9 #include "ppapi/c/pp_size.h"
10 #include "ppapi/c/dev/ppb_fullscreen_dev.h"
11 #include "srpcgen/ppb_rpc.h"
12
13 namespace ppapi_proxy {
14
15 namespace {
16
17 void SampleGamepads(PP_Instance instance, struct PP_GamepadsData_Dev* pads) {
18 DebugPrintf("PPB_Gamepad::SampleGamepads: instance=%"NACL_PRIu32"\n",
19 instance);
20 if (pads == NULL)
21 return;
22
23 nacl_abi_size_t pads_bytes =
24 static_cast<nacl_abi_size_t>(sizeof(struct PP_GamepadsData_Dev));
25 NaClSrpcError srpc_result =
26 PpbGamepadRpcClient::PPB_Gamepad_SampleGamepads(
27 GetMainSrpcChannel(),
28 instance,
29 &pads_bytes,
30 reinterpret_cast<char*>(pads));
31 DebugPrintf("PPB_Gamepad::SampleGamepads: %s\n",
32 NaClSrpcErrorString(srpc_result));
33
34 if (srpc_result != NACL_SRPC_RESULT_OK)
35 pads->length = 0;
36 }
37
38 } // namespace
39
40 const PPB_Gamepad_Dev* PluginGamepad::GetInterface() {
41 static const PPB_Gamepad_Dev gamepad_interface = {
42 SampleGamepads
43 };
44 return &gamepad_interface;
45 }
46
47 } // namespace ppapi_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698