Index: components/pairing/bluetooth_host_pairing_controller.cc |
diff --git a/components/pairing/bluetooth_host_pairing_controller.cc b/components/pairing/bluetooth_host_pairing_controller.cc |
index 2968c879956b23c820e1cfc0371a6df287b0b186..00e08f3da68d9796848be7ececd2c10f54543366 100644 |
--- a/components/pairing/bluetooth_host_pairing_controller.cc |
+++ b/components/pairing/bluetooth_host_pairing_controller.cc |
@@ -8,8 +8,8 @@ |
#include "base/hash.h" |
#include "base/location.h" |
#include "base/logging.h" |
-#include "base/single_thread_task_runner.h" |
#include "base/strings/stringprintf.h" |
+#include "base/task_runner.h" |
#include "base/task_runner_util.h" |
#include "chromeos/system/devicetype.h" |
#include "components/pairing/bluetooth_pairing_constants.h" |
@@ -86,13 +86,13 @@ std::vector<BluetoothHostPairingController::InputDeviceInfo> GetDevices() { |
} // namespace |
BluetoothHostPairingController::BluetoothHostPairingController( |
- const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) |
+ const scoped_refptr<base::TaskRunner>& input_service_task_runner) |
: current_stage_(STAGE_NONE), |
achuithb
2017/06/19 22:34:42
I don't know if you have any interest in moving th
xiyuan
2017/06/19 23:00:26
I am a fan of in-place initializers. Done.
|
connectivity_status_(CONNECTIVITY_UNTESTED), |
update_status_(UPDATE_STATUS_UNKNOWN), |
enrollment_status_(ENROLLMENT_STATUS_UNKNOWN), |
proto_decoder_(new ProtoDecoder(this)), |
- file_task_runner_(file_task_runner), |
+ input_service_task_runner_(input_service_task_runner), |
ptr_factory_(this) {} |
BluetoothHostPairingController::~BluetoothHostPairingController() { |
@@ -167,7 +167,7 @@ void BluetoothHostPairingController::Reset() { |
void BluetoothHostPairingController::OnGetAdapter( |
scoped_refptr<device::BluetoothAdapter> adapter) { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
DCHECK(!adapter_.get()); |
adapter_ = adapter; |
@@ -180,7 +180,7 @@ void BluetoothHostPairingController::OnGetAdapter( |
} |
void BluetoothHostPairingController::SetPowered() { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
if (adapter_->IsPowered()) { |
was_powered_ = true; |
OnSetPowered(); |
@@ -195,7 +195,7 @@ void BluetoothHostPairingController::SetPowered() { |
} |
void BluetoothHostPairingController::OnSetPowered() { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
adapter_->AddPairingDelegate( |
this, device::BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH); |
@@ -212,7 +212,7 @@ void BluetoothHostPairingController::OnSetPowered() { |
void BluetoothHostPairingController::OnCreateService( |
scoped_refptr<device::BluetoothSocket> socket) { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
service_socket_ = socket; |
service_socket_->Accept( |
@@ -234,7 +234,7 @@ void BluetoothHostPairingController::OnAccept( |
scoped_refptr<device::BluetoothSocket> socket) { |
controller_device_address_ = device->GetAddress(); |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
adapter_->SetDiscoverable( |
false, |
base::Bind(&BluetoothHostPairingController::OnSetDiscoverable, |
@@ -254,7 +254,7 @@ void BluetoothHostPairingController::OnAccept( |
} |
void BluetoothHostPairingController::OnSetDiscoverable(bool change_stage) { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
if (change_stage) { |
DCHECK_EQ(current_stage_, STAGE_NONE); |
ChangeStage(STAGE_WAITING_FOR_CONTROLLER); |
@@ -265,7 +265,7 @@ void BluetoothHostPairingController::OnSendComplete(int bytes_sent) {} |
void BluetoothHostPairingController::OnReceiveComplete( |
int bytes, scoped_refptr<net::IOBuffer> io_buffer) { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
proto_decoder_->DecodeIOBuffer(bytes, io_buffer); |
if (controller_socket_.get()) { |
@@ -349,7 +349,7 @@ void BluetoothHostPairingController::OnForget() { |
} |
base::PostTaskAndReplyWithResult( |
- file_task_runner_.get(), FROM_HERE, base::Bind(&GetDevices), |
+ input_service_task_runner_.get(), FROM_HERE, base::Bind(&GetDevices), |
base::Bind(&BluetoothHostPairingController::PowerOffAdapterIfApplicable, |
ptr_factory_.GetWeakPtr())); |
} |
@@ -386,7 +386,7 @@ void BluetoothHostPairingController::OnConfigureHostMessage( |
void BluetoothHostPairingController::OnPairDevicesMessage( |
const pairing_api::PairDevices& message) { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
enrollment_domain_ = message.parameters().enrolling_domain(); |
ChangeStage(STAGE_ENROLLING); |
for (Observer& observer : observers_) |
@@ -395,7 +395,7 @@ void BluetoothHostPairingController::OnPairDevicesMessage( |
void BluetoothHostPairingController::OnCompleteSetupMessage( |
const pairing_api::CompleteSetup& message) { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
if (current_stage_ != STAGE_ENROLLMENT_SUCCESS) { |
ChangeStage(STAGE_ENROLLMENT_ERROR); |
} else { |
@@ -412,14 +412,14 @@ void BluetoothHostPairingController::OnErrorMessage( |
void BluetoothHostPairingController::OnRebootMessage( |
const pairing_api::Reboot& message) { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
for (Observer& observer : observers_) |
observer.RebootHostRequested(); |
} |
void BluetoothHostPairingController::OnAddNetworkMessage( |
const pairing_api::AddNetwork& message) { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
for (Observer& observer : observers_) |
observer.AddNetworkRequested(message.parameters().onc_spec()); |
} |
@@ -492,7 +492,7 @@ void BluetoothHostPairingController::OnUpdateStatusChanged( |
void BluetoothHostPairingController::OnEnrollmentStatusChanged( |
EnrollmentStatus enrollment_status) { |
DCHECK_EQ(current_stage_, STAGE_ENROLLING); |
- DCHECK(thread_checker_.CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
enrollment_status_ = enrollment_status; |
if (enrollment_status == ENROLLMENT_STATUS_SUCCESS) { |