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

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

Issue 2718583002: Refactor WebBluetoothServiceClient in the web_bluetooth.mojom (Closed)
Patch Set: fix content unit tests Created 3 years, 10 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 1e33026ced286671b4a9bb5da65033ec7431b407..2260f14daca0e9c7b2885f3da192f18fd13342e4 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTServer.h
@@ -8,6 +8,7 @@
#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/modules/v8/StringOrUnsignedLong.h"
#include "modules/bluetooth/BluetoothDevice.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
#include "platform/heap/Heap.h"
#include "public/platform/modules/bluetooth/web_bluetooth.mojom-blink.h"
#include "wtf/text/WTFString.h"
@@ -21,9 +22,11 @@ class ScriptState;
// BluetoothRemoteGATTServer provides a way to interact with a connected
// bluetooth peripheral.
-class BluetoothRemoteGATTServer final
- : public GarbageCollected<BluetoothRemoteGATTServer>,
- public ScriptWrappable {
+class BluetoothRemoteGATTServer
+ : public GarbageCollectedFinalized<BluetoothRemoteGATTServer>,
+ public ScriptWrappable,
+ public mojom::blink::WebBluetoothServerClient {
+ USING_PRE_FINALIZER(BluetoothRemoteGATTServer, dispose);
DEFINE_WRAPPERTYPEINFO();
public:
@@ -31,6 +34,9 @@ class BluetoothRemoteGATTServer final
static BluetoothRemoteGATTServer* create(BluetoothDevice*);
+ // mojom::blink::WebBluetoothServerClient:
+ void GattServerDisconnected() override;
+
void setConnected(bool connected) { m_connected = connected; }
// The Active Algorithms set is maintained so that disconnection, i.e.
@@ -47,6 +53,10 @@ class BluetoothRemoteGATTServer final
// Removes all ScriptPromiseResolvers from the set of Active Algorithms.
void ClearActiveAlgorithms() { m_activeAlgorithms.clear(); }
+ // USING_PRE_FINALIZER interface.
+ // Called before the object gets garbage collected.
+ void dispose();
+
// Interface required by Garbage Collectoin:
DECLARE_VIRTUAL_TRACE();
@@ -70,7 +80,8 @@ class BluetoothRemoteGATTServer final
String serviceUUID = String());
void ConnectCallback(ScriptPromiseResolver*,
- mojom::blink::WebBluetoothResult);
+ mojom::blink::WebBluetoothResult,
+ mojom::blink::WebBluetoothServerClientAssociatedRequest);
void GetPrimaryServicesCallback(
mojom::blink::WebBluetoothGATTQueryQuantity,
ScriptPromiseResolver*,
@@ -82,6 +93,9 @@ class BluetoothRemoteGATTServer final
// using this server’s connection.
HeapHashSet<Member<ScriptPromiseResolver>> m_activeAlgorithms;
+ mojo::AssociatedBinding<mojom::blink::WebBluetoothServerClient>
+ m_clientBinding;
+
Member<BluetoothDevice> m_device;
bool m_connected;
};

Powered by Google App Engine
This is Rietveld 408576698