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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 task_manager_ = | 351 task_manager_ = |
352 new BluetoothTaskManagerWin(ui_task_runner_); | 352 new BluetoothTaskManagerWin(ui_task_runner_); |
353 task_manager_->AddObserver(this); | 353 task_manager_->AddObserver(this); |
354 task_manager_->Initialize(); | 354 task_manager_->Initialize(); |
355 } | 355 } |
356 | 356 |
357 void BluetoothAdapterWin::InitForTest( | 357 void BluetoothAdapterWin::InitForTest( |
358 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 358 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
359 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner) { | 359 scoped_refptr<base::SequencedTaskRunner> bluetooth_task_runner) { |
360 ui_task_runner_ = ui_task_runner; | 360 ui_task_runner_ = ui_task_runner; |
361 if (ui_task_runner_ == nullptr) | 361 if (!ui_task_runner_) |
362 ui_task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 362 ui_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
363 task_manager_ = | 363 task_manager_ = |
364 new BluetoothTaskManagerWin(ui_task_runner_); | 364 new BluetoothTaskManagerWin(ui_task_runner_); |
365 task_manager_->AddObserver(this); | 365 task_manager_->AddObserver(this); |
366 task_manager_->InitializeWithBluetoothTaskRunner(bluetooth_task_runner); | 366 task_manager_->InitializeWithBluetoothTaskRunner(bluetooth_task_runner); |
367 } | 367 } |
368 | 368 |
369 void BluetoothAdapterWin::MaybePostStartDiscoveryTask() { | 369 void BluetoothAdapterWin::MaybePostStartDiscoveryTask() { |
370 if (discovery_status_ == NOT_DISCOVERING && | 370 if (discovery_status_ == NOT_DISCOVERING && |
371 !on_start_discovery_callbacks_.empty()) { | 371 !on_start_discovery_callbacks_.empty()) { |
(...skipping 16 matching lines...) Expand all Loading... |
388 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size(); | 388 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size(); |
389 on_stop_discovery_callbacks_.clear(); | 389 on_stop_discovery_callbacks_.clear(); |
390 return; | 390 return; |
391 } | 391 } |
392 | 392 |
393 discovery_status_ = DISCOVERY_STOPPING; | 393 discovery_status_ = DISCOVERY_STOPPING; |
394 task_manager_->PostStopDiscoveryTask(); | 394 task_manager_->PostStopDiscoveryTask(); |
395 } | 395 } |
396 | 396 |
397 } // namespace device | 397 } // namespace device |
OLD | NEW |