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..8fa94abaf18120c4a52ac6f1d18454f144a924eb 100644 |
--- a/device/bluetooth/bluetooth_adapter_win.h |
+++ b/device/bluetooth/bluetooth_adapter_win.h |
@@ -7,8 +7,16 @@ |
#include <string> |
+#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
#include "device/bluetooth/bluetooth_adapter.h" |
+#include "device/bluetooth/bluetooth_polling_thread_win.h" |
+ |
+namespace base { |
+ |
+class ThreadChecker; |
+ |
+} // namespace base |
namespace device { |
@@ -16,7 +24,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 +49,30 @@ class BluetoothAdapterWin : public BluetoothAdapter { |
const BluetoothOutOfBandPairingDataCallback& callback, |
const ErrorCallback& error_callback) OVERRIDE; |
+ // BluetoothPollingThreadWin override |
bryeung
2012/11/27 20:37:04
you probably mean ::Observer here
Also, should th
youngki
2012/11/27 21:43:34
Done.
|
+ virtual void AdapterStateChanged( |
+ const BluetoothPollingThreadWin::AdapterState& state) 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. |
+ // 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_; |
- bool powered_; |
+ scoped_ptr<base::ThreadChecker> thread_checker_; |
bryeung
2012/11/27 20:37:04
why is this a pointer?
youngki
2012/11/27 21:43:34
Because I want to forward-declare it instead of in
bryeung
2012/11/28 13:41:11
I think you are misinterpreting that section of th
youngki
2012/11/28 15:04:39
Done.
|
// NOTE: This should remain the last member so it'll be destroyed and |
// invalidate its weak pointers before any other members are destroyed. |