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

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

Issue 2718583002: Refactor WebBluetoothServiceClient in the web_bluetooth.mojom (Closed)
Patch Set: address dcheng@'s comment 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/BluetoothRemoteGATTCharacteristic.h
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h
index 4f4e831db0651c0c844293c6a9fe6bde60a55e45..546328a6eff7fb7fa93c93f86b9d5abda2858246 100644
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h
@@ -5,16 +5,18 @@
#ifndef BluetoothRemoteGATTCharacteristic_h
#define BluetoothRemoteGATTCharacteristic_h
+#include <list>
+#include <memory>
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/dom/ContextLifecycleObserver.h"
#include "core/dom/DOMArrayPiece.h"
#include "core/dom/DOMDataView.h"
#include "modules/EventTargetModules.h"
#include "modules/bluetooth/BluetoothRemoteGATTService.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 "wtf/text/WTFString.h"
-#include <memory>
namespace blink {
@@ -34,7 +36,8 @@ class ScriptState;
// CallbackPromiseAdapter class comments.
class BluetoothRemoteGATTCharacteristic final
: public EventTargetWithInlineData,
- public ContextLifecycleObserver {
+ public ContextLifecycleObserver,
+ public mojom::blink::WebBluetoothCharacteristicClient {
USING_PRE_FINALIZER(BluetoothRemoteGATTCharacteristic, Dispose);
DEFINE_WRAPPERTYPEINFO();
USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic);
@@ -55,7 +58,9 @@ class BluetoothRemoteGATTCharacteristic final
// Save value.
void SetValue(DOMDataView*);
- void DispatchCharacteristicValueChanged(const Vector<uint8_t>& value);
+ // mojom::blink::WebBluetoothCharacteristicClient:
+ void RemoteCharacteristicValueChanged(
+ const WTF::Vector<uint8_t>& value) override;
// ContextLifecycleObserver interface.
void contextDestroyed(ExecutionContext*) override;
@@ -64,10 +69,6 @@ class BluetoothRemoteGATTCharacteristic final
// 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();
-
// EventTarget methods:
const AtomicString& interfaceName() const override;
ExecutionContext* getExecutionContext() const;
@@ -128,12 +129,16 @@ class BluetoothRemoteGATTCharacteristic final
DOMException* CreateInvalidCharacteristicError();
+ void CloseClientBindings();
+
mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr m_characteristic;
Member<BluetoothRemoteGATTService> m_service;
- bool m_stopped;
Member<BluetoothCharacteristicProperties> m_properties;
Member<DOMDataView> m_value;
Member<BluetoothDevice> m_device;
+ std::list<std::unique_ptr<
+ mojo::AssociatedBinding<mojom::blink::WebBluetoothCharacteristicClient>>>
dcheng 2017/03/23 00:16:57 Can this use AssociatedBindingSet from https://cs.
juncai 2017/03/23 05:34:18 Done.
+ m_clientBindings;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698