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

Unified Diff: device/hid/hid_service.h

Issue 1312993008: Manage HidService lifetime in DeviceClient implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_usb_service_get_instance
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/hid/hid_connection_unittest.cc ('k') | device/hid/hid_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_service.h
diff --git a/device/hid/hid_service.h b/device/hid/hid_service.h
index 811d26fb5168291ef551a079f8ab5c528ebf45a6..c2805c8111b0ba233db8fcb609e1540744460996 100644
--- a/device/hid/hid_service.h
+++ b/device/hid/hid_service.h
@@ -43,13 +43,12 @@ class HidService {
typedef base::Callback<void(scoped_refptr<HidConnection> connection)>
ConnectCallback;
- // Gets a pointer to the HidService singleton. This function should be called
- // on a thread with a MessageLoopForUI and be passed the task runner for a
- // thread with a MessageLoopForIO.
- static HidService* GetInstance(
+ // This function should be called on a thread with a MessageLoopForUI and be
+ // passed the task runner for a thread with a MessageLoopForIO.
+ static scoped_ptr<HidService> Create(
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner);
- static void SetInstanceForTest(HidService* instance);
+ virtual ~HidService();
// Enumerates available devices. The provided callback will always be posted
// to the calling thread's task runner.
@@ -69,13 +68,11 @@ class HidService {
const ConnectCallback& callback) = 0;
protected:
- friend void base::DeletePointer<HidService>(HidService* service);
friend class HidConnectionTest;
typedef std::map<HidDeviceId, scoped_refptr<HidDeviceInfo>> DeviceMap;
HidService();
- virtual ~HidService();
void AddDevice(scoped_refptr<HidDeviceInfo> info);
void RemoveDevice(const HidDeviceId& device_id);
« no previous file with comments | « device/hid/hid_connection_unittest.cc ('k') | device/hid/hid_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698