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

Unified Diff: device/usb/usb_service.cc

Issue 2482463002: Remove DeviceMonitorLinux::WillDestroyCurrentMessageLoop(). (Closed)
Patch Set: Fix ChromeOS build error 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
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());

Powered by Google App Engine
This is Rietveld 408576698