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

Side by Side Diff: device/bluetooth/bluetooth_adapter_mac.mm

Issue 812673002: bluetooth: BluetoothAdapterDeleter used to control BluetoothAdapter destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 6 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "device/bluetooth/bluetooth_adapter_mac.h" 5 #include "device/bluetooth/bluetooth_adapter_mac.h"
6 6
7 #import <IOBluetooth/objc/IOBluetoothDevice.h> 7 #import <IOBluetooth/objc/IOBluetoothDevice.h>
8 #import <IOBluetooth/objc/IOBluetoothHostController.h> 8 #import <IOBluetooth/objc/IOBluetoothHostController.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 158
159 void BluetoothAdapterMac::DeviceConnected(IOBluetoothDevice* device) { 159 void BluetoothAdapterMac::DeviceConnected(IOBluetoothDevice* device) {
160 // TODO(isherman): Investigate whether this method can be replaced with a call 160 // TODO(isherman): Investigate whether this method can be replaced with a call
161 // to +registerForConnectNotifications:selector:. 161 // to +registerForConnectNotifications:selector:.
162 DVLOG(1) << "Adapter registered a new connection from device with address: " 162 DVLOG(1) << "Adapter registered a new connection from device with address: "
163 << BluetoothDeviceMac::GetDeviceAddress(device); 163 << BluetoothDeviceMac::GetDeviceAddress(device);
164 DeviceAdded(device); 164 DeviceAdded(device);
165 } 165 }
166 166
167 void BluetoothAdapterMac::DeleteOnCorrectThread() const {
168 if (!ui_task_runner_->DeleteSoon(FROM_HERE, this))
169 delete this;
170 }
171
167 void BluetoothAdapterMac::AddDiscoverySession( 172 void BluetoothAdapterMac::AddDiscoverySession(
168 const base::Closure& callback, 173 const base::Closure& callback,
169 const ErrorCallback& error_callback) { 174 const ErrorCallback& error_callback) {
170 DVLOG(1) << __func__; 175 DVLOG(1) << __func__;
171 if (num_discovery_sessions_ > 0) { 176 if (num_discovery_sessions_ > 0) {
172 DCHECK(IsDiscovering()); 177 DCHECK(IsDiscovering());
173 num_discovery_sessions_++; 178 num_discovery_sessions_++;
174 callback.Run(); 179 callback.Run();
175 return; 180 return;
176 } 181 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 DCHECK_EQ(num_removed, 1U); 319 DCHECK_EQ(num_removed, 1U);
315 } 320 }
316 321
317 // Add any new paired devices. 322 // Add any new paired devices.
318 for (IOBluetoothDevice* device in [IOBluetoothDevice pairedDevices]) { 323 for (IOBluetoothDevice* device in [IOBluetoothDevice pairedDevices]) {
319 DeviceAdded(device); 324 DeviceAdded(device);
320 } 325 }
321 } 326 }
322 327
323 } // namespace device 328 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698