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

Unified Diff: ash/mus/accelerator_registrar_impl.cc

Issue 2105653003: Fixes shutdown race in mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 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
« no previous file with comments | « ash/mus/accelerator_registrar_impl.h ('k') | ash/mus/root_windows_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/accelerator_registrar_impl.cc
diff --git a/ash/mus/accelerator_registrar_impl.cc b/ash/mus/accelerator_registrar_impl.cc
index 0f4502edd45a10198f82d6078d71b4355a497f61..361f8a7f22f6f8ef6060e66a9ee0a62884cb4854 100644
--- a/ash/mus/accelerator_registrar_impl.cc
+++ b/ash/mus/accelerator_registrar_impl.cc
@@ -35,6 +35,7 @@ AcceleratorRegistrarImpl::AcceleratorRegistrarImpl(
binding_(this, std::move(request)),
accelerator_namespace_(accelerator_namespace & 0xffff),
destroy_callback_(destroy_callback) {
+ window_manager_->AddObserver(this);
binding_.set_connection_error_handler(base::Bind(
&AcceleratorRegistrarImpl::OnBindingGone, base::Unretained(this)));
}
@@ -57,6 +58,7 @@ void AcceleratorRegistrarImpl::ProcessAccelerator(uint32_t accelerator_id,
}
AcceleratorRegistrarImpl::~AcceleratorRegistrarImpl() {
+ window_manager_->RemoveObserver(this);
RemoveAllAccelerators();
destroy_callback_.Run(this);
}
@@ -132,5 +134,15 @@ void AcceleratorRegistrarImpl::RemoveAccelerator(uint32_t accelerator_id) {
delete this;
}
+void AcceleratorRegistrarImpl::OnAccelerator(uint32_t id,
+ const ui::Event& event) {
+ if (OwnsAccelerator(id))
+ ProcessAccelerator(id, event);
+}
+
+void AcceleratorRegistrarImpl::OnWindowTreeClientDestroyed() {
+ delete this;
+}
+
} // namespace mus
} // namespace ash
« no previous file with comments | « ash/mus/accelerator_registrar_impl.h ('k') | ash/mus/root_windows_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698