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

Unified Diff: device/usb/usb_service.h

Issue 2482463002: Remove DeviceMonitorLinux::WillDestroyCurrentMessageLoop(). (Closed)
Patch Set: CR achuithb #24 Created 4 years, 1 month 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/usb/mock_usb_service.cc ('k') | device/usb/usb_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_service.h
diff --git a/device/usb/usb_service.h b/device/usb/usb_service.h
index 85a3922461ccaf5af507a81fb2053d4f9511d94f..99b626d030632b0e9ba880c02b2e4642a998d881 100644
--- a/device/usb/usb_service.h
+++ b/device/usb/usb_service.h
@@ -12,6 +12,7 @@
#include <vector>
#include "base/bind_helpers.h"
+#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
@@ -57,6 +58,11 @@ class UsbService : public base::NonThreadSafe {
scoped_refptr<UsbDevice> GetDevice(const std::string& guid);
+ // Shuts down the UsbService. Must be called before destroying the UsbService
+ // when tasks can still be posted to the |blocking_task_runner| provided to
+ // Create().
+ virtual void Shutdown();
+
// Enumerates available devices.
virtual void GetDevices(const GetDevicesCallback& callback);
@@ -89,14 +95,16 @@ class UsbService : public base::NonThreadSafe {
}
private:
- friend void base::DeletePointer<UsbService>(UsbService* service);
-
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
std::unordered_map<std::string, scoped_refptr<UsbDevice>> devices_;
std::unordered_set<std::string> testing_devices_;
base::ObserverList<Observer, true> observer_list_;
+#if DCHECK_IS_ON()
+ bool did_shutdown_ = false;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(UsbService);
};
« no previous file with comments | « device/usb/mock_usb_service.cc ('k') | device/usb/usb_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698