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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm

Issue 2115953002: bluetooth: Initialize start_notitications_in_progress_ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
index 8dba0904d91a4093b85ad61309f0684621cd6f07..27f8902da2657bdcb32eb99e2946c70a678c16ff 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
@@ -71,6 +71,7 @@ BluetoothRemoteGattCharacteristicMac::BluetoothRemoteGattCharacteristicMac(
: gatt_service_(gatt_service),
cb_characteristic_(cb_characteristic, base::scoped_policy::RETAIN),
characteristic_value_read_or_write_in_progress_(false),
+ start_notifications_in_progress_(false),
weak_ptr_factory_(this) {
uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID(
[cb_characteristic_.get() UUID]);
@@ -132,6 +133,7 @@ void BluetoothRemoteGattCharacteristicMac::StartNotifySession(
const NotifySessionCallback& callback,
const ErrorCallback& error_callback) {
if (IsNotifying()) {
+ VLOG(2) << "Already notifying. Creating notify session.";
std::unique_ptr<BluetoothGattNotifySessionMac> notify_session(
new BluetoothGattNotifySessionMac(weak_ptr_factory_.GetWeakPtr()));
base::ThreadTaskRunnerHandle::Get()->PostTask(
@@ -139,6 +141,7 @@ void BluetoothRemoteGattCharacteristicMac::StartNotifySession(
base::Bind(callback, base::Passed(std::move(notify_session))));
return;
}
+
if (!SupportsNotificationsOrIndications()) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
@@ -146,10 +149,16 @@ void BluetoothRemoteGattCharacteristicMac::StartNotifySession(
BluetoothRemoteGattService::GATT_ERROR_NOT_SUPPORTED));
return;
}
+
start_notify_session_callbacks_.push_back(
std::make_pair(callback, error_callback));
- if (start_notifications_in_progress_)
+
+ if (start_notifications_in_progress_) {
+ VLOG(2) << "Start Notifications already in progress. "
+ << "Request has been queued.";
return;
+ }
+
[gatt_service_->GetCBPeripheral() setNotifyValue:YES
forCharacteristic:cb_characteristic_.get()];
start_notifications_in_progress_ = true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698