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

Side by Side Diff: device/bluetooth/bluetooth_adapter.h

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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 // Returns a weak pointer to a new adapter. For platforms with asynchronous 182 // Returns a weak pointer to a new adapter. For platforms with asynchronous
183 // initialization, the returned adapter will run the |init_callback| once 183 // initialization, the returned adapter will run the |init_callback| once
184 // asynchronous initialization is complete. 184 // asynchronous initialization is complete.
185 // Caution: The returned pointer also transfers ownership of the adapter. The 185 // Caution: The returned pointer also transfers ownership of the adapter. The
186 // caller is expected to call |AddRef()| on the returned pointer, typically by 186 // caller is expected to call |AddRef()| on the returned pointer, typically by
187 // storing it into a |scoped_refptr|. 187 // storing it into a |scoped_refptr|.
188 static base::WeakPtr<BluetoothAdapter> CreateAdapter( 188 static base::WeakPtr<BluetoothAdapter> CreateAdapter(
189 const InitCallback& init_callback); 189 const InitCallback& init_callback);
190 190
191 #if defined(OS_CHROMEOS)
192 // Shutdown the adapter, ending reliance DBusThreadManager, and resulting in
193 // the adapter's |IsPresent| returning false.
194 virtual void OnDBusThreadManagerShutdown();
stevenjb 2015/01/14 23:44:14 nit: We could make this a pure virtual and elimina
scheib 2015/01/15 00:03:40 Acknowledged.
195 #endif
armansito 2015/01/14 23:49:47 I wouldn't even add this method to BluetoothAdapte
scheib 2015/01/15 00:03:40 Done.
196
191 // Returns a weak pointer to an existing adapter for testing purposes only. 197 // Returns a weak pointer to an existing adapter for testing purposes only.
192 base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting(); 198 base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting();
193 199
194 // Adds and removes observers for events on this bluetooth adapter. If 200 // Adds and removes observers for events on this bluetooth adapter. If
195 // monitoring multiple adapters, check the |adapter| parameter of observer 201 // monitoring multiple adapters, check the |adapter| parameter of observer
196 // methods to determine which adapter is issuing the event. 202 // methods to determine which adapter is issuing the event.
197 virtual void AddObserver(BluetoothAdapter::Observer* observer) = 0; 203 virtual void AddObserver(BluetoothAdapter::Observer* observer) = 0;
198 virtual void RemoveObserver( 204 virtual void RemoveObserver(
199 BluetoothAdapter::Observer* observer) = 0; 205 BluetoothAdapter::Observer* observer) = 0;
200 206
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 // Trait for RefCountedThreadSafe that deletes BluetoothAdapter. 436 // Trait for RefCountedThreadSafe that deletes BluetoothAdapter.
431 struct BluetoothAdapterDeleter { 437 struct BluetoothAdapterDeleter {
432 static void Destruct(const BluetoothAdapter* adapter) { 438 static void Destruct(const BluetoothAdapter* adapter) {
433 adapter->DeleteOnCorrectThread(); 439 adapter->DeleteOnCorrectThread();
434 } 440 }
435 }; 441 };
436 442
437 } // namespace device 443 } // namespace device
438 444
439 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 445 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698