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

Unified Diff: content/browser/bluetooth/web_bluetooth_service_impl.cc

Issue 2030973002: bluetooth: Handle two consecutives requestDevice calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Improve comment Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/web_bluetooth_service_impl.cc
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.cc b/content/browser/bluetooth/web_bluetooth_service_impl.cc
index 46c94f109ceaf62569af389968a7edaec44d75c4..ef372a8aad26483ae54fbdde6c5816deef2e7347 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl.cc
+++ b/content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -650,10 +650,12 @@ void WebBluetoothServiceImpl::RequestDeviceImpl(
blink::mojom::WebBluetoothRequestDeviceOptionsPtr options,
const RequestDeviceCallback& callback,
device::BluetoothAdapter* adapter) {
- // requestDevice() can only be called when processing a user-gesture and
- // any user gesture outside of a chooser should close the chooser so we should
- // never get a request with an open chooser.
- CHECK(!device_chooser_controller_.get());
+ // requestDevice() can only be called when processing a user-gesture and any
+ // user gesture outside of a chooser should close the chooser. This does
+ // not happen on all platforms so we don't DCHECK that the old one is closed.
+ // We destroy the old chooser before constructing the new one to make sure
+ // they can't conflict.
+ device_chooser_controller_.reset();
device_chooser_controller_.reset(new BluetoothDeviceChooserController(
this, render_frame_host_, adapter,

Powered by Google App Engine
This is Rietveld 408576698