[bluetooth][win] Force uncached descriptor value reads
This is a follow-up to r614437 which updates ReadRemoteDescriptor() to also use
the uncached variant of the ReadValueAsync() function so as not to return a
stale value.
Bug: 904114
Change-Id: Ifb7e0be25f799eadc4f1e65aea6c6c5850649019
Reviewed-on: https://chromium-review.googlesource.com/c/1366321
Reviewed-by: Jan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614529}
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc
index 3c7b806f..e70433a 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_winrt.cc
@@ -18,6 +18,7 @@
namespace {
+using ABI::Windows::Devices::Bluetooth::BluetoothCacheMode_Uncached;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattCommunicationStatus;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
@@ -26,14 +27,14 @@
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
GattWriteResult;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
- IGattDescriptor2;
-using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
IGattDescriptor;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
- IGattReadResult2;
+ IGattDescriptor2;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
IGattReadResult;
using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
+ IGattReadResult2;
+using ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::
IGattWriteResult;
using ABI::Windows::Foundation::IAsyncOperation;
using ABI::Windows::Storage::Streams::IBuffer;
@@ -106,9 +107,10 @@
}
ComPtr<IAsyncOperation<GattReadResult*>> read_value_op;
- HRESULT hr = descriptor_->ReadValueAsync(&read_value_op);
+ HRESULT hr = descriptor_->ReadValueWithCacheModeAsync(
+ BluetoothCacheMode_Uncached, &read_value_op);
if (FAILED(hr)) {
- VLOG(2) << "GattDescriptor::ReadValueAsync failed: "
+ VLOG(2) << "GattDescriptor::ReadValueWithCacheModeAsync failed: "
<< logging::SystemErrorCodeToString(hr);
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,