| Index: device/bluetooth/bluetooth_device_win.cc
|
| diff --git a/device/bluetooth/bluetooth_device_win.cc b/device/bluetooth/bluetooth_device_win.cc
|
| index e628a25591b9507561c28266de92a845ca0b4408..e5ba11f3e7906e35570a48e49ed3a9308c7c8cd0 100644
|
| --- a/device/bluetooth/bluetooth_device_win.cc
|
| +++ b/device/bluetooth/bluetooth_device_win.cc
|
| @@ -239,11 +239,9 @@ bool BluetoothDeviceWin::IsEqual(
|
|
|
| UUIDSet new_services;
|
| ServiceRecordMap new_service_records;
|
| - for (ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator
|
| - iter = device_state.service_record_states.begin();
|
| - iter != device_state.service_record_states.end(); ++iter) {
|
| + for (auto& state : device_state.service_record_states) {
|
| BluetoothServiceRecordWin* service_record = new BluetoothServiceRecordWin(
|
| - address_, (*iter)->name, (*iter)->sdp_bytes, (*iter)->gatt_uuid);
|
| + address_, state->name, state->sdp_bytes, state->gatt_uuid);
|
| new_services.insert(service_record->uuid());
|
| new_service_records.set(
|
| service_record->uuid().canonical_value(),
|
| @@ -300,12 +298,9 @@ void BluetoothDeviceWin::UpdateServices(
|
| uuids_.clear();
|
| service_record_list_.clear();
|
|
|
| - for (ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator
|
| - iter = device_state.service_record_states.begin();
|
| - iter != device_state.service_record_states.end(); ++iter) {
|
| - BluetoothServiceRecordWin* service_record =
|
| - new BluetoothServiceRecordWin(device_state.address, (*iter)->name,
|
| - (*iter)->sdp_bytes, (*iter)->gatt_uuid);
|
| + for (auto& state : device_state.service_record_states) {
|
| + BluetoothServiceRecordWin* service_record = new BluetoothServiceRecordWin(
|
| + device_state.address, state->name, state->sdp_bytes, state->gatt_uuid);
|
| service_record_list_.push_back(service_record);
|
| uuids_.insert(service_record->uuid());
|
| }
|
| @@ -330,24 +325,23 @@ bool BluetoothDeviceWin::IsGattServiceDiscovered(BluetoothUUID& uuid,
|
| }
|
|
|
| bool BluetoothDeviceWin::DoesGattServiceExist(
|
| - const ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>&
|
| - service_state,
|
| + const std::vector<std::unique_ptr<
|
| + BluetoothTaskManagerWin::ServiceRecordState>>& service_state,
|
| BluetoothRemoteGattService* service) {
|
| uint16_t attribute_handle =
|
| static_cast<BluetoothRemoteGattServiceWin*>(service)
|
| ->GetAttributeHandle();
|
| BluetoothUUID uuid = service->GetUUID();
|
| - ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator it =
|
| - service_state.begin();
|
| - for (; it != service_state.end(); ++it) {
|
| - if (attribute_handle == (*it)->attribute_handle && uuid == (*it)->gatt_uuid)
|
| + for (auto& state : service_state) {
|
| + if (attribute_handle == state->attribute_handle && uuid == state->gatt_uuid)
|
| return true;
|
| }
|
| return false;
|
| }
|
|
|
| void BluetoothDeviceWin::UpdateGattServices(
|
| - const ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>&
|
| + const std::vector<
|
| + std::unique_ptr<BluetoothTaskManagerWin::ServiceRecordState>>&
|
| service_state) {
|
| // First, remove no longer exist GATT service.
|
| {
|
| @@ -372,13 +366,11 @@ void BluetoothDeviceWin::UpdateGattServices(
|
| return;
|
|
|
| // Add new services.
|
| - for (ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator
|
| - it = service_state.begin();
|
| - it != service_state.end(); ++it) {
|
| - if (!IsGattServiceDiscovered((*it)->gatt_uuid, (*it)->attribute_handle)) {
|
| + for (auto& state : service_state) {
|
| + if (!IsGattServiceDiscovered(state->gatt_uuid, state->attribute_handle)) {
|
| BluetoothRemoteGattServiceWin* primary_service =
|
| - new BluetoothRemoteGattServiceWin(this, (*it)->path, (*it)->gatt_uuid,
|
| - (*it)->attribute_handle, true,
|
| + new BluetoothRemoteGattServiceWin(this, state->path, state->gatt_uuid,
|
| + state->attribute_handle, true,
|
| nullptr, ui_task_runner_);
|
| gatt_services_.add(
|
| primary_service->GetIdentifier(),
|
|
|