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

Unified Diff: device/bluetooth/bluetooth_device_mac.mm

Issue 229463003: MacOS implementation of BluetoothSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build error on OSX SDK < 10.7. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.h ('k') | device/bluetooth/bluetooth_profile_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device_mac.mm
diff --git a/device/bluetooth/bluetooth_device_mac.mm b/device/bluetooth/bluetooth_device_mac.mm
index bd25449abb50d436fd9188d055d42694ab6ffb1e..bd54495fcf9a82f5279c98f99cfd43fb8b912942 100644
--- a/device/bluetooth/bluetooth_device_mac.mm
+++ b/device/bluetooth/bluetooth_device_mac.mm
@@ -13,6 +13,7 @@
#include "base/basictypes.h"
#include "base/hash.h"
+#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
@@ -36,8 +37,6 @@
namespace {
-const char kFailedToConnect[] = "Connection failed";
-
// Converts |uuid| to a IOBluetoothSDPUUID instance.
//
// |uuid| must be in the format of XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
@@ -64,9 +63,12 @@ IOBluetoothSDPUUID* GetIOBluetoothSDPUUID(const std::string& uuid) {
namespace device {
-BluetoothDeviceMac::BluetoothDeviceMac(IOBluetoothDevice* device)
- : BluetoothDevice(), device_([device retain]) {
-}
+BluetoothDeviceMac::BluetoothDeviceMac(
+ const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
+ IOBluetoothDevice* device)
+ : BluetoothDevice(),
+ ui_task_runner_(ui_task_runner),
+ device_([device retain]) {}
BluetoothDeviceMac::~BluetoothDeviceMac() {
[device_ release];
@@ -199,9 +201,8 @@ void BluetoothDeviceMac::ConnectToService(
[device_ getServiceRecordForUUID:GetIOBluetoothSDPUUID(
service_uuid.canonical_value())];
if (record != nil) {
- BluetoothServiceRecordMac service_record(record);
scoped_refptr<BluetoothSocket> socket(
- BluetoothSocketMac::CreateBluetoothSocket(service_record));
+ BluetoothSocketMac::CreateBluetoothSocket(ui_task_runner_, record));
if (socket.get() != NULL)
callback.Run(socket);
}
@@ -211,10 +212,9 @@ void BluetoothDeviceMac::ConnectToProfile(
BluetoothProfile* profile,
const base::Closure& callback,
const ConnectToProfileErrorCallback& error_callback) {
- if (static_cast<BluetoothProfileMac*>(profile)->Connect(device_))
- callback.Run();
- else
- error_callback.Run(kFailedToConnect);
+ DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
+ static_cast<BluetoothProfileMac*>(profile)
+ ->Connect(ui_task_runner_, device_, callback, error_callback);
}
void BluetoothDeviceMac::SetOutOfBandPairingData(
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.h ('k') | device/bluetooth/bluetooth_profile_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698