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

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

Issue 1334763002: bluetooth: Subscribe to notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-origin
Patch Set: Fix global interface test Created 5 years, 2 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/BluetoothGATTCharacteristic.h
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothGATTCharacteristic.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothGATTCharacteristic.h
index 92d78eb0d2ac2b27db1035081ee4321784f641b3..e182232a1009726cec4464d484e2fa25eb0457d7 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothGATTCharacteristic.h
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothGATTCharacteristic.h
@@ -6,8 +6,10 @@
#define BluetoothGATTCharacteristic_h
#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/dom/ActiveDOMObject.h"
#include "core/dom/DOMArrayPiece.h"
#include "platform/heap/Handle.h"
+#include "public/platform/modules/bluetooth/WebBluetoothGATTCharacteristic.h"
#include "public/platform/modules/bluetooth/WebBluetoothGATTCharacteristicInit.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"
@@ -15,6 +17,7 @@
namespace blink {
+class ExecutionContext;
class ScriptPromise;
class ScriptPromiseResolver;
class ScriptState;
@@ -29,25 +32,43 @@ class ScriptState;
// CallbackPromiseAdapter class comments.
class BluetoothGATTCharacteristic final
: public GarbageCollectedFinalized<BluetoothGATTCharacteristic>
- , public ScriptWrappable {
+ , public ScriptWrappable
+ , public ActiveDOMObject
+ , public WebBluetoothGATTCharacteristic {
+ USING_PRE_FINALIZER(BluetoothGATTCharacteristic, dispose);
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(BluetoothGATTCharacteristic);
DEFINE_WRAPPERTYPEINFO();
public:
- explicit BluetoothGATTCharacteristic(PassOwnPtr<WebBluetoothGATTCharacteristicInit>);
+ explicit BluetoothGATTCharacteristic(ExecutionContext*, PassOwnPtr<WebBluetoothGATTCharacteristicInit>);
// Interface required by CallbackPromiseAdapter.
using WebType = OwnPtr<WebBluetoothGATTCharacteristicInit>;
static BluetoothGATTCharacteristic* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothGATTCharacteristicInit>);
+ // ActiveDOMObject interface.
+ void stop() override;
+
+ // USING_PRE_FINALIZER interface.
+ // Called before the object gets garbage collected.
+ void dispose();
+
+ // Notify our embedder that we should stop any notifications.
+ // The function only notifies the embedder once.
+ void notifyCharacteristicObjectRemoved();
+
// Interface required by garbage collection.
- DEFINE_INLINE_TRACE() { }
+ DECLARE_VIRTUAL_TRACE();
// IDL exposed interface:
String uuid() { return m_webCharacteristic->uuid; }
ScriptPromise readValue(ScriptState*);
ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&);
+ ScriptPromise startNotifications(ScriptState*);
+ ScriptPromise stopNotifications(ScriptState*);
private:
OwnPtr<WebBluetoothGATTCharacteristicInit> m_webCharacteristic;
+ bool m_stopped;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698