| OLD | NEW |
| 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 <memory> |
| 8 #include <utility> |
| 9 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 10 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 11 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 12 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/DOMException.h" | 13 #include "core/dom/DOMException.h" |
| 11 #include "core/events/Event.h" | 14 #include "core/events/Event.h" |
| 15 #include "core/frame/UseCounter.h" |
| 12 #include "modules/bluetooth/Bluetooth.h" | 16 #include "modules/bluetooth/Bluetooth.h" |
| 13 #include "modules/bluetooth/BluetoothAttributeInstanceMap.h" | 17 #include "modules/bluetooth/BluetoothAttributeInstanceMap.h" |
| 14 #include "modules/bluetooth/BluetoothError.h" | 18 #include "modules/bluetooth/BluetoothError.h" |
| 15 #include "modules/bluetooth/BluetoothRemoteGATTServer.h" | 19 #include "modules/bluetooth/BluetoothRemoteGATTServer.h" |
| 16 #include <memory> | |
| 17 #include <utility> | |
| 18 | 20 |
| 19 namespace blink { | 21 namespace blink { |
| 20 | 22 |
| 21 BluetoothDevice::BluetoothDevice(ExecutionContext* context, | 23 BluetoothDevice::BluetoothDevice(ExecutionContext* context, |
| 22 mojom::blink::WebBluetoothDevicePtr device, | 24 mojom::blink::WebBluetoothDevicePtr device, |
| 23 Bluetooth* bluetooth) | 25 Bluetooth* bluetooth) |
| 24 : ContextLifecycleObserver(context), | 26 : ContextLifecycleObserver(context), |
| 25 attribute_instance_map_(new BluetoothAttributeInstanceMap(this)), | 27 attribute_instance_map_(new BluetoothAttributeInstanceMap(this)), |
| 26 device_(std::move(device)), | 28 device_(std::move(device)), |
| 27 gatt_(BluetoothRemoteGATTServer::Create(context, this)), | 29 gatt_(BluetoothRemoteGATTServer::Create(context, this)), |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 91 } |
| 90 | 92 |
| 91 DEFINE_TRACE(BluetoothDevice) { | 93 DEFINE_TRACE(BluetoothDevice) { |
| 92 visitor->Trace(attribute_instance_map_); | 94 visitor->Trace(attribute_instance_map_); |
| 93 visitor->Trace(gatt_); | 95 visitor->Trace(gatt_); |
| 94 visitor->Trace(bluetooth_); | 96 visitor->Trace(bluetooth_); |
| 95 EventTargetWithInlineData::Trace(visitor); | 97 EventTargetWithInlineData::Trace(visitor); |
| 96 ContextLifecycleObserver::Trace(visitor); | 98 ContextLifecycleObserver::Trace(visitor); |
| 97 } | 99 } |
| 98 | 100 |
| 101 void BluetoothDevice::AddedEventListener( |
| 102 const AtomicString& event_type, |
| 103 RegisteredEventListener& registered_listener) { |
| 104 EventTargetWithInlineData::AddedEventListener(event_type, |
| 105 registered_listener); |
| 106 if (event_type == EventTypeNames::gattserverdisconnected) { |
| 107 UseCounter::Count(GetExecutionContext(), |
| 108 UseCounter::kGATTServerDisconnectedEvent); |
| 109 } |
| 110 } |
| 111 |
| 99 } // namespace blink | 112 } // namespace blink |
| OLD | NEW |