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

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

Issue 2591863004: mus: aura::Env should be destroyed last in the mus client. (Closed)
Patch Set: . Created 3 years, 12 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/aura_init.h ('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/mus_client.h" 5 #include "ui/views/mus/mus_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h" 10 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 // static 58 // static
59 MusClient* MusClient::instance_ = nullptr; 59 MusClient* MusClient::instance_ = nullptr;
60 60
61 MusClient::MusClient(service_manager::Connector* connector, 61 MusClient::MusClient(service_manager::Connector* connector,
62 const service_manager::Identity& identity, 62 const service_manager::Identity& identity,
63 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 63 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
64 bool create_wm_state) 64 bool create_wm_state)
65 : identity_(identity) { 65 : identity_(identity) {
66 DCHECK(!instance_); 66 DCHECK(!instance_);
67 DCHECK(aura::Env::GetInstance());
67 instance_ = this; 68 instance_ = this;
68 69
69 if (!io_task_runner) { 70 if (!io_task_runner) {
70 io_thread_ = base::MakeUnique<base::Thread>("IOThread"); 71 io_thread_ = base::MakeUnique<base::Thread>("IOThread");
71 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); 72 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
72 thread_options.priority = base::ThreadPriority::NORMAL; 73 thread_options.priority = base::ThreadPriority::NORMAL;
73 CHECK(io_thread_->StartWithOptions(thread_options)); 74 CHECK(io_thread_->StartWithOptions(thread_options));
74 io_task_runner = io_thread_->task_runner(); 75 io_task_runner = io_thread_->task_runner();
75 } 76 }
76 77
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 gpu_.reset(); 125 gpu_.reset();
125 126
126 if (ViewsDelegate::GetInstance()) { 127 if (ViewsDelegate::GetInstance()) {
127 ViewsDelegate::GetInstance()->set_native_widget_factory( 128 ViewsDelegate::GetInstance()->set_native_widget_factory(
128 ViewsDelegate::NativeWidgetFactory()); 129 ViewsDelegate::NativeWidgetFactory());
129 } 130 }
130 131
131 base::DiscardableMemoryAllocator::SetInstance(nullptr); 132 base::DiscardableMemoryAllocator::SetInstance(nullptr);
132 DCHECK_EQ(instance_, this); 133 DCHECK_EQ(instance_, this);
133 instance_ = nullptr; 134 instance_ = nullptr;
135 DCHECK(aura::Env::GetInstance());
134 } 136 }
135 137
136 // static 138 // static
137 bool MusClient::ShouldCreateDesktopNativeWidgetAura( 139 bool MusClient::ShouldCreateDesktopNativeWidgetAura(
138 const Widget::InitParams& init_params) { 140 const Widget::InitParams& init_params) {
139 // TYPE_CONTROL and child widgets require a NativeWidgetAura. 141 // TYPE_CONTROL and child widgets require a NativeWidgetAura.
140 return init_params.type != Widget::InitParams::TYPE_CONTROL && 142 return init_params.type != Widget::InitParams::TYPE_CONTROL &&
141 !init_params.child; 143 !init_params.child;
142 } 144 }
143 145
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 return root->GetTopWindowContainingPoint(relative_point); 278 return root->GetTopWindowContainingPoint(relative_point);
277 } 279 }
278 return nullptr; 280 return nullptr;
279 } 281 }
280 282
281 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { 283 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() {
282 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); 284 return base::MakeUnique<aura::OSExchangeDataProviderMus>();
283 } 285 }
284 286
285 } // namespace views 287 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/aura_init.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698