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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_task_manager_win.cc
diff --git a/device/bluetooth/bluetooth_task_manager_win.cc b/device/bluetooth/bluetooth_task_manager_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6cc51de197d279e87509666addbc4609441f9083
--- /dev/null
+++ b/device/bluetooth/bluetooth_task_manager_win.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "device/bluetooth/bluetooth_task_manager_win.h"
+
+#include "base/bind.h"
+#include "base/message_loop.h"
+#include "device/bluetooth/bluetooth_polling_thread_win.h"
+
+namespace device {
+
+BluetoothTaskManagerWin::BluetoothTaskManagerWin()
+ : ui_task_runner_(MessageLoop::current()->message_loop_proxy()),
+ ALLOW_THIS_IN_INITIALIZER_LIST(thread_(this)) {
+}
+
+BluetoothTaskManagerWin::~BluetoothTaskManagerWin() {
+}
+
+void BluetoothTaskManagerWin::AddObserver(Observer* observer) {
+ CHECK(observer);
+ observers_.AddObserver(observer);
+}
+
+void BluetoothTaskManagerWin::RemoveObserver(Observer* observer) {
+ CHECK(observer);
+ observers_.RemoveObserver(observer);
+}
+
+void BluetoothTaskManagerWin::StartThread() {
+ DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
+ thread_.StartPolling();
+}
+
+void BluetoothTaskManagerWin::StopThread() {
+ DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
+ thread_.Cancel();
+}
+
+void BluetoothTaskManagerWin::OnAdapterStateChanged(const AdapterState* state) {
+ DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
+ FOR_EACH_OBSERVER(BluetoothTaskManagerWin::Observer, observers_,
+ AdapterStateChanged(*state));
+}
+
+} // namespace device

Powered by Google App Engine
This is Rietveld 408576698