Index: device/bluetooth/bluetooth_adapter_win.h |
diff --git a/device/bluetooth/bluetooth_adapter_win.h b/device/bluetooth/bluetooth_adapter_win.h |
index 0cad233abad3ad9484f822705659f0329f10d531..d7611af3cc2a7431e7a6f29b683d6bebfaed76be 100644 |
--- a/device/bluetooth/bluetooth_adapter_win.h |
+++ b/device/bluetooth/bluetooth_adapter_win.h |
@@ -7,8 +7,17 @@ |
#include <string> |
+#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/threading/thread_checker.h" |
#include "device/bluetooth/bluetooth_adapter.h" |
+#include "device/bluetooth/bluetooth_polling_thread_win.h" |
+ |
+namespace base { |
+ |
+class ThreadChecker; |
bryeung
2012/11/28 16:26:08
no longer necessary now that you have the header i
youngki
2012/11/28 19:19:13
Done.
|
+ |
+} // namespace base |
namespace device { |
@@ -16,7 +25,8 @@ class BluetoothAdapterFactory; |
class BluetoothAdapterWinTest; |
class BluetoothDevice; |
-class BluetoothAdapterWin : public BluetoothAdapter { |
+class BluetoothAdapterWin : public BluetoothAdapter, |
+ private BluetoothPollingThreadWin::Observer { |
public: |
// BluetoothAdapter override |
virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
@@ -40,25 +50,30 @@ class BluetoothAdapterWin : public BluetoothAdapter { |
const BluetoothOutOfBandPairingDataCallback& callback, |
const ErrorCallback& error_callback) OVERRIDE; |
+ void SetBluetoothPollingThreadForTest(BluetoothPollingThreadWin* manager); |
+ |
protected: |
BluetoothAdapterWin(); |
virtual ~BluetoothAdapterWin(); |
- virtual void UpdateAdapterState(); |
- |
private: |
friend class BluetoothAdapterFactory; |
friend class BluetoothAdapterWinTest; |
- // Obtains the default adapter info (the first bluetooth radio info found on |
- // the system) and tracks future changes to it. |
+ // BluetoothPollingThreadWin::Observer override |
+ virtual void AdapterStateChanged( |
+ const BluetoothPollingThreadWin::AdapterState& state) OVERRIDE; |
+ |
+ // Starts BluetoothPollingThreadWin thread to obtain the default adapter info. |
void TrackDefaultAdapter(); |
- void PollAdapterState(); |
+ bool powered_; |
- static const int kPollIntervalMs; |
+ // Holding scoped_ptr guarantees that BluetoothAdapterWin will always outlive |
+ // BluetoothPollingThreadWin thread. |
+ scoped_ptr<BluetoothPollingThreadWin> thread_; |
bryeung
2012/11/28 16:26:08
it occurs to me that you could get an equivalently
youngki
2012/11/28 19:19:13
My only concern is testing; I was going to replace
|
- bool powered_; |
+ base::ThreadChecker thread_checker_; |
// NOTE: This should remain the last member so it'll be destroyed and |
// invalidate its weak pointers before any other members are destroyed. |