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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h

Issue 2478013002: bluetooth: Invalidate services upon disconnection (Closed)
Patch Set: Address scheib's comments Created 4 years, 1 month 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
Index: third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
index 87c9ab816561293dff707ebf5c347e32e69e7575..6f6fdaa395f7c1eaec7506a6071569f0962ece4c 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h
@@ -48,6 +48,7 @@ class BluetoothDevice final : public EventTargetWithInlineData,
BluetoothRemoteGATTService* getOrCreateBluetoothRemoteGATTService(
std::unique_ptr<WebBluetoothRemoteGATTService>);
+ bool isValidService(const String& serviceInstanceId);
// We should disconnect from the device in all of the following cases:
// 1. When the object gets GarbageCollected e.g. it went out of scope.
@@ -65,9 +66,15 @@ class BluetoothDevice final : public EventTargetWithInlineData,
// ContextLifecycleObserver interface.
void contextDestroyed() override;
- // If gatt is connected then disconnects and sets gatt.connected to false.
- // Returns true if gatt was disconnected.
- bool disconnectGATTIfConnected();
+ // If gatt is connected then sets gatt.connected to false and disconnects.
+ // This function only performs the necessary steps to ensure a device
+ // disconnects therefore it should only be used when the object is being
+ // garbage collected or the context is being destroyed.
+ void disconnectGATTIfConnected();
+
+ // Performs necessary cleanup when a device disconnects and fires
+ // gattserverdisconnected event.
+ void cleanupDisconnectedDeviceAndFireEvent();
// EventTarget methods:
const AtomicString& interfaceName() const override;

Powered by Google App Engine
This is Rietveld 408576698