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

Unified Diff: device/bluetooth/bluetooth_polling_thread_win.h

Issue 11411130: Implemented BluetoothTaskManagerWin class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added BluetoothTaskManagerWin class Created 8 years, 1 month 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_polling_thread_win.h
diff --git a/device/bluetooth/bluetooth_polling_thread_win.h b/device/bluetooth/bluetooth_polling_thread_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..c853dc3be6ea99986445c2c0990792efd5ab8a75
--- /dev/null
+++ b/device/bluetooth/bluetooth_polling_thread_win.h
@@ -0,0 +1,46 @@
+// 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.
+
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_POLLING_THREAD_WIN_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_POLLING_THREAD_WIN_H_
+
+#include "base/synchronization/cancellation_flag.h"
+#include "base/threading/thread.h"
+
+namespace device {
+
+class BluetoothTaskManagerWin;
+
+// A thread dedicated to perform blocking bluetooth APIs on Windows.
+// Other than constructor, destructor, and Cancel(), all else in this class
+// should run on its own thread.
bryeung 2012/12/10 19:51:28 would be nice to specify here (and on the methods
youngki 2012/12/17 17:17:23 Done.
+class BluetoothPollingThreadWin : public base::Thread {
+ public:
+ BluetoothPollingThreadWin(BluetoothTaskManagerWin* task_manager);
+ virtual ~BluetoothPollingThreadWin();
+
+ void Cancel();
+
+ private:
+ friend class BluetoothTaskManagerWin;
+
+ // Called periodically to get the latest state of the Bluetooth Adapter from
+ // the Windows APIs. Posts another call to PollAdapter unless
+ // |cancellation_flag_| is set.
+ void PollAdapter();
+
+ static const int kPollIntervalMs;
+
+ // The task manager owning this thread. It is guaranteed to outlive this
+ // object.
+ BluetoothTaskManagerWin* task_manager_;
+
+ base::CancellationFlag cancellation_flag_;
+
+ DISALLOW_COPY_AND_ASSIGN(BluetoothPollingThreadWin);
+};
+
+} // namespace device
+
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_POLLING_THREAD_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698