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

Side by Side Diff: Source/modules/bluetooth/BluetoothDevice.h

Issue 1148283009: bluetooth: Remove deep copying of structs by using OwnPtr. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@bluetooth-get-primary-service-implementation
Patch Set: Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 BluetoothDevice_h 5 #ifndef BluetoothDevice_h
6 #define BluetoothDevice_h 6 #define BluetoothDevice_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "platform/heap/Heap.h" 9 #include "platform/heap/Heap.h"
10 #include "public/platform/modules/bluetooth/WebBluetoothDevice.h" 10 #include "public/platform/modules/bluetooth/WebBluetoothDevice.h"
11 #include "wtf/text/WTFString.h" 11 #include "wtf/text/WTFString.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class ScriptPromise; 15 class ScriptPromise;
16 class ScriptPromiseResolver; 16 class ScriptPromiseResolver;
17 class ScriptState; 17 class ScriptState;
18 18
19 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL. 19 // BluetoothDevice represents a physical bluetooth device in the DOM. See IDL.
20 // 20 //
21 // Callbacks providing WebBluetoothDevice objects are handled by 21 // Callbacks providing WebBluetoothDevice objects are handled by
22 // CallbackPromiseAdapter templatized with this class. See this class's 22 // CallbackPromiseAdapter templatized with this class. See this class's
23 // "Interface required by CallbackPromiseAdapter" section and the 23 // "Interface required by CallbackPromiseAdapter" section and the
24 // CallbackPromiseAdapter class comments. 24 // CallbackPromiseAdapter class comments.
25 class BluetoothDevice final 25 class BluetoothDevice final
26 : public GarbageCollectedFinalized<BluetoothDevice> 26 : public GarbageCollectedFinalized<BluetoothDevice>
27 , public ScriptWrappable { 27 , public ScriptWrappable {
28 DEFINE_WRAPPERTYPEINFO(); 28 DEFINE_WRAPPERTYPEINFO();
29 public: 29 public:
30 BluetoothDevice(const WebBluetoothDevice&); 30 BluetoothDevice(PassOwnPtr<WebBluetoothDevice>);
haraken 2015/06/04 00:40:16 Add explicit.
31
32 static BluetoothDevice* create(const WebBluetoothDevice&);
33 31
34 ScriptPromise connectGATT(ScriptState*); 32 ScriptPromise connectGATT(ScriptState*);
35 33
36 // Interface required by CallbackPromiseAdapter: 34 // Interface required by CallbackPromiseAdapter:
37 typedef WebBluetoothDevice WebType; 35 typedef WebBluetoothDevice WebType;
38 static BluetoothDevice* take(ScriptPromiseResolver*, WebBluetoothDevice*); 36 static BluetoothDevice* take(ScriptPromiseResolver*, WebBluetoothDevice*);
39 static void dispose(WebBluetoothDevice*); 37 static void dispose(WebBluetoothDevice*);
40 38
41 // Interface required by Garbage Collection: 39 // Interface required by Garbage Collection:
42 DEFINE_INLINE_TRACE() { } 40 DEFINE_INLINE_TRACE() { }
43 41
44 // IDL exposed interface: 42 // IDL exposed interface:
45 String instanceID() { return m_webDevice.instanceID; } 43 String instanceID() { return m_webDevice->instanceID; }
46 String name() { return m_webDevice.name; } 44 String name() { return m_webDevice->name; }
47 unsigned deviceClass(bool& isNull); 45 unsigned deviceClass(bool& isNull);
48 String vendorIDSource(); 46 String vendorIDSource();
49 unsigned vendorID(bool& isNull); 47 unsigned vendorID(bool& isNull);
50 unsigned productID(bool& isNull); 48 unsigned productID(bool& isNull);
51 unsigned productVersion(bool& isNull); 49 unsigned productVersion(bool& isNull);
52 bool paired(); 50 bool paired();
53 Vector<String> uuids(); 51 Vector<String> uuids();
54 52
55 private: 53 private:
56 WebBluetoothDevice m_webDevice; 54 OwnPtr<WebBluetoothDevice> m_webDevice;
57 }; 55 };
58 56
59 } // namespace blink 57 } // namespace blink
60 58
61 #endif // BluetoothDevice_h 59 #endif // BluetoothDevice_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/bluetooth/BluetoothDevice.cpp » ('j') | Source/modules/bluetooth/BluetoothDevice.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698