Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1168)

Side by Side Diff: device/hid/hid_service.cc

Issue 936603003: Enumerate HID devices asynchronously on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use "OnFileThread" suffix. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | device/hid/hid_service_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/hid/hid_service.h" 5 #include "device/hid/hid_service.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 HidService* HidService::GetInstance( 36 HidService* HidService::GetInstance(
37 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) { 37 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) {
38 if (g_service == NULL) { 38 if (g_service == NULL) {
39 #if defined(OS_LINUX) && defined(USE_UDEV) 39 #if defined(OS_LINUX) && defined(USE_UDEV)
40 g_service = new HidServiceLinux(file_task_runner); 40 g_service = new HidServiceLinux(file_task_runner);
41 #elif defined(OS_MACOSX) 41 #elif defined(OS_MACOSX)
42 g_service = new HidServiceMac(file_task_runner); 42 g_service = new HidServiceMac(file_task_runner);
43 #elif defined(OS_WIN) 43 #elif defined(OS_WIN)
44 g_service = new HidServiceWin(); 44 g_service = new HidServiceWin(file_task_runner);
45 #endif 45 #endif
46 if (g_service != nullptr) { 46 if (g_service != nullptr) {
47 base::AtExitManager::RegisterTask(base::Bind( 47 base::AtExitManager::RegisterTask(base::Bind(
48 &base::DeletePointer<HidService>, base::Unretained(g_service))); 48 &base::DeletePointer<HidService>, base::Unretained(g_service)));
49 } 49 }
50 } 50 }
51 return g_service; 51 return g_service;
52 } 52 }
53 53
54 void HidService::SetInstanceForTest(HidService* instance) { 54 void HidService::SetInstanceForTest(HidService* instance) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 for (const GetDevicesCallback& callback : pending_enumerations_) { 132 for (const GetDevicesCallback& callback : pending_enumerations_) {
133 callback.Run(devices); 133 callback.Run(devices);
134 } 134 }
135 pending_enumerations_.clear(); 135 pending_enumerations_.clear();
136 } 136 }
137 } 137 }
138 138
139 } // namespace device 139 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | device/hid/hid_service_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698