Index: device/usb/usb_service.cc |
diff --git a/device/usb/usb_service.cc b/device/usb/usb_service.cc |
index 1a2cf98c303515444602a615cffe05c55839ce07..223a5239ecaa57ac5a017043376699312370a622 100644 |
--- a/device/usb/usb_service.cc |
+++ b/device/usb/usb_service.cc |
@@ -51,6 +51,9 @@ std::unique_ptr<UsbService> UsbService::Create( |
} |
UsbService::~UsbService() { |
+#if DCHECK_IS_ON() |
+ DCHECK(did_shutdown_); |
+#endif |
for (const auto& map_entry : devices_) |
map_entry.second->OnDisconnect(); |
for (auto& observer : observer_list_) |
@@ -70,6 +73,13 @@ scoped_refptr<UsbDevice> UsbService::GetDevice(const std::string& guid) { |
return it->second; |
} |
+void UsbService::Shutdown() { |
+#if DCHECK_IS_ON() |
+ DCHECK(!did_shutdown_); |
+ did_shutdown_ = true; |
+#endif |
+} |
+ |
void UsbService::GetDevices(const GetDevicesCallback& callback) { |
std::vector<scoped_refptr<UsbDevice>> devices; |
devices.reserve(devices_.size()); |