OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <cmath> | 5 #include <cmath> |
6 #include <set> | 6 #include <set> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/task.h" | 12 #include "base/task.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "content/browser/gamepad/gamepad_provider.h" | 16 #include "content/browser/gamepad/gamepad_provider.h" |
17 #include "content/browser/gamepad/data_fetcher.h" | 17 #include "content/browser/gamepad/data_fetcher.h" |
18 #include "content/common/gamepad_messages.h" | 18 #include "content/common/gamepad_messages.h" |
19 | 19 |
20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
darin (slow to review)
2011/12/15 05:22:23
how about putting all of this gunk into a data_fet
| |
21 #include "content/browser/gamepad/data_fetcher_win.h" | 21 #include "content/browser/gamepad/data_fetcher_win.h" |
22 #elif defined(OS_MACOSX) | 22 #elif defined(OS_MACOSX) |
23 #include "content/browser/gamepad/data_fetcher_mac.h" | 23 #include "content/browser/gamepad/data_fetcher_mac.h" |
24 #elif defined(OS_LINUX) | |
25 #include "content/browser/gamepad/data_fetcher_linux.h" | |
24 #endif | 26 #endif |
25 | 27 |
26 namespace content { | 28 namespace content { |
27 | 29 |
28 // Define the default data fetcher that GamepadProvider will use if none is | 30 // Define the default data fetcher that GamepadProvider will use if none is |
29 // supplied. (GamepadPlatformDataFetcher). | 31 // supplied. (GamepadPlatformDataFetcher). |
30 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
31 | 33 |
32 typedef GamepadDataFetcherWindows GamepadPlatformDataFetcher; | 34 typedef GamepadDataFetcherWindows GamepadPlatformDataFetcher; |
darin (slow to review)
2011/12/15 05:22:23
why is the typedef from FooBarWindows to FooPlatfo
| |
33 | 35 |
34 #elif defined(OS_MACOSX) | 36 #elif defined(OS_MACOSX) |
35 | 37 |
36 typedef GamepadDataFetcherMac GamepadPlatformDataFetcher; | 38 typedef GamepadDataFetcherMac GamepadPlatformDataFetcher; |
37 | 39 |
40 #elif defined(OS_LINUX) | |
41 | |
42 typedef GamepadDataFetcherLinux GamepadPlatformDataFetcher; | |
43 | |
38 #else | 44 #else |
39 | 45 |
40 class GamepadEmptyDataFetcher : public GamepadDataFetcher { | 46 class GamepadEmptyDataFetcher : public GamepadDataFetcher { |
41 public: | 47 public: |
42 void GetGamepadData(WebKit::WebGamepads* pads, bool) { | 48 void GetGamepadData(WebKit::WebGamepads* pads, bool) { |
43 pads->length = 0; | 49 pads->length = 0; |
44 } | 50 } |
45 }; | 51 }; |
46 typedef GamepadEmptyDataFetcher GamepadPlatformDataFetcher; | 52 typedef GamepadEmptyDataFetcher GamepadPlatformDataFetcher; |
47 | 53 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 kDesiredSamplingIntervalMs); | 175 kDesiredSamplingIntervalMs); |
170 } | 176 } |
171 | 177 |
172 GamepadHardwareBuffer* GamepadProvider::SharedMemoryAsHardwareBuffer() { | 178 GamepadHardwareBuffer* GamepadProvider::SharedMemoryAsHardwareBuffer() { |
173 void* mem = gamepad_shared_memory_.memory(); | 179 void* mem = gamepad_shared_memory_.memory(); |
174 DCHECK(mem); | 180 DCHECK(mem); |
175 return static_cast<GamepadHardwareBuffer*>(mem); | 181 return static_cast<GamepadHardwareBuffer*>(mem); |
176 } | 182 } |
177 | 183 |
178 } // namespace content | 184 } // namespace content |
OLD | NEW |