OLD | NEW |
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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "ppapi/c/ppb_gamepad.h" | 7 #include "ppapi/c/ppb_gamepad.h" |
8 #include "ppapi/thunk/thunk.h" | 8 #include "ppapi/thunk/thunk.h" |
9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
10 #include "ppapi/thunk/ppb_gamepad_api.h" | 10 #include "ppapi/thunk/ppb_gamepad_api.h" |
11 #include "ppapi/thunk/ppb_instance_api.h" | 11 #include "ppapi/thunk/ppb_instance_api.h" |
12 #include "ppapi/thunk/resource_creation_api.h" | 12 #include "ppapi/thunk/resource_creation_api.h" |
13 | 13 |
14 namespace ppapi { | 14 namespace ppapi { |
15 namespace thunk { | 15 namespace thunk { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 void SampleGamepads(PP_Instance instance, PP_GamepadsSampleData* data) { | 19 void SampleGamepads(PP_Instance instance, PP_GamepadsSampleData* data) { |
20 EnterInstanceAPI<PPB_Gamepad_API> enter(instance); | 20 EnterInstanceAPI<PPB_Gamepad_API> enter(instance); |
21 if (enter.succeeded()) { | 21 if (enter.succeeded()) { |
22 enter.functions()->Sample(data); | 22 enter.functions()->Sample(instance, data); |
23 return; | 23 return; |
24 } | 24 } |
25 // Failure, zero out. | 25 // Failure, zero out. |
26 memset(data, 0, sizeof(PP_GamepadsSampleData)); | 26 memset(data, 0, sizeof(PP_GamepadsSampleData)); |
27 } | 27 } |
28 | 28 |
29 const PPB_Gamepad g_ppb_gamepad_thunk = { | 29 const PPB_Gamepad g_ppb_gamepad_thunk = { |
30 &SampleGamepads, | 30 &SampleGamepads, |
31 }; | 31 }; |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 const PPB_Gamepad* GetPPB_Gamepad_1_0_Thunk() { | 35 const PPB_Gamepad* GetPPB_Gamepad_1_0_Thunk() { |
36 return &g_ppb_gamepad_thunk; | 36 return &g_ppb_gamepad_thunk; |
37 } | 37 } |
38 | 38 |
39 } // namespace thunk | 39 } // namespace thunk |
40 } // namespace ppapi | 40 } // namespace ppapi |
OLD | NEW |