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

Unified Diff: content/browser/device_sensors/device_sensor_host.cc

Issue 2160913005: Use a ThreadChecker in DeviceSensorHost instead of DCHECK_CURRENTLY_ON. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « content/browser/device_sensors/device_sensor_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/device_sensors/device_sensor_host.cc
diff --git a/content/browser/device_sensors/device_sensor_host.cc b/content/browser/device_sensors/device_sensor_host.cc
index f47429240adbbba70ac84d9664d31e3c508b7847..4ece1b12dea3d137ecc94c11b0661e61e689eb61 100644
--- a/content/browser/device_sensors/device_sensor_host.cc
+++ b/content/browser/device_sensors/device_sensor_host.cc
@@ -18,11 +18,13 @@ void DeviceSensorHost<MojoInterface, consumer_type>::Create(
template <typename MojoInterface, ConsumerType consumer_type>
DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost(
mojo::InterfaceRequest<MojoInterface> request)
- : is_started_(false), binding_(this, std::move(request)) {}
+ : is_started_(false), binding_(this, std::move(request)) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+}
template <typename MojoInterface, ConsumerType consumer_type>
DeviceSensorHost<MojoInterface, consumer_type>::~DeviceSensorHost() {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(thread_checker_.CalledOnValidThread());
if (is_started_)
DeviceSensorService::GetInstance()->RemoveConsumer(consumer_type);
}
@@ -30,7 +32,7 @@ DeviceSensorHost<MojoInterface, consumer_type>::~DeviceSensorHost() {
template <typename MojoInterface, ConsumerType consumer_type>
void DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost::
StartPolling(const typename MojoInterface::StartPollingCallback& callback) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!is_started_);
if (is_started_)
return;
@@ -43,7 +45,7 @@ void DeviceSensorHost<MojoInterface, consumer_type>::DeviceSensorHost::
template <typename MojoInterface, ConsumerType consumer_type>
void DeviceSensorHost<MojoInterface,
consumer_type>::DeviceSensorHost::StopPolling() {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(is_started_);
if (!is_started_)
return;
« no previous file with comments | « content/browser/device_sensors/device_sensor_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698