зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1159552 - Clear local arrays while discovering. r=jocelyn
This commit is contained in:
Родитель
f124a393fe
Коммит
54c1083625
|
@ -256,6 +256,8 @@ BluetoothGatt::DiscoverServices(ErrorResult& aRv)
|
|||
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
mDiscoveringServices = true;
|
||||
mServices.Clear();
|
||||
BluetoothGattBinding::ClearCachedServicesValue(this);
|
||||
nsRefPtr<BluetoothReplyRunnable> result =
|
||||
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
|
||||
promise,
|
||||
|
@ -292,6 +294,7 @@ BluetoothGatt::HandleServicesDiscovered(const BluetoothValue& aValue)
|
|||
const InfallibleTArray<BluetoothGattServiceId>& serviceIds =
|
||||
aValue.get_ArrayOfBluetoothGattServiceId();
|
||||
|
||||
mServices.Clear();
|
||||
for (uint32_t i = 0; i < serviceIds.Length(); i++) {
|
||||
mServices.AppendElement(new BluetoothGattService(
|
||||
GetParentObject(), mAppUuid, serviceIds[i]));
|
||||
|
|
|
@ -149,6 +149,7 @@ BluetoothGattCharacteristic::HandleDescriptorsDiscovered(
|
|||
const InfallibleTArray<BluetoothGattId>& descriptorIds =
|
||||
aValue.get_ArrayOfBluetoothGattId();
|
||||
|
||||
mDescriptors.Clear();
|
||||
for (uint32_t i = 0; i < descriptorIds.Length(); i++) {
|
||||
mDescriptors.AppendElement(new BluetoothGattDescriptor(
|
||||
GetParentObject(), this, descriptorIds[i]));
|
||||
|
|
|
@ -85,6 +85,7 @@ BluetoothGattService::HandleIncludedServicesDiscovered(
|
|||
const InfallibleTArray<BluetoothGattServiceId>& includedServIds =
|
||||
aValue.get_ArrayOfBluetoothGattServiceId();
|
||||
|
||||
mIncludedServices.Clear();
|
||||
for (uint32_t i = 0; i < includedServIds.Length(); i++) {
|
||||
mIncludedServices.AppendElement(new BluetoothGattService(
|
||||
GetParentObject(), mAppUuid, includedServIds[i]));
|
||||
|
@ -103,6 +104,7 @@ BluetoothGattService::HandleCharacteristicsDiscovered(
|
|||
const InfallibleTArray<BluetoothGattCharAttribute>& characteristics =
|
||||
aValue.get_ArrayOfBluetoothGattCharAttribute();
|
||||
|
||||
mCharacteristics.Clear();
|
||||
for (uint32_t i = 0; i < characteristics.Length(); i++) {
|
||||
mCharacteristics.AppendElement(new BluetoothGattCharacteristic(
|
||||
GetParentObject(), this, characteristics[i]));
|
||||
|
|
Загрузка…
Ссылка в новой задаче