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

Side by Side Diff: ppapi/shared_impl/ppb_gamepad_shared.h

Issue 174213003: PPAPI: Use clang-format on ppapi/shared_impl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove DEPS Created 6 years, 10 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
« no previous file with comments | « ppapi/shared_impl/ppb_device_ref_shared.cc ('k') | ppapi/shared_impl/ppb_gamepad_shared.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_ 5 #ifndef PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_ 6 #define PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "ppapi/c/ppb_gamepad.h" 10 #include "ppapi/c/ppb_gamepad.h"
11 #include "ppapi/shared_impl/ppapi_shared_export.h" 11 #include "ppapi/shared_impl/ppapi_shared_export.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 14
15 // TODO(brettw) when we remove the non-IPC-based gamepad implementation, this 15 // TODO(brettw) when we remove the non-IPC-based gamepad implementation, this
16 // code should all move into the GamepadResource. 16 // code should all move into the GamepadResource.
17 17
18 #pragma pack(push, 1) 18 #pragma pack(push, 1)
19 19
20 // This must match the definition of blink::Gamepad. The GamepadHost unit test 20 // This must match the definition of blink::Gamepad. The GamepadHost unit test
21 // has some compile asserts to validate this. 21 // has some compile asserts to validate this.
22 struct WebKitGamepad { 22 struct WebKitGamepad {
23 static const size_t kIdLengthCap = 128; 23 static const size_t kIdLengthCap = 128;
24 static const size_t kAxesLengthCap = 16; 24 static const size_t kAxesLengthCap = 16;
25 static const size_t kButtonsLengthCap = 32; 25 static const size_t kButtonsLengthCap = 32;
26 26
27 // Is there a gamepad connected at this index? 27 // Is there a gamepad connected at this index?
28 bool connected; 28 bool connected;
29 29
30 // Device identifier (based on manufacturer, model, etc.). 30 // Device identifier (based on manufacturer, model, etc.).
31 base::char16 id[kIdLengthCap]; 31 base::char16 id[kIdLengthCap];
32 32
33 // Monotonically increasing value referring to when the data were last 33 // Monotonically increasing value referring to when the data were last
34 // updated. 34 // updated.
35 unsigned long long timestamp; 35 unsigned long long timestamp;
36 36
37 // Number of valid entries in the axes array. 37 // Number of valid entries in the axes array.
38 unsigned axes_length; 38 unsigned axes_length;
39 39
40 // Normalized values representing axes, in the range [-1..1]. 40 // Normalized values representing axes, in the range [-1..1].
41 float axes[kAxesLengthCap]; 41 float axes[kAxesLengthCap];
42 42
43 // Number of valid entries in the buttons array. 43 // Number of valid entries in the buttons array.
44 unsigned buttons_length; 44 unsigned buttons_length;
45 45
46 // Normalized values representing buttons, in the range [0..1]. 46 // Normalized values representing buttons, in the range [0..1].
47 float buttons[kButtonsLengthCap]; 47 float buttons[kButtonsLengthCap];
48 }; 48 };
49 49
50 // This must match the definition of blink::Gamepads. The GamepadHost unit 50 // This must match the definition of blink::Gamepads. The GamepadHost unit
51 // test has some compile asserts to validate this. 51 // test has some compile asserts to validate this.
52 struct WebKitGamepads { 52 struct WebKitGamepads {
53 static const size_t kItemsLengthCap = 4; 53 static const size_t kItemsLengthCap = 4;
54 54
55 // Number of valid entries in the items array. 55 // Number of valid entries in the items array.
56 unsigned length; 56 unsigned length;
57 57
58 // Gamepad data for N separate gamepad devices. 58 // Gamepad data for N separate gamepad devices.
59 WebKitGamepad items[kItemsLengthCap]; 59 WebKitGamepad items[kItemsLengthCap];
60 }; 60 };
61 61
62 // This is the structure store in shared memory. It must match 62 // This is the structure store in shared memory. It must match
63 // content/common/gamepad_hardware_buffer.h. The GamepadHost unit test has 63 // content/common/gamepad_hardware_buffer.h. The GamepadHost unit test has
64 // some compile asserts to validate this. 64 // some compile asserts to validate this.
65 struct ContentGamepadHardwareBuffer { 65 struct ContentGamepadHardwareBuffer {
66 base::subtle::Atomic32 sequence; 66 base::subtle::Atomic32 sequence;
67 WebKitGamepads buffer; 67 WebKitGamepads buffer;
68 }; 68 };
69 69
70 #pragma pack(pop) 70 #pragma pack(pop)
71 71
72 PPAPI_SHARED_EXPORT void ConvertWebKitGamepadData( 72 PPAPI_SHARED_EXPORT void ConvertWebKitGamepadData(
73 const WebKitGamepads& webkit_data, 73 const WebKitGamepads& webkit_data,
74 PP_GamepadsSampleData* output_data); 74 PP_GamepadsSampleData* output_data);
75 75
76 } // namespace ppapi 76 } // namespace ppapi
77 77
78 #endif // PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_ 78 #endif // PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_device_ref_shared.cc ('k') | ppapi/shared_impl/ppb_gamepad_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698