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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp

Issue 1945823003: bluetooth: Remove BluetoothAdvertisementData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Remove fake adapters Created 4 years, 7 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 #include "modules/bluetooth/BluetoothDevice.h" 5 #include "modules/bluetooth/BluetoothDevice.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
11 #include "core/events/Event.h" 11 #include "core/events/Event.h"
12 #include "modules/bluetooth/BluetoothError.h" 12 #include "modules/bluetooth/BluetoothError.h"
13 #include "modules/bluetooth/BluetoothRemoteGATTServer.h" 13 #include "modules/bluetooth/BluetoothRemoteGATTServer.h"
14 #include "modules/bluetooth/BluetoothSupplement.h" 14 #include "modules/bluetooth/BluetoothSupplement.h"
15 #include "public/platform/modules/bluetooth/WebBluetooth.h" 15 #include "public/platform/modules/bluetooth/WebBluetooth.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 BluetoothDevice::BluetoothDevice(ExecutionContext* context, PassOwnPtr<WebBlueto othDevice> webDevice) 19 BluetoothDevice::BluetoothDevice(ExecutionContext* context, PassOwnPtr<WebBlueto othDevice> webDevice)
20 : ActiveDOMObject(context) 20 : ActiveDOMObject(context)
21 , m_webDevice(std::move(webDevice)) 21 , m_webDevice(std::move(webDevice))
22 , m_adData(BluetoothAdvertisingData::create(m_webDevice->txPower, m_webDevic e->rssi))
23 , m_gatt(BluetoothRemoteGATTServer::create(this)) 22 , m_gatt(BluetoothRemoteGATTServer::create(this))
24 { 23 {
25 // See example in Source/platform/heap/ThreadState.h 24 // See example in Source/platform/heap/ThreadState.h
26 ThreadState::current()->registerPreFinalizer(this); 25 ThreadState::current()->registerPreFinalizer(this);
27 } 26 }
28 27
29 BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver* resolver, PassOwnP tr<WebBluetoothDevice> webDevice) 28 BluetoothDevice* BluetoothDevice::take(ScriptPromiseResolver* resolver, PassOwnP tr<WebBluetoothDevice> webDevice)
30 { 29 {
31 ASSERT(webDevice); 30 ASSERT(webDevice);
32 BluetoothDevice* device = new BluetoothDevice(resolver->getExecutionContext( ), std::move(webDevice)); 31 BluetoothDevice* device = new BluetoothDevice(resolver->getExecutionContext( ), std::move(webDevice));
(...skipping 28 matching lines...) Expand all
61 60
62 ExecutionContext* BluetoothDevice::getExecutionContext() const 61 ExecutionContext* BluetoothDevice::getExecutionContext() const
63 { 62 {
64 return ActiveDOMObject::getExecutionContext(); 63 return ActiveDOMObject::getExecutionContext();
65 } 64 }
66 65
67 DEFINE_TRACE(BluetoothDevice) 66 DEFINE_TRACE(BluetoothDevice)
68 { 67 {
69 EventTargetWithInlineData::trace(visitor); 68 EventTargetWithInlineData::trace(visitor);
70 ActiveDOMObject::trace(visitor); 69 ActiveDOMObject::trace(visitor);
71 visitor->trace(m_adData);
72 visitor->trace(m_gatt); 70 visitor->trace(m_gatt);
73 } 71 }
74 72
75 Vector<String> BluetoothDevice::uuids() 73 Vector<String> BluetoothDevice::uuids()
76 { 74 {
77 Vector<String> uuids(m_webDevice->uuids.size()); 75 Vector<String> uuids(m_webDevice->uuids.size());
78 for (size_t i = 0; i < m_webDevice->uuids.size(); ++i) 76 for (size_t i = 0; i < m_webDevice->uuids.size(); ++i)
79 uuids[i] = m_webDevice->uuids[i]; 77 uuids[i] = m_webDevice->uuids[i];
80 return uuids; 78 return uuids;
81 } 79 }
82 80
83 ScriptPromise BluetoothDevice::connectGATT(ScriptState* scriptState) 81 ScriptPromise BluetoothDevice::connectGATT(ScriptState* scriptState)
84 { 82 {
85 return m_gatt->connect(scriptState); 83 return m_gatt->connect(scriptState);
86 } 84 }
87 85
88 } // namespace blink 86 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698