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

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.cc

Issue 9405033: Revise gamepad interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "native_client/src/shared/ppapi_proxy/plugin_instance_data.h" 5 #include "native_client/src/shared/ppapi_proxy/plugin_instance_data.h"
6 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.h" 6 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_gamepad.h"
7 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" 7 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
8 #include "native_client/src/shared/ppapi_proxy/utility.h" 8 #include "native_client/src/shared/ppapi_proxy/utility.h"
9 #include "ppapi/c/pp_size.h" 9 #include "ppapi/c/pp_size.h"
10 #include "ppapi/c/dev/ppb_fullscreen_dev.h" 10 #include "ppapi/c/dev/ppb_fullscreen_dev.h"
11 #include "srpcgen/ppb_rpc.h" 11 #include "srpcgen/ppb_rpc.h"
12 12
13 namespace ppapi_proxy { 13 namespace ppapi_proxy {
14 14
15 namespace { 15 namespace {
16 16
17 void SampleGamepads(PP_Instance instance, struct PP_GamepadsData_Dev* pads) { 17 void SampleGamepads(PP_Instance instance,
18 struct PP_GamepadsSampleData_Dev* pads) {
18 DebugPrintf("PPB_Gamepad::SampleGamepads: instance=%"NACL_PRId32"\n", 19 DebugPrintf("PPB_Gamepad::SampleGamepads: instance=%"NACL_PRId32"\n",
19 instance); 20 instance);
20 if (pads == NULL) 21 if (pads == NULL)
21 return; 22 return;
22 23
23 nacl_abi_size_t pads_bytes = 24 nacl_abi_size_t pads_bytes =
24 static_cast<nacl_abi_size_t>(sizeof(struct PP_GamepadsData_Dev)); 25 static_cast<nacl_abi_size_t>(sizeof(struct PP_GamepadsSampleData_Dev));
25 NaClSrpcError srpc_result = 26 NaClSrpcError srpc_result =
26 PpbGamepadRpcClient::PPB_Gamepad_SampleGamepads( 27 PpbGamepadRpcClient::PPB_Gamepad_SampleGamepads(
27 GetMainSrpcChannel(), 28 GetMainSrpcChannel(),
28 instance, 29 instance,
29 &pads_bytes, 30 &pads_bytes,
30 reinterpret_cast<char*>(pads)); 31 reinterpret_cast<char*>(pads));
31 DebugPrintf("PPB_Gamepad::SampleGamepads: %s\n", 32 DebugPrintf("PPB_Gamepad::SampleGamepads: %s\n",
32 NaClSrpcErrorString(srpc_result)); 33 NaClSrpcErrorString(srpc_result));
33 34
34 if (srpc_result != NACL_SRPC_RESULT_OK) 35 if (srpc_result != NACL_SRPC_RESULT_OK)
35 pads->length = 0; 36 pads->length = 0;
36 } 37 }
37 38
38 } // namespace 39 } // namespace
39 40
40 const PPB_Gamepad_Dev* PluginGamepad::GetInterface() { 41 const PPB_Gamepad_Dev* PluginGamepad::GetInterface() {
41 static const PPB_Gamepad_Dev gamepad_interface = { 42 static const PPB_Gamepad_Dev gamepad_interface = {
42 SampleGamepads 43 SampleGamepads
43 }; 44 };
44 return &gamepad_interface; 45 return &gamepad_interface;
45 } 46 }
46 47
47 } // namespace ppapi_proxy 48 } // namespace ppapi_proxy
OLDNEW
« no previous file with comments | « ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_gamepad_rpc_server.cc ('k') | ppapi/proxy/ppb_instance_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698