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

Unified Diff: ui/views/mus/window_manager_connection.cc

Issue 2023863003: views/mus: Destroy DeviceDataManager only if WindowManagerConnection owns it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot-merge Created 4 years, 7 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 | « ui/views/mus/window_manager_connection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/window_manager_connection.cc
diff --git a/ui/views/mus/window_manager_connection.cc b/ui/views/mus/window_manager_connection.cc
index 0a4189ab977df689729e8dd12edde5f09973e1f5..9954f9ea3dd890a9473fbfd70bf91b1945157539 100644
--- a/ui/views/mus/window_manager_connection.cc
+++ b/ui/views/mus/window_manager_connection.cc
@@ -102,17 +102,20 @@ WindowManagerConnection::WindowManagerConnection(
const shell::Identity& identity)
: connector_(connector),
identity_(identity),
- client_(nullptr) {
+ created_device_data_manager_(false) {
client_.reset(new mus::WindowTreeClient(this, nullptr, nullptr));
client_->ConnectViaWindowTreeFactory(connector_);
screen_.reset(new ScreenMus(this));
screen_->Init(connector);
- // TODO(sad): We should have a DeviceDataManager implementation that talks to
- // a mojo service to learn about the input-devices on the system.
- // http://crbug.com/601981
- ui::DeviceDataManager::CreateInstance();
+ if (!ui::DeviceDataManager::HasInstance()) {
+ // TODO(sad): We should have a DeviceDataManager implementation that talks
+ // to a mojo service to learn about the input-devices on the system.
+ // http://crbug.com/601981
+ ui::DeviceDataManager::CreateInstance();
+ created_device_data_manager_ = true;
+ }
ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind(
&WindowManagerConnection::CreateNativeWidgetMus,
@@ -124,8 +127,8 @@ WindowManagerConnection::~WindowManagerConnection() {
// ~WindowTreeClient calls back to us (we're its delegate), destroy it while
// we are still valid.
client_.reset();
-
- ui::DeviceDataManager::DeleteInstance();
+ if (created_device_data_manager_)
+ ui::DeviceDataManager::DeleteInstance();
}
bool WindowManagerConnection::HasPointerWatcher() {
« no previous file with comments | « ui/views/mus/window_manager_connection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698