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

Unified Diff: device/bluetooth/bluetooth_adapter_mac.mm

Issue 1216583003: Adding Hashed Address to BluetoothLowEnergyDeviceMac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timeinfo
Patch Set: Created 5 years, 6 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
Index: device/bluetooth/bluetooth_adapter_mac.mm
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
index e9586ad42068d7a2bb0fb495fe32b6ce0738aaf3..e9b3c6e689ccd072516e119989abce109e637985 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
@@ -31,14 +31,13 @@ namespace {
// The frequency with which to poll the adapter for updates.
const int kPollIntervalMs = 500;
-// The length of time that must elapse since the last Inquiry response before a
-// discovered Classic device is considered to be no longer available.
-const NSTimeInterval kDiscoveryTimeoutSec = 3 * 60; // 3 minutes
-
} // namespace
namespace device {
+const NSTimeInterval BluetoothAdapterMac::kDiscoveryTimeoutSec =
+ 3 * 60; // 3 minutes
+
// static
base::WeakPtr<BluetoothAdapter> BluetoothAdapter::CreateAdapter(
const InitCallback& init_callback) {
@@ -296,7 +295,6 @@ void BluetoothAdapterMac::Init() {
void BluetoothAdapterMac::InitForTest(
scoped_refptr<base::SequencedTaskRunner> ui_task_runner) {
ui_task_runner_ = ui_task_runner;
- PollAdapter();
}
void BluetoothAdapterMac::PollAdapter() {
@@ -359,8 +357,15 @@ void BluetoothAdapterMac::PollAdapter() {
// is fixed.
tracked_objects::ScopedTracker tracking_profile5(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
- "461181 BluetoothAdapterMac::PollAdapter::UpdateDevices"));
- UpdateDevices();
+ "461181 BluetoothAdapterMac::PollAdapter::RemoveTimedOutDevices"));
+ RemoveTimedOutDevices();
+
+ // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/461181
+ // is fixed.
+ tracked_objects::ScopedTracker tracking_profile6(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461181 BluetoothAdapterMac::PollAdapter::AddPairedDevices"));
+ AddPairedDevices();
ui_task_runner_->PostDelayedTask(
FROM_HERE,
@@ -383,15 +388,14 @@ void BluetoothAdapterMac::ClassicDeviceAdded(IOBluetoothDevice* device) {
DeviceAdded(this, devices_[device_address]));
}
-// TODO(krstnmnlsn): This method to be implemented as soon as UpdateDevices can
-// handle instances of LowEnergyBluetoothDevice in |devices_|. crbug.com/498009
+// TODO(krstnmnlsn): Implement method.
scheib 2015/07/01 17:29:44 Have an issue number. The previous comment is prob
krstnmnlsn 2015/07/02 00:25:30 Sure. I removed the comment because as of this ch
void BluetoothAdapterMac::LowEnergyDeviceUpdated(
CBPeripheral* peripheral,
NSDictionary* advertisementData,
int rssi) {
}
-void BluetoothAdapterMac::UpdateDevices() {
+void BluetoothAdapterMac::RemoveTimedOutDevices() {
// Notify observers if any previously seen devices are no longer available,
// i.e. if they are no longer paired, connected, nor recently discovered via
// an inquiry.
@@ -417,7 +421,9 @@ void BluetoothAdapterMac::UpdateDevices() {
size_t num_removed = devices_.erase(device_address);
DCHECK_EQ(num_removed, 1U);
}
+}
+void BluetoothAdapterMac::AddPairedDevices() {
// Add any new paired devices.
for (IOBluetoothDevice* device in [IOBluetoothDevice pairedDevices]) {
ClassicDeviceAdded(device);

Powered by Google App Engine
This is Rietveld 408576698