Index: device/bluetooth/bluetooth_socket_thread.cc |
diff --git a/device/bluetooth/bluetooth_socket_thread.cc b/device/bluetooth/bluetooth_socket_thread.cc |
index 3f49d4156a9ef07feb787e9f9937cd3498788bf4..1f3b97bf98be34ca62c2f60911df727e5840b74f 100644 |
--- a/device/bluetooth/bluetooth_socket_thread.cc |
+++ b/device/bluetooth/bluetooth_socket_thread.cc |
@@ -21,10 +21,22 @@ scoped_refptr<BluetoothSocketThread> BluetoothSocketThread::Get() { |
return g_instance.Get(); |
} |
+// static |
+void BluetoothSocketThread::CleanupForTesting() { |
+ DCHECK(g_instance.Get()); |
+ g_instance.Get() = NULL; |
+} |
+ |
BluetoothSocketThread::BluetoothSocketThread() |
: active_socket_count_(0) {} |
-BluetoothSocketThread::~BluetoothSocketThread() {} |
+BluetoothSocketThread::~BluetoothSocketThread() { |
+ if (thread_) { |
+ thread_->Stop(); |
+ thread_.reset(NULL); |
+ task_runner_ = NULL; |
+ } |
+} |
void BluetoothSocketThread::OnSocketActivate() { |
DCHECK(thread_checker_.CalledOnValidThread()); |