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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BluetoothRemoteGATTCharacteristic_h 5 #ifndef BluetoothRemoteGATTCharacteristic_h
6 #define BluetoothRemoteGATTCharacteristic_h 6 #define BluetoothRemoteGATTCharacteristic_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/ActiveDOMObject.h" 9 #include "core/dom/ActiveDOMObject.h"
10 #include "core/dom/DOMArrayPiece.h" 10 #include "core/dom/DOMArrayPiece.h"
11 #include "core/dom/DOMDataView.h" 11 #include "core/dom/DOMDataView.h"
12 #include "modules/EventTargetModules.h" 12 #include "modules/EventTargetModules.h"
13 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic .h" 14 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic .h"
15 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic Init.h" 15 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic Init.h"
16 #include "wtf/OwnPtr.h"
17 #include "wtf/PassOwnPtr.h"
16 #include "wtf/text/WTFString.h" 18 #include "wtf/text/WTFString.h"
17 #include <memory>
18 19
19 namespace blink { 20 namespace blink {
20 21
21 class BluetoothCharacteristicProperties; 22 class BluetoothCharacteristicProperties;
22 class ExecutionContext; 23 class ExecutionContext;
23 class ScriptPromise; 24 class ScriptPromise;
24 class ScriptPromiseResolver; 25 class ScriptPromiseResolver;
25 class ScriptState; 26 class ScriptState;
26 27
27 // BluetoothRemoteGATTCharacteristic represents a GATT Characteristic, which is a 28 // BluetoothRemoteGATTCharacteristic represents a GATT Characteristic, which is a
28 // basic data element that provides further information about a peripheral's 29 // basic data element that provides further information about a peripheral's
29 // service. 30 // service.
30 // 31 //
31 // Callbacks providing WebBluetoothRemoteGATTCharacteristicInit objects are hand led by 32 // Callbacks providing WebBluetoothRemoteGATTCharacteristicInit objects are hand led by
32 // CallbackPromiseAdapter templatized with this class. See this class's 33 // CallbackPromiseAdapter templatized with this class. See this class's
33 // "Interface required by CallbackPromiseAdapter" section and the 34 // "Interface required by CallbackPromiseAdapter" section and the
34 // CallbackPromiseAdapter class comments. 35 // CallbackPromiseAdapter class comments.
35 class BluetoothRemoteGATTCharacteristic final 36 class BluetoothRemoteGATTCharacteristic final
36 : public EventTargetWithInlineData 37 : public EventTargetWithInlineData
37 , public ActiveDOMObject 38 , public ActiveDOMObject
38 , public WebBluetoothRemoteGATTCharacteristic { 39 , public WebBluetoothRemoteGATTCharacteristic {
39 USING_PRE_FINALIZER(BluetoothRemoteGATTCharacteristic, dispose); 40 USING_PRE_FINALIZER(BluetoothRemoteGATTCharacteristic, dispose);
40 DEFINE_WRAPPERTYPEINFO(); 41 DEFINE_WRAPPERTYPEINFO();
41 USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic); 42 USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic);
42 public: 43 public:
43 explicit BluetoothRemoteGATTCharacteristic(ExecutionContext*, std::unique_pt r<WebBluetoothRemoteGATTCharacteristicInit>); 44 explicit BluetoothRemoteGATTCharacteristic(ExecutionContext*, PassOwnPtr<Web BluetoothRemoteGATTCharacteristicInit>);
44 45
45 // Interface required by CallbackPromiseAdapter. 46 // Interface required by CallbackPromiseAdapter.
46 using WebType = std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>; 47 using WebType = OwnPtr<WebBluetoothRemoteGATTCharacteristicInit>;
47 static BluetoothRemoteGATTCharacteristic* take(ScriptPromiseResolver*, std:: unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>); 48 static BluetoothRemoteGATTCharacteristic* take(ScriptPromiseResolver*, PassO wnPtr<WebBluetoothRemoteGATTCharacteristicInit>);
48 49
49 // Save value. 50 // Save value.
50 void setValue(DOMDataView*); 51 void setValue(DOMDataView*);
51 52
52 // WebBluetoothRemoteGATTCharacteristic interface: 53 // WebBluetoothRemoteGATTCharacteristic interface:
53 void dispatchCharacteristicValueChanged(const WebVector<uint8_t>&) override; 54 void dispatchCharacteristicValueChanged(const WebVector<uint8_t>&) override;
54 55
55 // ActiveDOMObject interface. 56 // ActiveDOMObject interface.
56 void stop() override; 57 void stop() override;
57 58
(...skipping 22 matching lines...) Expand all
80 ScriptPromise startNotifications(ScriptState*); 81 ScriptPromise startNotifications(ScriptState*);
81 ScriptPromise stopNotifications(ScriptState*); 82 ScriptPromise stopNotifications(ScriptState*);
82 83
83 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged);
84 85
85 protected: 86 protected:
86 // EventTarget overrides. 87 // EventTarget overrides.
87 void addedEventListener(const AtomicString& eventType, RegisteredEventListen er&) override; 88 void addedEventListener(const AtomicString& eventType, RegisteredEventListen er&) override;
88 89
89 private: 90 private:
90 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristi c; 91 OwnPtr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic;
91 bool m_stopped; 92 bool m_stopped;
92 Member<BluetoothCharacteristicProperties> m_properties; 93 Member<BluetoothCharacteristicProperties> m_properties;
93 Member<DOMDataView> m_value; 94 Member<DOMDataView> m_value;
94 }; 95 };
95 96
96 } // namespace blink 97 } // namespace blink
97 98
98 #endif // BluetoothRemoteGATTCharacteristic_h 99 #endif // BluetoothRemoteGATTCharacteristic_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698