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

Side by Side Diff: device/bluetooth/bluetooth_task_manager_win.cc

Issue 11411130: Implemented BluetoothTaskManagerWin class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Replace naked MessageLoop pointer with SequencedTaskRunner refcounted pointer Created 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/bluetooth/bluetooth_task_manager_win.h"
6
7 #include "base/bind.h"
8 #include "base/message_loop.h"
9 #include "device/bluetooth/bluetooth_polling_thread_win.h"
10
11 namespace device {
12
13 BluetoothTaskManagerWin::BluetoothTaskManagerWin()
14 : ui_task_runner_(MessageLoop::current()->message_loop_proxy()),
15 ALLOW_THIS_IN_INITIALIZER_LIST(thread_(this)) {
16 }
17
18 BluetoothTaskManagerWin::~BluetoothTaskManagerWin() {
19 }
20
21 void BluetoothTaskManagerWin::AddObserver(Observer* observer) {
22 CHECK(observer);
23 observers_.AddObserver(observer);
24 }
25
26 void BluetoothTaskManagerWin::RemoveObserver(Observer* observer) {
27 CHECK(observer);
28 observers_.RemoveObserver(observer);
29 }
30
31 void BluetoothTaskManagerWin::StartThread() {
32 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
33 thread_.StartPolling();
34 }
35
36 void BluetoothTaskManagerWin::StopThread() {
37 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
38 thread_.Cancel();
39 }
40
41 void BluetoothTaskManagerWin::OnAdapterStateChanged(const AdapterState* state) {
42 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
43 FOR_EACH_OBSERVER(BluetoothTaskManagerWin::Observer, observers_,
44 AdapterStateChanged(*state));
45 }
46
47 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698