summaryrefslogtreecommitdiffstats
path: root/device/hid/hid_service.cc
diff options
context:
space:
mode:
authorreillyg <reillyg@chromium.org>2014-12-03 16:26:27 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-04 00:27:20 +0000
commit56868deb02c83ade521fa482e2d03b9319162ae9 (patch)
tree7de3aa7d1acb084f9902bbcd943733fe7df1329a /device/hid/hid_service.cc
parent255cf5511b0932fd3e500089ca3d53bd7e5c13c9 (diff)
downloadchromium_src-56868deb02c83ade521fa482e2d03b9319162ae9.zip
chromium_src-56868deb02c83ade521fa482e2d03b9319162ae9.tar.gz
chromium_src-56868deb02c83ade521fa482e2d03b9319162ae9.tar.bz2
Migrate HidServiceLinux and HidConnectionLinux to BrowserThread::UI.
This patch is a follow-up to https://crrev.com/e8fa00efd0965a7eb5816a that moves the HidService and HidConnection implementations on Linux from the browser's FILE thread to the UI thread. This is being done because the HID APIs on platforms other than Linux are more natural to use on the UI thread. The users of these objects are also usually on the UI thread. (For example, the extension API bindings.) BUG=422540 Review URL: https://codereview.chromium.org/771393002 Cr-Commit-Position: refs/heads/master@{#306729}
Diffstat (limited to 'device/hid/hid_service.cc')
-rw-r--r--device/hid/hid_service.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/device/hid/hid_service.cc b/device/hid/hid_service.cc
index 071b396..78273ae6 100644
--- a/device/hid/hid_service.cc
+++ b/device/hid/hid_service.cc
@@ -4,9 +4,7 @@
#include "device/hid/hid_service.h"
-#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop.h"
#include "base/stl_util.h"
@@ -45,11 +43,10 @@ class HidService::Destroyer : public base::MessageLoop::DestructionObserver {
};
HidService* HidService::GetInstance(
- scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
+ scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) {
if (g_service == NULL) {
#if defined(OS_LINUX) && defined(USE_UDEV)
- g_service = new HidServiceLinux(ui_task_runner);
+ g_service = new HidServiceLinux(file_task_runner);
#elif defined(OS_MACOSX)
g_service = new HidServiceMac(file_task_runner);
#elif defined(OS_WIN)
@@ -87,6 +84,7 @@ void HidService::GetDevices(std::vector<HidDeviceInfo>* devices) {
// Fills in the device info struct of the given device_id.
bool HidService::GetDeviceInfo(const HidDeviceId& device_id,
HidDeviceInfo* info) const {
+ DCHECK(thread_checker_.CalledOnValidThread());
DeviceMap::const_iterator it = devices_.find(device_id);
if (it == devices_.end())
return false;
@@ -95,7 +93,6 @@ bool HidService::GetDeviceInfo(const HidDeviceId& device_id,
}
HidService::HidService() {
- DCHECK(thread_checker_.CalledOnValidThread());
}
void HidService::AddDevice(const HidDeviceInfo& info) {