| Index: components/exo/gaming_seat.cc
|
| diff --git a/components/exo/gaming_seat.cc b/components/exo/gaming_seat.cc
|
| index 016be145bb90f467d7c47fe6376c15ef15f3cce4..6a6a0549b98d8f5d544798c71e9bbb7f07572819 100644
|
| --- a/components/exo/gaming_seat.cc
|
| +++ b/components/exo/gaming_seat.cc
|
| @@ -7,10 +7,6 @@
|
| #include <cmath>
|
|
|
| #include "base/bind.h"
|
| -#include "base/location.h"
|
| -#include "base/single_thread_task_runner.h"
|
| -#include "base/threading/thread.h"
|
| -#include "base/threading/thread_task_runner_handle.h"
|
| #include "components/exo/gamepad_delegate.h"
|
| #include "components/exo/gaming_seat_delegate.h"
|
| #include "components/exo/shell_surface.h"
|
| @@ -60,7 +56,7 @@ class GamingSeat::ThreadSafeGamepadChangeFetcher
|
| create_fetcher_callback_(create_fetcher_callback),
|
| polling_task_runner_(task_runner),
|
| origin_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
|
| - thread_checker_.DetachFromThread();
|
| + DETACH_FROM_THREAD(thread_checker_);
|
| }
|
|
|
| // Enable or disable gamepad polling. Can be called from any thread.
|
| @@ -79,7 +75,7 @@ class GamingSeat::ThreadSafeGamepadChangeFetcher
|
|
|
| // Enables or disables polling.
|
| void EnablePollingOnPollingThread(bool enabled) {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
| is_enabled_ = enabled;
|
|
|
| if (is_enabled_) {
|
| @@ -96,7 +92,7 @@ class GamingSeat::ThreadSafeGamepadChangeFetcher
|
|
|
| // Schedules the next poll on the polling thread.
|
| void SchedulePollOnPollingThread() {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
| DCHECK(fetcher_);
|
|
|
| if (!is_enabled_ || has_poll_scheduled_)
|
| @@ -112,7 +108,7 @@ class GamingSeat::ThreadSafeGamepadChangeFetcher
|
|
|
| // Polls devices for new data and posts gamepad changes back to origin thread.
|
| void PollOnPollingThread() {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
|
|
| has_poll_scheduled_ = false;
|
| if (!is_enabled_)
|
| @@ -180,7 +176,7 @@ class GamingSeat::ThreadSafeGamepadChangeFetcher
|
| bool is_enabled_ = false;
|
|
|
| // ThreadChecker for the polling thread.
|
| - base::ThreadChecker thread_checker_;
|
| + THREAD_CHECKER(thread_checker_);
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ThreadSafeGamepadChangeFetcher);
|
| };
|
| @@ -190,20 +186,13 @@ class GamingSeat::ThreadSafeGamepadChangeFetcher
|
|
|
| GamingSeat::GamingSeat(GamingSeatDelegate* gaming_seat_delegate,
|
| base::SingleThreadTaskRunner* polling_task_runner)
|
| - : GamingSeat(gaming_seat_delegate,
|
| - polling_task_runner,
|
| - base::Bind(CreateGamepadPlatformDataFetcher)) {}
|
| -
|
| -GamingSeat::GamingSeat(GamingSeatDelegate* gaming_seat_delegate,
|
| - base::SingleThreadTaskRunner* polling_task_runner,
|
| - CreateGamepadDataFetcherCallback create_fetcher_callback)
|
| : delegate_(gaming_seat_delegate),
|
| gamepad_delegates_{nullptr},
|
| weak_ptr_factory_(this) {
|
| gamepad_change_fetcher_ = new ThreadSafeGamepadChangeFetcher(
|
| base::Bind(&GamingSeat::ProcessGamepadChanges,
|
| weak_ptr_factory_.GetWeakPtr()),
|
| - create_fetcher_callback, polling_task_runner);
|
| + base::Bind(CreateGamepadPlatformDataFetcher), polling_task_runner);
|
|
|
| auto* helper = WMHelper::GetInstance();
|
| helper->AddFocusObserver(this);
|
| @@ -229,7 +218,7 @@ GamingSeat::~GamingSeat() {
|
|
|
| void GamingSeat::OnWindowFocused(aura::Window* gained_focus,
|
| aura::Window* lost_focus) {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
| Surface* target = nullptr;
|
| if (gained_focus) {
|
| target = Surface::AsSurface(gained_focus);
|
| @@ -250,7 +239,7 @@ void GamingSeat::OnWindowFocused(aura::Window* gained_focus,
|
|
|
| void GamingSeat::ProcessGamepadChanges(int index,
|
| const device::Gamepad new_pad) {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
| bool send_frame = false;
|
|
|
| device::Gamepad& pad_state = pad_state_.items[index];
|
|
|