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

Side by Side Diff: ui/views/mus/views_mus_test_suite.cc

Issue 1998543004: Fixes crash in ~ShellConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « ui/views/mus/display_list_unittest.cc ('k') | 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 "ui/views/mus/views_mus_test_suite.h" 5 #include "ui/views/mus/views_mus_test_suite.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // WindowManagerConnection cannot be created from here yet, although the 78 // WindowManagerConnection cannot be created from here yet, although the
79 // connector and identity are available at this point. This is because 79 // connector and identity are available at this point. This is because
80 // WindowManagerConnection needs a ViewsDelegate and a MessageLoop to have 80 // WindowManagerConnection needs a ViewsDelegate and a MessageLoop to have
81 // been installed first. So delay the creation until the necessary 81 // been installed first. So delay the creation until the necessary
82 // dependencies have been met. 82 // dependencies have been met.
83 PlatformTestHelper::set_factory(base::Bind( 83 PlatformTestHelper::set_factory(base::Bind(
84 &CreatePlatformTestHelper, shell_connector_.get(), shell_identity_)); 84 &CreatePlatformTestHelper, shell_connector_.get(), shell_identity_));
85 } 85 }
86 86
87 ~ShellConnection() { 87 ~ShellConnection() {
88 views::WindowManagerConnection::Reset(); 88 if (views::WindowManagerConnection::Exists())
89 views::WindowManagerConnection::Reset();
89 base::WaitableEvent wait(false, false); 90 base::WaitableEvent wait(false, false);
90 thread_.task_runner()->PostTask( 91 thread_.task_runner()->PostTask(
91 FROM_HERE, base::Bind(&ShellConnection::TearDownConnections, 92 FROM_HERE, base::Bind(&ShellConnection::TearDownConnections,
92 base::Unretained(this), &wait)); 93 base::Unretained(this), &wait));
93 wait.Wait(); 94 wait.Wait();
94 } 95 }
95 96
96 private: 97 private:
97 void SetUpConnections(base::WaitableEvent* wait) { 98 void SetUpConnections(base::WaitableEvent* wait) {
98 background_shell_.reset(new shell::BackgroundShell); 99 background_shell_.reset(new shell::BackgroundShell);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ViewsTestSuite::Initialize(); 151 ViewsTestSuite::Initialize();
151 shell_connections_.reset(new ShellConnection); 152 shell_connections_.reset(new ShellConnection);
152 } 153 }
153 154
154 void ViewsMusTestSuite::Shutdown() { 155 void ViewsMusTestSuite::Shutdown() {
155 shell_connections_.reset(); 156 shell_connections_.reset();
156 ViewsTestSuite::Shutdown(); 157 ViewsTestSuite::Shutdown();
157 } 158 }
158 159
159 } // namespace views 160 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/display_list_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698