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

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

Issue 848613003: bluetooth: Shutdown BluetoothAdapter before DBus on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: unit test 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CHROMEOS_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 25 matching lines...) Expand all
36 // Chrome OS platform. 36 // Chrome OS platform.
37 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS 37 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
38 : public device::BluetoothAdapter, 38 : public device::BluetoothAdapter,
39 public chromeos::BluetoothAdapterClient::Observer, 39 public chromeos::BluetoothAdapterClient::Observer,
40 public chromeos::BluetoothDeviceClient::Observer, 40 public chromeos::BluetoothDeviceClient::Observer,
41 public chromeos::BluetoothInputClient::Observer, 41 public chromeos::BluetoothInputClient::Observer,
42 public chromeos::BluetoothAgentServiceProvider::Delegate { 42 public chromeos::BluetoothAgentServiceProvider::Delegate {
43 public: 43 public:
44 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); 44 static base::WeakPtr<BluetoothAdapter> CreateAdapter();
45 45
46 // Shutdown the adapter: tear down and clean up all objects owned by
47 // BluetoothAdapter. After this call, the BluetoothAdapter will behave as if
48 // no Bluetooth controller exists in the local system. |IsPresent| will return
49 // false. No futher use of DBusThreadManager will be made.
50 void OnDBusThreadManagerShutdown();
51
46 // BluetoothAdapter: 52 // BluetoothAdapter:
47 void DeleteOnCorrectThread() const override; 53 void DeleteOnCorrectThread() const override;
48 virtual void AddObserver( 54 virtual void AddObserver(
49 device::BluetoothAdapter::Observer* observer) override; 55 device::BluetoothAdapter::Observer* observer) override;
50 virtual void RemoveObserver( 56 virtual void RemoveObserver(
51 device::BluetoothAdapter::Observer* observer) override; 57 device::BluetoothAdapter::Observer* observer) override;
52 virtual std::string GetAddress() const override; 58 virtual std::string GetAddress() const override;
53 virtual std::string GetName() const override; 59 virtual std::string GetName() const override;
54 virtual void SetName(const std::string& name, 60 virtual void SetName(const std::string& name,
55 const base::Closure& callback, 61 const base::Closure& callback,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 void OnStopDiscoveryError(const ErrorCallback& error_callback, 240 void OnStopDiscoveryError(const ErrorCallback& error_callback,
235 const std::string& error_name, 241 const std::string& error_name,
236 const std::string& error_message); 242 const std::string& error_message);
237 243
238 // Processes the queued discovery requests. For each DiscoveryCallbackPair in 244 // Processes the queued discovery requests. For each DiscoveryCallbackPair in
239 // the queue, this method will try to add a new discovery session. This method 245 // the queue, this method will try to add a new discovery session. This method
240 // is called whenever a pending D-Bus call to start or stop discovery has 246 // is called whenever a pending D-Bus call to start or stop discovery has
241 // ended (with either success or failure). 247 // ended (with either success or failure).
242 void ProcessQueuedDiscoveryRequests(); 248 void ProcessQueuedDiscoveryRequests();
243 249
250 // Set in |OnDBusThreadManagerShutdown()|, makes IsPresent()| return false.
251 bool dbus_is_shutdown_;
252
244 // Number of discovery sessions that have been added. 253 // Number of discovery sessions that have been added.
245 int num_discovery_sessions_; 254 int num_discovery_sessions_;
246 255
247 // True, if there is a pending request to start or stop discovery. 256 // True, if there is a pending request to start or stop discovery.
248 bool discovery_request_pending_; 257 bool discovery_request_pending_;
249 258
250 // List of queued requests to add new discovery sessions. While there is a 259 // List of queued requests to add new discovery sessions. While there is a
251 // pending request to BlueZ to start or stop discovery, many requests from 260 // pending request to BlueZ to start or stop discovery, many requests from
252 // within Chrome to start or stop discovery sessions may occur. We only 261 // within Chrome to start or stop discovery sessions may occur. We only
253 // queue requests to add new sessions to be processed later. All requests to 262 // queue requests to add new sessions to be processed later. All requests to
(...skipping 21 matching lines...) Expand all
275 // Note: This should remain the last member so it'll be destroyed and 284 // Note: This should remain the last member so it'll be destroyed and
276 // invalidate its weak pointers before any other members are destroyed. 285 // invalidate its weak pointers before any other members are destroyed.
277 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; 286 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_;
278 287
279 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); 288 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS);
280 }; 289 };
281 290
282 } // namespace chromeos 291 } // namespace chromeos
283 292
284 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ 293 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698