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

Unified Diff: device/usb/usb_service.cc

Issue 2905153002: Move off of deprecated base::NonThreadSafe in device/ (Closed)
Patch Set: ThreadChecker => SequenceChecker Created 3 years, 7 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/usb/usb_service.h ('k') | device/usb/usb_service_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_service.cc
diff --git a/device/usb/usb_service.cc b/device/usb/usb_service.cc
index 5aaf9879748694a3c0d691a6f4fa7537c7e01f43..576f320f441d4b9e11ba06257043e73f7299afe5 100644
--- a/device/usb/usb_service.cc
+++ b/device/usb/usb_service.cc
@@ -71,6 +71,7 @@ UsbService::CreateBlockingTaskRunner() {
}
UsbService::~UsbService() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
for (auto& observer : observer_list_)
observer.WillDestroyUsbService();
}
@@ -83,7 +84,7 @@ UsbService::UsbService(
}
scoped_refptr<UsbDevice> UsbService::GetDevice(const std::string& guid) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
auto it = devices_.find(guid);
if (it == devices_.end())
return nullptr;
@@ -102,17 +103,17 @@ void UsbService::GetDevices(const GetDevicesCallback& callback) {
}
void UsbService::AddObserver(Observer* observer) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
observer_list_.AddObserver(observer);
}
void UsbService::RemoveObserver(Observer* observer) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
observer_list_.RemoveObserver(observer);
}
void UsbService::AddDeviceForTesting(scoped_refptr<UsbDevice> device) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!ContainsKey(devices_, device->guid()));
devices_[device->guid()] = device;
testing_devices_.insert(device->guid());
@@ -120,7 +121,7 @@ void UsbService::AddDeviceForTesting(scoped_refptr<UsbDevice> device) {
}
void UsbService::RemoveDeviceForTesting(const std::string& device_guid) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Allow only devices added with AddDeviceForTesting to be removed with this
// method.
auto testing_devices_it = testing_devices_.find(device_guid);
@@ -146,14 +147,14 @@ void UsbService::GetTestDevices(
}
void UsbService::NotifyDeviceAdded(scoped_refptr<UsbDevice> device) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
for (auto& observer : observer_list_)
observer.OnDeviceAdded(device);
}
void UsbService::NotifyDeviceRemoved(scoped_refptr<UsbDevice> device) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
for (auto& observer : observer_list_)
observer.OnDeviceRemoved(device);
« no previous file with comments | « device/usb/usb_service.h ('k') | device/usb/usb_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698