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

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

Issue 2183903002: bluetooth: Reject getPrimaryService(s) if frame is not connected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Docs Created 4 years, 5 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
Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h
index 15aa9edb28d74826ab83cdcd1919109a3d3f4aa2..49386b0ae28c7562d4aa5e5bd6c179176b91291e 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h
@@ -31,6 +31,16 @@ public:
void setConnected(bool connected) { m_connected = connected; }
+ // Adds |resolver| to the set of Active Algorithms. CHECK-fails if
+ // |resolver| was already added.
+ void AddToActiveAlgorithms(ScriptPromiseResolver*);
+ // Returns false if |resolver| was not in the set of Active Algorithms.
+ // Otherwise it removes |resolver| from the set of Active Algorithms and
+ // returns true.
+ bool RemoveFromActiveAlgorithms(ScriptPromiseResolver*);
+ // Removes all ScriptPromiseResolvers from the set of Active Algorithms.
+ void ClearActiveAlgorithms() { m_activeAlgorithms.clear(); }
+
// Interface required by Garbage Collectoin:
DECLARE_VIRTUAL_TRACE();
@@ -46,6 +56,12 @@ public:
private:
ScriptPromise getPrimaryServicesImpl(ScriptState*, mojom::blink::WebBluetoothGATTQueryQuantity, String serviceUUID = String());
+ // Contains a ScriptPromiseResolver corresponding to each algorithm using
+ // this server’s connection. Disconnection i.e. disconnect() method or the
+ // device disconnecting by itself, empties this set so that the algorithm
+ // can tell whether its realm was ever disconnected while it was running.
+ HeapHashSet<Member<ScriptPromiseResolver>> m_activeAlgorithms;
+
Member<BluetoothDevice> m_device;
bool m_connected;
};

Powered by Google App Engine
This is Rietveld 408576698