| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_win.h" | 5 #include "device/bluetooth/bluetooth_adapter_win.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 task_manager_ = | 339 task_manager_ = |
| 340 new BluetoothTaskManagerWin(ui_task_runner_); | 340 new BluetoothTaskManagerWin(ui_task_runner_); |
| 341 task_manager_->AddObserver(this); | 341 task_manager_->AddObserver(this); |
| 342 task_manager_->Initialize(); | 342 task_manager_->Initialize(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 void BluetoothAdapterWin::InitForTest( | 345 void BluetoothAdapterWin::InitForTest( |
| 346 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 346 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| 347 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner) { | 347 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner) { |
| 348 ui_task_runner_ = ui_task_runner; | 348 ui_task_runner_ = ui_task_runner; |
| 349 if (ui_task_runner_ == nullptr) |
| 350 ui_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
| 349 task_manager_ = | 351 task_manager_ = |
| 350 new BluetoothTaskManagerWin(ui_task_runner_); | 352 new BluetoothTaskManagerWin(ui_task_runner_); |
| 351 task_manager_->AddObserver(this); | 353 task_manager_->AddObserver(this); |
| 352 task_manager_->InitializeWithBluetoothTaskRunner(bluetooth_task_runner); | 354 task_manager_->InitializeWithBluetoothTaskRunner(bluetooth_task_runner); |
| 353 } | 355 } |
| 354 | 356 |
| 355 void BluetoothAdapterWin::MaybePostStartDiscoveryTask() { | 357 void BluetoothAdapterWin::MaybePostStartDiscoveryTask() { |
| 356 if (discovery_status_ == NOT_DISCOVERING && | 358 if (discovery_status_ == NOT_DISCOVERING && |
| 357 !on_start_discovery_callbacks_.empty()) { | 359 !on_start_discovery_callbacks_.empty()) { |
| 358 discovery_status_ = DISCOVERY_STARTING; | 360 discovery_status_ = DISCOVERY_STARTING; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 374 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size(); | 376 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size(); |
| 375 on_stop_discovery_callbacks_.clear(); | 377 on_stop_discovery_callbacks_.clear(); |
| 376 return; | 378 return; |
| 377 } | 379 } |
| 378 | 380 |
| 379 discovery_status_ = DISCOVERY_STOPPING; | 381 discovery_status_ = DISCOVERY_STOPPING; |
| 380 task_manager_->PostStopDiscoveryTask(); | 382 task_manager_->PostStopDiscoveryTask(); |
| 381 } | 383 } |
| 382 | 384 |
| 383 } // namespace device | 385 } // namespace device |
| OLD | NEW |