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

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: Limit shutdown to defined(CHROMEOS); add checks that methods aren't run after shutdown 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
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 #if defined(OS_CHROMEOS)
98 // static
99 void BluetoothAdapterFactory::OnDBusThreadManagerShutdown() {
100 if (default_adapter.Get()) {
101 default_adapter.Get()->OnDBusThreadManagerShutdown();
102 }
103 }
104 #endif
105
97 // static 106 // static
98 void BluetoothAdapterFactory::SetAdapterForTesting( 107 void BluetoothAdapterFactory::SetAdapterForTesting(
99 scoped_refptr<BluetoothAdapter> adapter) { 108 scoped_refptr<BluetoothAdapter> adapter) {
100 default_adapter.Get() = adapter->GetWeakPtrForTesting(); 109 default_adapter.Get() = adapter->GetWeakPtrForTesting();
101 } 110 }
102 111
103 // static 112 // static
104 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() { 113 bool BluetoothAdapterFactory::HasSharedInstanceForTesting() {
105 return default_adapter.Get(); 114 return default_adapter.Get();
106 } 115 }
107 116
108 } // namespace device 117 } // 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