OLD | NEW |
---|---|
(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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_POLLING_THREAD_WIN_H_ | |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_POLLING_THREAD_WIN_H_ | |
7 | |
8 #include "base/synchronization/cancellation_flag.h" | |
9 #include "base/threading/thread.h" | |
10 | |
11 namespace device { | |
12 | |
13 class BluetoothTaskManagerWin; | |
14 | |
15 // A thread dedicated to perform blocking bluetooth APIs on Windows. | |
16 // Other than constructor, destructor, and Cancel(), all else in this class | |
17 // 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.
| |
18 class BluetoothPollingThreadWin : public base::Thread { | |
19 public: | |
20 BluetoothPollingThreadWin(BluetoothTaskManagerWin* task_manager); | |
21 virtual ~BluetoothPollingThreadWin(); | |
22 | |
23 void Cancel(); | |
24 | |
25 private: | |
26 friend class BluetoothTaskManagerWin; | |
27 | |
28 // Called periodically to get the latest state of the Bluetooth Adapter from | |
29 // the Windows APIs. Posts another call to PollAdapter unless | |
30 // |cancellation_flag_| is set. | |
31 void PollAdapter(); | |
32 | |
33 static const int kPollIntervalMs; | |
34 | |
35 // The task manager owning this thread. It is guaranteed to outlive this | |
36 // object. | |
37 BluetoothTaskManagerWin* task_manager_; | |
38 | |
39 base::CancellationFlag cancellation_flag_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(BluetoothPollingThreadWin); | |
42 }; | |
43 | |
44 } // namespace device | |
45 | |
46 #endif // DEVICE_BLUETOOTH_BLUETOOTH_POLLING_THREAD_WIN_H_ | |
OLD | NEW |