| 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 // From ppb_gamepad.idl modified Mon Apr 1 08:24:03 2013. | 5 // From ppb_gamepad.idl modified Wed Apr 17 11:16:00 2013. |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/ppb_gamepad.h" | 10 #include "ppapi/c/ppb_gamepad.h" |
| 11 #include "ppapi/shared_impl/tracked_callback.h" | 11 #include "ppapi/shared_impl/tracked_callback.h" |
| 12 #include "ppapi/thunk/enter.h" | 12 #include "ppapi/thunk/enter.h" |
| 13 #include "ppapi/thunk/ppb_gamepad_api.h" | 13 #include "ppapi/thunk/ppb_gamepad_api.h" |
| 14 #include "ppapi/thunk/ppb_instance_api.h" | 14 #include "ppapi/thunk/ppb_instance_api.h" |
| 15 #include "ppapi/thunk/resource_creation_api.h" | 15 #include "ppapi/thunk/resource_creation_api.h" |
| 16 #include "ppapi/thunk/thunk.h" | 16 #include "ppapi/thunk/thunk.h" |
| 17 | 17 |
| 18 namespace ppapi { | 18 namespace ppapi { |
| 19 namespace thunk { | 19 namespace thunk { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 void Sample(PP_Instance instance, struct PP_GamepadsSampleData* data) { | 23 void Sample(PP_Instance instance, struct PP_GamepadsSampleData* data) { |
| 24 VLOG(4) << "PPB_Gamepad::Sample()"; | 24 VLOG(4) << "PPB_Gamepad::Sample()"; |
| 25 EnterInstanceAPI<PPB_Gamepad_API> enter(instance); | 25 EnterInstanceAPI<PPB_Gamepad_API> enter(instance); |
| 26 if (enter.succeeded()) { | 26 if (enter.succeeded()) { |
| 27 enter.functions()->Sample(instance, data); | 27 enter.functions()->Sample(instance, data); |
| 28 return; | 28 return; |
| 29 } | 29 } |
| 30 memset(data, 0, sizeof(struct PP_GamepadsSampleData)); | 30 memset(data, 0, sizeof(*data)); |
| 31 } | 31 } |
| 32 | 32 |
| 33 const PPB_Gamepad_1_0 g_ppb_gamepad_thunk_1_0 = { | 33 const PPB_Gamepad_1_0 g_ppb_gamepad_thunk_1_0 = { |
| 34 &Sample | 34 &Sample |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 const PPB_Gamepad_1_0* GetPPB_Gamepad_1_0_Thunk() { | 39 const PPB_Gamepad_1_0* GetPPB_Gamepad_1_0_Thunk() { |
| 40 return &g_ppb_gamepad_thunk_1_0; | 40 return &g_ppb_gamepad_thunk_1_0; |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace thunk | 43 } // namespace thunk |
| 44 } // namespace ppapi | 44 } // namespace ppapi |
| OLD | NEW |