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

Side by Side Diff: services/ui/demo/mus_demo.cc

Issue 2764433002: Fix destruction order in mus_demo (Closed)
Patch Set: add more extended comment. destroy env and wm_state explicitly Created 3 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "services/ui/demo/mus_demo.h" 5 #include "services/ui/demo/mus_demo.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "services/service_manager/public/cpp/connector.h" 8 #include "services/service_manager/public/cpp/connector.h"
9 #include "services/ui/demo/window_tree_data.h" 9 #include "services/ui/demo/window_tree_data.h"
10 #include "services/ui/public/cpp/gpu/gpu.h" 10 #include "services/ui/public/cpp/gpu/gpu.h"
11 #include "ui/aura/client/default_capture_client.h" 11 #include "ui/aura/client/default_capture_client.h"
12 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
13 #include "ui/aura/mus/property_converter.h" 13 #include "ui/aura/mus/property_converter.h"
14 #include "ui/aura/mus/window_tree_client.h" 14 #include "ui/aura/mus/window_tree_client.h"
15 #include "ui/aura/mus/window_tree_host_mus.h" 15 #include "ui/aura/mus/window_tree_host_mus.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
18 #include "ui/wm/core/wm_state.h" 18 #include "ui/wm/core/wm_state.h"
19 19
20 namespace ui { 20 namespace ui {
21 namespace demo { 21 namespace demo {
22 22
23 MusDemo::MusDemo() {} 23 MusDemo::MusDemo() {}
24 24
25 MusDemo::~MusDemo() { 25 MusDemo::~MusDemo() {
26 display::Screen::SetScreenInstance(nullptr); 26 display::Screen::SetScreenInstance(nullptr);
27 // Destruction order is important here:
28 // 1) Windows must be destroyed before WindowTreeClient's destructor is
29 // called.
30 // 2) WindowTreeClient must be destroyed before Env and WMState.
31 window_tree_data_list_.clear();
32 window_tree_client_.reset();
33 env_.reset();
34 wm_state_.reset();
27 } 35 }
28 36
29 void MusDemo::AddPrimaryDisplay(const display::Display& display) { 37 void MusDemo::AddPrimaryDisplay(const display::Display& display) {
30 screen_->display_list().AddDisplay(display, 38 screen_->display_list().AddDisplay(display,
31 display::DisplayList::Type::PRIMARY); 39 display::DisplayList::Type::PRIMARY);
32 } 40 }
33 41
34 bool MusDemo::HasPendingWindowTreeData() const { 42 bool MusDemo::HasPendingWindowTreeData() const {
35 return !window_tree_data_list_.empty() && 43 return !window_tree_data_list_.empty() &&
36 !window_tree_data_list_.back()->IsInitialized(); 44 !window_tree_data_list_.back()->IsInitialized();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 107
100 void MusDemo::OnPointerEventObserved(const PointerEvent& event, 108 void MusDemo::OnPointerEventObserved(const PointerEvent& event,
101 aura::Window* target) {} 109 aura::Window* target) {}
102 110
103 aura::PropertyConverter* MusDemo::GetPropertyConverter() { 111 aura::PropertyConverter* MusDemo::GetPropertyConverter() {
104 return property_converter_.get(); 112 return property_converter_.get();
105 } 113 }
106 114
107 } // namespace demo 115 } // namespace demo
108 } // namespace ui 116 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698