Chromium Code Reviews| Index: chrome/browser/chromeos/device/input_service_proxy.h |
| diff --git a/chrome/browser/chromeos/device/input_service_proxy.h b/chrome/browser/chromeos/device/input_service_proxy.h |
| index 3c00da6e381eebf32ed42eabca038795c4c45f47..68a27f530c4bc18e950ae215a945e0ff7654cd52 100644 |
| --- a/chrome/browser/chromeos/device/input_service_proxy.h |
| +++ b/chrome/browser/chromeos/device/input_service_proxy.h |
| @@ -10,11 +10,11 @@ |
| #include "base/callback.h" |
| #include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/observer_list.h" |
| #include "base/task_runner.h" |
| #include "base/threading/thread_checker.h" |
| -#include "content/public/browser/browser_thread.h" |
| #include "device/hid/input_service_linux.h" |
| namespace chromeos { |
| @@ -47,12 +47,15 @@ class InputServiceProxy { |
| void GetDeviceInfo(const std::string& id, |
| const GetDeviceInfoCallback& callback); |
| + // Returns the TaskRunner for device::InputServiceLinux. Make it static so |
| + // that all InputServiceProxy instances and code that needs access to |
| + // device::InputServiceLinux uses the same TaskRunner. |
| + static scoped_refptr<base::TaskRunner> GetInputServiceTaskRunner(); |
|
fdoray
2017/06/20 12:42:39
Since it's important for callers that tasks posted
xiyuan
2017/06/20 15:26:55
Done.
|
| + |
| // Should be called once before any InputServiceProxy instance is created. |
| - static void SetThreadIdForTesting(content::BrowserThread::ID thread_id); |
| + static void SetUseUIThreadForTesting(bool use_ui_thread); |
| private: |
| - static content::BrowserThread::ID thread_identifier_; |
| - |
| class ServiceObserver; |
| void OnDeviceAdded(const device::InputServiceLinux::InputDeviceInfo& info); |
| @@ -61,9 +64,7 @@ class InputServiceProxy { |
| base::ObserverList<Observer> observers_; |
| std::unique_ptr<ServiceObserver> service_observer_; |
| - base::ThreadChecker thread_checker_; |
| - |
| - scoped_refptr<base::TaskRunner> task_runner_; |
| + THREAD_CHECKER(thread_checker_); |
| base::WeakPtrFactory<InputServiceProxy> weak_factory_; |