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

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

Issue 1898303003: bluetooth: Clean up WebBluetoothServiceImpl when adapter is removed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Re-enable tests Created 4 years, 8 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 978aa88468219fdf3c73719494ea4787aad60b7b..7f6228c080efc28a4702ce315697cb94102eaf8c 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl.cc
+++ b/content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -91,7 +91,15 @@ void WebBluetoothServiceImpl::DidFinishNavigation(
navigation_handle->GetRenderFrameHost() == render_frame_host_ &&
!navigation_handle->IsSamePage()) {
// After navigation we need to clear the frame's state.
- characteristic_id_to_notify_session_.clear();
+ ClearState();
+ }
+}
+
+void WebBluetoothServiceImpl::AdapterPresentChanged(
+ device::BluetoothAdapter* adapter,
+ bool present) {
+ if (!present) {
+ ClearState();
}
}
@@ -376,4 +384,8 @@ url::Origin WebBluetoothServiceImpl::GetOrigin() {
return render_frame_host_->GetLastCommittedOrigin();
}
+void WebBluetoothServiceImpl::ClearState() {
+ characteristic_id_to_notify_session_.clear();
+}
+
} // namespace content
« no previous file with comments | « content/browser/bluetooth/web_bluetooth_service_impl.h ('k') | third_party/WebKit/LayoutTests/ASANExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698