 Chromium Code Reviews
 Chromium Code Reviews Issue 1382743002:
  bluetooth: Add characteristicvaluechanged event  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-notifications-1
    
  
    Issue 1382743002:
  bluetooth: Add characteristicvaluechanged event  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-notifications-1| 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 e182232a1009726cec4464d484e2fa25eb0457d7..602476238a81920298468c30f482d797433458e0 100644 | 
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothGATTCharacteristic.h | 
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothGATTCharacteristic.h | 
| @@ -8,6 +8,7 @@ | 
| #include "bindings/core/v8/ScriptWrappable.h" | 
| #include "core/dom/ActiveDOMObject.h" | 
| #include "core/dom/DOMArrayPiece.h" | 
| +#include "modules/EventTargetModules.h" | 
| #include "platform/heap/Handle.h" | 
| #include "public/platform/modules/bluetooth/WebBluetoothGATTCharacteristic.h" | 
| #include "public/platform/modules/bluetooth/WebBluetoothGATTCharacteristicInit.h" | 
| @@ -31,13 +32,13 @@ class ScriptState; | 
| // "Interface required by CallbackPromiseAdapter" section and the | 
| // CallbackPromiseAdapter class comments. | 
| class BluetoothGATTCharacteristic final | 
| - : public GarbageCollectedFinalized<BluetoothGATTCharacteristic> | 
| - , public ScriptWrappable | 
| + : public RefCountedGarbageCollectedEventTargetWithInlineData<BluetoothGATTCharacteristic> | 
| , public ActiveDOMObject | 
| , public WebBluetoothGATTCharacteristic { | 
| USING_PRE_FINALIZER(BluetoothGATTCharacteristic, dispose); | 
| - WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(BluetoothGATTCharacteristic); | 
| DEFINE_WRAPPERTYPEINFO(); | 
| + REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(BluetoothGATTCharacteristic); | 
| + WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(BluetoothGATTCharacteristic); | 
| public: | 
| explicit BluetoothGATTCharacteristic(ExecutionContext*, PassOwnPtr<WebBluetoothGATTCharacteristicInit>); | 
| @@ -45,6 +46,9 @@ public: | 
| using WebType = OwnPtr<WebBluetoothGATTCharacteristicInit>; | 
| static BluetoothGATTCharacteristic* take(ScriptPromiseResolver*, PassOwnPtr<WebBluetoothGATTCharacteristicInit>); | 
| + // WebBluetoothGATTCharacteristic interface: | 
| + void dispatchCharacteristicValueChanged(const WebVector<uint8_t>& value); | 
| 
tkent
2015/10/19 23:00:59
Add |override|
 
ortuno
2015/10/20 01:12:12
Done.
 | 
| + | 
| // ActiveDOMObject interface. | 
| void stop() override; | 
| @@ -56,19 +60,28 @@ public: | 
| // The function only notifies the embedder once. | 
| void notifyCharacteristicObjectRemoved(); | 
| + // EventTarget methods: | 
| + const WTF::AtomicString& interfaceName() const override; | 
| 
tkent
2015/10/19 23:00:59
Drop |WTF::|
 
ortuno
2015/10/20 01:12:12
Done.
 | 
| + ExecutionContext* executionContext() const; | 
| + bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener>, bool useCapture) override; | 
| + | 
| // Interface required by garbage collection. | 
| DECLARE_VIRTUAL_TRACE(); | 
| // IDL exposed interface: | 
| String uuid() { return m_webCharacteristic->uuid; } | 
| + PassRefPtr<DOMArrayBuffer> value() const { return m_value; } | 
| ScriptPromise readValue(ScriptState*); | 
| ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); | 
| ScriptPromise startNotifications(ScriptState*); | 
| ScriptPromise stopNotifications(ScriptState*); | 
| + DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); | 
| + | 
| private: | 
| OwnPtr<WebBluetoothGATTCharacteristicInit> m_webCharacteristic; | 
| bool m_stopped; | 
| + RefPtr<DOMArrayBuffer> m_value; | 
| }; | 
| } // namespace blink |