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

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

Issue 2718583002: Refactor WebBluetoothServiceClient in the web_bluetooth.mojom (Closed)
Patch Set: rebase Created 3 years, 9 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/Bluetooth.h
diff --git a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.h b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.h
index 699bfecdcc1df74026a6627c259e28905c215f4e..049eba181bd35e56c4522855f9afceb125407a30 100644
--- a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.h
+++ b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.h
@@ -8,29 +8,23 @@
#include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptWrappable.h"
#include "modules/bluetooth/BluetoothDevice.h"
-#include "mojo/public/cpp/bindings/associated_binding.h"
#include "platform/heap/Handle.h"
#include "public/platform/modules/bluetooth/web_bluetooth.mojom-blink.h"
#include <memory>
namespace blink {
-class BluetoothRemoteGATTCharacteristic;
class RequestDeviceOptions;
class ScriptPromise;
class ScriptState;
-class Bluetooth : public GarbageCollectedFinalized<Bluetooth>,
- public ScriptWrappable,
- public mojom::blink::WebBluetoothServiceClient {
+class Bluetooth final : public GarbageCollectedFinalized<Bluetooth>,
+ public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
- USING_PRE_FINALIZER(Bluetooth, Dispose);
public:
static Bluetooth* Create() { return new Bluetooth(); }
- void Dispose();
-
// IDL exposed interface:
ScriptPromise requestDevice(ScriptState*,
const RequestDeviceOptions&,
@@ -38,26 +32,12 @@ class Bluetooth : public GarbageCollectedFinalized<Bluetooth>,
mojom::blink::WebBluetoothService* Service() { return m_service.get(); }
- void AddToConnectedDevicesMap(const String& deviceId, BluetoothDevice*);
-
- void RemoveFromConnectedDevicesMap(const String& deviceId);
-
- void RegisterCharacteristicObject(const String& characteristicInstanceId,
- BluetoothRemoteGATTCharacteristic*);
- void CharacteristicObjectRemoved(const String& characteristicInstanceId);
-
// Interface required by Garbage Collection:
DECLARE_VIRTUAL_TRACE();
private:
Bluetooth();
- // mojom::blink::WebBluetoothServiceClient:
- void RemoteCharacteristicValueChanged(
- const WTF::String& characteristicInstanceId,
- const WTF::Vector<uint8_t>& value) override;
- void GattServerDisconnected(const WTF::String& deviceId) override;
-
BluetoothDevice* GetBluetoothDeviceRepresentingDevice(
mojom::blink::WebBluetoothDevicePtr,
ScriptPromiseResolver*);
@@ -71,24 +51,7 @@ class Bluetooth : public GarbageCollectedFinalized<Bluetooth>,
// Bluetooth device inside a single global object.
HeapHashMap<String, Member<BluetoothDevice>> m_deviceInstanceMap;
- // Map of characteristic instance ids to BluetoothRemoteGATTCharacteristic.
- // When characteristicObjectRemoved is called the characteristic should be
- // removed from the map. Keeps track of what characteristics have listeners.
- HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>>
- m_activeCharacteristics;
-
- // Map of device ids to BluetoothDevice. Added in
- // BluetoothRemoteGATTServer::connect() and removed in
- // BluetoothRemoteGATTServer::disconnect(). This means a device may not
- // actually be connected while in this map, but that it will definitely be
- // removed when the page navigates.
- HeapHashMap<String, Member<BluetoothDevice>> m_connectedDevices;
-
mojom::blink::WebBluetoothServicePtr m_service;
-
- // Binding associated with |m_service|.
- mojo::AssociatedBinding<mojom::blink::WebBluetoothServiceClient>
- m_clientBinding;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698