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

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

Issue 2718583002: Refactor WebBluetoothServiceClient in the web_bluetooth.mojom (Closed)
Patch Set: fix content unit tests 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 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"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 77
78 void BluetoothDevice::dispose() { 78 void BluetoothDevice::dispose() {
79 disconnectGATTIfConnected(); 79 disconnectGATTIfConnected();
80 } 80 }
81 81
82 void BluetoothDevice::contextDestroyed(ExecutionContext*) { 82 void BluetoothDevice::contextDestroyed(ExecutionContext*) {
83 disconnectGATTIfConnected(); 83 disconnectGATTIfConnected();
84 } 84 }
85 85
86 void BluetoothDevice::disconnectGATTIfConnected() { 86 void BluetoothDevice::disconnectGATTIfConnected() {
ortuno 2017/02/24 03:28:52 Would it make sense to move disconnectGATTIfConnec
juncai 2017/03/01 02:04:12 Done.
87 if (m_gatt->connected()) { 87 if (m_gatt->connected()) {
88 m_gatt->setConnected(false); 88 m_gatt->setConnected(false);
89 m_gatt->ClearActiveAlgorithms(); 89 m_gatt->ClearActiveAlgorithms();
90 m_bluetooth->removeFromConnectedDevicesMap(id());
91 mojom::blink::WebBluetoothService* service = m_bluetooth->service(); 90 mojom::blink::WebBluetoothService* service = m_bluetooth->service();
92 service->RemoteServerDisconnect(id()); 91 service->RemoteServerDisconnect(id());
93 } 92 }
94 } 93 }
95 94
96 void BluetoothDevice::cleanupDisconnectedDeviceAndFireEvent() { 95 void BluetoothDevice::cleanupDisconnectedDeviceAndFireEvent() {
97 DCHECK(m_gatt->connected()); 96 DCHECK(m_gatt->connected());
98 m_gatt->setConnected(false); 97 m_gatt->setConnected(false);
99 m_gatt->ClearActiveAlgorithms(); 98 m_gatt->ClearActiveAlgorithms();
100 m_attributeInstanceMap->Clear(); 99 m_attributeInstanceMap->Clear();
(...skipping 17 matching lines...) Expand all
118 117
119 DEFINE_TRACE(BluetoothDevice) { 118 DEFINE_TRACE(BluetoothDevice) {
120 visitor->trace(m_attributeInstanceMap); 119 visitor->trace(m_attributeInstanceMap);
121 visitor->trace(m_gatt); 120 visitor->trace(m_gatt);
122 visitor->trace(m_bluetooth); 121 visitor->trace(m_bluetooth);
123 EventTargetWithInlineData::trace(visitor); 122 EventTargetWithInlineData::trace(visitor);
124 ContextLifecycleObserver::trace(visitor); 123 ContextLifecycleObserver::trace(visitor);
125 } 124 }
126 125
127 } // namespace blink 126 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698