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

Side by Side 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: Implemented Unittests 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 #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 BluetoothPollingThreadWinTest;
14 class BluetoothTaskManagerWin;
15
16 // A thread dedicated to perform blocking bluetooth APIs on Windows.
17 // Other than constructor, destructor, StartPolling(), and Cancel(), all else in
18 // this class should run on its own thread.
19 // The constructor, destructor, StartPolling(), and Cancel() MUST be run from
20 // the |task_manager_|'s message loop.
21 class BluetoothPollingThreadWin : public base::Thread {
22 public:
23 BluetoothPollingThreadWin(BluetoothTaskManagerWin* task_manager);
24 virtual ~BluetoothPollingThreadWin();
25
26 void StartPolling();
27 void Cancel();
28
29 private:
30 friend class BluetoothPollingThreadWinTest;
31 friend class BluetoothTaskManagerWin;
32
33 // Called periodically to get the latest state of the Bluetooth Adapter from
34 // the Windows APIs. Posts another call to PollAdapter unless
35 // |cancellation_flag_| is set.
36 void PollAdapter();
37
38 static const int kPollIntervalMs;
39
40 // The task manager owning this thread. It is guaranteed to outlive this
41 // object.
42 BluetoothTaskManagerWin* task_manager_;
43
44 base::CancellationFlag cancellation_flag_;
45
46 DISALLOW_COPY_AND_ASSIGN(BluetoothPollingThreadWin);
47 };
48
49 } // namespace device
50
51 #endif // DEVICE_BLUETOOTH_BLUETOOTH_POLLING_THREAD_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698