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); |
}; |