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

Unified Diff: device/bluetooth/bluetooth_adapter_win.h

Issue 11411130: Implemented BluetoothTaskManagerWin class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed unnecessary lines. 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_adapter_win.h
diff --git a/device/bluetooth/bluetooth_adapter_win.h b/device/bluetooth/bluetooth_adapter_win.h
index 0cad233abad3ad9484f822705659f0329f10d531..f8cfef9f072bc1da517bb1091acad68df0aa5100 100644
--- a/device/bluetooth/bluetooth_adapter_win.h
+++ b/device/bluetooth/bluetooth_adapter_win.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "device/bluetooth/bluetooth_adapter.h"
@@ -15,6 +16,7 @@ namespace device {
class BluetoothAdapterFactory;
class BluetoothAdapterWinTest;
class BluetoothDevice;
+class BluetoothManagerWin;
class BluetoothAdapterWin : public BluetoothAdapter {
public:
@@ -40,26 +42,34 @@ class BluetoothAdapterWin : public BluetoothAdapter {
const BluetoothOutOfBandPairingDataCallback& callback,
const ErrorCallback& error_callback) OVERRIDE;
+ // Called by BluetoothManagerWin thread to return the adapter_handle.
+ void OnAdapterHandleAvailable(HANDLE adapter_handle);
+
+ void SetBluetoothManagerForTest(BluetoothManagerWin* manager);
+
protected:
BluetoothAdapterWin();
virtual ~BluetoothAdapterWin();
- virtual void UpdateAdapterState();
+ virtual void UpdateAdapterState(HANDLE adapter_handle);
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 BluetoothManagerWin thread to obtain the default adapter info.
void TrackDefaultAdapter();
- void PollAdapterState();
-
static const int kPollIntervalMs;
bool powered_;
+ // Holding scoped_ptr guarantees that BluetoothAdapterWin will always outlive
+ // BluetoothManagerWin thread.
+ scoped_ptr<BluetoothManagerWin> manager_;
+
+ HANDLE adapter_handle_;
+
// NOTE: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698