Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_EXO_GAMEPAD_H_ | 5 #ifndef COMPONENTS_EXO_GAMEPAD_H_ |
| 6 #define COMPONENTS_EXO_GAMEPAD_H_ | 6 #define COMPONENTS_EXO_GAMEPAD_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 base::Callback<std::unique_ptr<device::GamepadDataFetcher>()>; | 23 base::Callback<std::unique_ptr<device::GamepadDataFetcher>()>; |
| 24 | 24 |
| 25 // This class represents one or more gamepads, it uses a background thread | 25 // This class represents one or more gamepads, it uses a background thread |
| 26 // for polling gamepad devices and notifies the GamepadDelegate of any | 26 // for polling gamepad devices and notifies the GamepadDelegate of any |
| 27 // changes. | 27 // changes. |
| 28 class Gamepad : public aura::client::FocusChangeObserver { | 28 class Gamepad : public aura::client::FocusChangeObserver { |
| 29 public: | 29 public: |
| 30 // This class will post tasks to invoke the delegate on the thread runner | 30 // This class will post tasks to invoke the delegate on the thread runner |
| 31 // which is associated with the thread that is creating this instance. | 31 // which is associated with the thread that is creating this instance. |
| 32 Gamepad(GamepadDelegate* delegate, | 32 Gamepad(GamepadDelegate* delegate, |
| 33 base::SingleThreadTaskRunner* polling_task_runner); | 33 scoped_refptr<base::SingleThreadTaskRunner> polling_task_runner); |
|
reveman
2016/07/19 17:16:53
This just adds ref-count churn. Passing a raw poin
| |
| 34 // Allows test cases to specify a CreateGamepadDataFetcherCallback that | 34 // Allows test cases to specify a CreateGamepadDataFetcherCallback that |
| 35 // overrides the default GamepadPlatformDataFetcher. | 35 // overrides the default GamepadPlatformDataFetcher. |
| 36 Gamepad(GamepadDelegate* delegate, | 36 Gamepad(GamepadDelegate* delegate, |
| 37 base::SingleThreadTaskRunner* polling_task_runner, | 37 scoped_refptr<base::SingleThreadTaskRunner> polling_task_runner, |
|
reveman
2016/07/19 17:16:53
ditto
| |
| 38 CreateGamepadDataFetcherCallback create_fetcher_callback); | 38 CreateGamepadDataFetcherCallback create_fetcher_callback); |
| 39 ~Gamepad() override; | 39 ~Gamepad() override; |
| 40 | 40 |
| 41 // Overridden aura::client::FocusChangeObserver: | 41 // Overridden aura::client::FocusChangeObserver: |
| 42 void OnWindowFocused(aura::Window* gained_focus, | 42 void OnWindowFocused(aura::Window* gained_focus, |
| 43 aura::Window* lost_focus) override; | 43 aura::Window* lost_focus) override; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 class ThreadSafeGamepadChangeFetcher; | 46 class ThreadSafeGamepadChangeFetcher; |
| 47 | 47 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 62 base::ThreadChecker thread_checker_; | 62 base::ThreadChecker thread_checker_; |
| 63 | 63 |
| 64 base::WeakPtrFactory<Gamepad> weak_factory_; | 64 base::WeakPtrFactory<Gamepad> weak_factory_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(Gamepad); | 66 DISALLOW_COPY_AND_ASSIGN(Gamepad); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace exo | 69 } // namespace exo |
| 70 | 70 |
| 71 #endif // COMPONENTS_EXO_GAMEPAD_H_ | 71 #endif // COMPONENTS_EXO_GAMEPAD_H_ |
| OLD | NEW |