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

Side by Side Diff: device/bluetooth/bluetooth_adapter_factory.cc

Issue 848613003: bluetooth: Shutdown BluetoothAdapter before DBus on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 5 years, 11 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_adapter_factory.h" 5 #include "device/bluetooth/bluetooth_adapter_factory.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 DCHECK(default_adapter.Get()->IsInitialized()); 89 DCHECK(default_adapter.Get()->IsInitialized());
90 #endif // defined(OS_WIN) 90 #endif // defined(OS_WIN)
91 91
92 if (default_adapter.Get()->IsInitialized()) 92 if (default_adapter.Get()->IsInitialized())
93 callback.Run(scoped_refptr<BluetoothAdapter>(default_adapter.Get().get())); 93 callback.Run(scoped_refptr<BluetoothAdapter>(default_adapter.Get().get()));
94 94
95 } 95 }
96 96
97 // static 97 // static
98 void BluetoothAdapterFactory::Shutdown() {
99 if (default_adapter.Get()) {
100 default_adapter.Get()->Shutdown();
101 }
102 }
103
104 // static
98 void BluetoothAdapterFactory::SetAdapterForTesting( 105 void BluetoothAdapterFactory::SetAdapterForTesting(
99 scoped_refptr<BluetoothAdapter> adapter) { 106 scoped_refptr<BluetoothAdapter> adapter) {
100 default_adapter.Get() = adapter->GetWeakPtrForTesting(); 107 default_adapter.Get() = adapter->GetWeakPtrForTesting();
101 } 108 }
102 109
103 // static 110 // static
104 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { 111 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() {
105 return default_adapter.Get(); 112 return default_adapter.Get();
106 } 113 }
107 114
108 } // namespace device 115 } // namespace device
OLDNEW
« device/bluetooth/bluetooth_adapter_factory.h ('K') | « device/bluetooth/bluetooth_adapter_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698