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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.h

Issue 1592733002: Clear the BLE services list on disconnect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the bluetooth/getPrimaryService.html timeout issue Created 4 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
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_dispatcher_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 CacheQueryResult QueryCacheForDevice(const std::string& device_id); 215 CacheQueryResult QueryCacheForDevice(const std::string& device_id);
216 // Queries the platform cache for a Service with |service_instance_id|. Fills 216 // Queries the platform cache for a Service with |service_instance_id|. Fills
217 // in the |outcome| field, and |device| and |service| fields if successful. 217 // in the |outcome| field, and |device| and |service| fields if successful.
218 CacheQueryResult QueryCacheForService(const std::string& service_instance_id); 218 CacheQueryResult QueryCacheForService(const std::string& service_instance_id);
219 // Queries the platform cache for a characteristic with 219 // Queries the platform cache for a characteristic with
220 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|, 220 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|,
221 // |service| and |characteristic| fields if successful. 221 // |service| and |characteristic| fields if successful.
222 CacheQueryResult QueryCacheForCharacteristic( 222 CacheQueryResult QueryCacheForCharacteristic(
223 const std::string& characteristic_instance_id); 223 const std::string& characteristic_instance_id);
224 224
225 // Returns true if all services have been discovered for the device.
226 // When the host gets a ServiceChanged indication, it automatically
227 // re-discovers services, and only forwards the ServiceChanged event to this
228 // class when it's done re-discovering.
229 bool IsServicesDiscoveryCompleteForDevice(const std::string& device_id);
230
231 // Adds the PrimaryServicesRequest to the vector of pending services requests 225 // Adds the PrimaryServicesRequest to the vector of pending services requests
232 // for that device. 226 // for that device.
233 void AddToPendingPrimaryServicesRequest( 227 void AddToPendingPrimaryServicesRequest(
234 const std::string& device_id, 228 const std::string& device_id,
235 const PrimaryServicesRequest& request); 229 const PrimaryServicesRequest& request);
236 230
237 // Show help pages from the chooser dialog. 231 // Show help pages from the chooser dialog.
238 void ShowBluetoothOverviewLink(); 232 void ShowBluetoothOverviewLink();
239 void ShowBluetoothPairingLink(); 233 void ShowBluetoothPairingLink();
240 void ShowBluetoothAdapterOffLink(); 234 void ShowBluetoothAdapterOffLink();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // started. We have a single timer for all of Web Bluetooth because it's 269 // started. We have a single timer for all of Web Bluetooth because it's
276 // simpler than tracking timeouts for each RequestDeviceSession individually, 270 // simpler than tracking timeouts for each RequestDeviceSession individually,
277 // and because there's no harm in extending the length of a few discovery 271 // and because there's no harm in extending the length of a few discovery
278 // sessions when other sessions are active. 272 // sessions when other sessions are active.
279 base::Timer discovery_session_timer_; 273 base::Timer discovery_session_timer_;
280 274
281 // Retain BluetoothGattConnection objects to keep connections open. 275 // Retain BluetoothGattConnection objects to keep connections open.
282 // TODO(scheib): Destroy as connections are closed. http://crbug.com/539643 276 // TODO(scheib): Destroy as connections are closed. http://crbug.com/539643
283 ScopedVector<device::BluetoothGattConnection> connections_; 277 ScopedVector<device::BluetoothGattConnection> connections_;
284 278
285 // Keeps track of which devices have had their services discovered.
286 std::set<std::string> devices_with_discovered_services_;
287
288 // Map of device_id's to primary-services requests that need responses when 279 // Map of device_id's to primary-services requests that need responses when
289 // that device's service discovery completes. 280 // that device's service discovery completes.
290 std::map<std::string, std::vector<PrimaryServicesRequest>> 281 std::map<std::string, std::vector<PrimaryServicesRequest>>
291 pending_primary_services_requests_; 282 pending_primary_services_requests_;
292 283
293 // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and 284 // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and
294 // because it exists and has been bound to the UI thread enforces that all 285 // because it exists and has been bound to the UI thread enforces that all
295 // copies verify they are also used on the UI thread. 286 // copies verify they are also used on the UI thread.
296 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; 287 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_;
297 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; 288 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_;
298 289
299 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); 290 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost);
300 }; 291 };
301 292
302 } // namespace content 293 } // namespace content
303 294
304 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 295 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698