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

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

Issue 2200353002: Revert of services/ui: Have an explicit lifetime/ownership of ui::GpuService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/window_manager_connection.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/window_manager_connection.h" 5 #include "ui/views/mus/window_manager_connection.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
(...skipping 23 matching lines...) Expand all
34 base::LazyInstance<WindowManagerConnectionPtr>::Leaky lazy_tls_ptr = 34 base::LazyInstance<WindowManagerConnectionPtr>::Leaky lazy_tls_ptr =
35 LAZY_INSTANCE_INITIALIZER; 35 LAZY_INSTANCE_INITIALIZER;
36 36
37 } // namespace 37 } // namespace
38 38
39 WindowManagerConnection::~WindowManagerConnection() { 39 WindowManagerConnection::~WindowManagerConnection() {
40 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while 40 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while
41 // we are still valid. 41 // we are still valid.
42 client_.reset(); 42 client_.reset();
43 ui::Clipboard::DestroyClipboardForCurrentThread(); 43 ui::Clipboard::DestroyClipboardForCurrentThread();
44 gpu_service_.reset(); 44 ui::GpuService::Terminate();
45 lazy_tls_ptr.Pointer()->Set(nullptr); 45 lazy_tls_ptr.Pointer()->Set(nullptr);
46 46
47 if (ViewsDelegate::GetInstance()) { 47 if (ViewsDelegate::GetInstance()) {
48 ViewsDelegate::GetInstance()->set_native_widget_factory( 48 ViewsDelegate::GetInstance()->set_native_widget_factory(
49 ViewsDelegate::NativeWidgetFactory()); 49 ViewsDelegate::NativeWidgetFactory());
50 } 50 }
51 } 51 }
52 52
53 // static 53 // static
54 std::unique_ptr<WindowManagerConnection> WindowManagerConnection::Create( 54 std::unique_ptr<WindowManagerConnection> WindowManagerConnection::Create(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const std::set<ui::Window*>& WindowManagerConnection::GetRoots() const { 143 const std::set<ui::Window*>& WindowManagerConnection::GetRoots() const {
144 return client_->GetRoots(); 144 return client_->GetRoots();
145 } 145 }
146 146
147 WindowManagerConnection::WindowManagerConnection( 147 WindowManagerConnection::WindowManagerConnection(
148 shell::Connector* connector, 148 shell::Connector* connector,
149 const shell::Identity& identity) 149 const shell::Identity& identity)
150 : connector_(connector), identity_(identity) { 150 : connector_(connector), identity_(identity) {
151 lazy_tls_ptr.Pointer()->Set(this); 151 lazy_tls_ptr.Pointer()->Set(this);
152 152
153 gpu_service_ = ui::GpuService::Initialize(connector); 153 ui::GpuService::Initialize(connector);
154
154 client_.reset(new ui::WindowTreeClient(this, nullptr, nullptr)); 155 client_.reset(new ui::WindowTreeClient(this, nullptr, nullptr));
155 client_->ConnectViaWindowTreeFactory(connector_); 156 client_->ConnectViaWindowTreeFactory(connector_);
156 157
157 screen_.reset(new ScreenMus(this)); 158 screen_.reset(new ScreenMus(this));
158 screen_->Init(connector); 159 screen_->Init(connector);
159 160
160 std::unique_ptr<ClipboardMus> clipboard(new ClipboardMus); 161 std::unique_ptr<ClipboardMus> clipboard(new ClipboardMus);
161 clipboard->Init(connector); 162 clipboard->Init(connector);
162 ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard)); 163 ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard));
163 164
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() { 231 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() {
231 if (client_) 232 if (client_)
232 NativeWidgetMus::NotifyFrameChanged(client_.get()); 233 NativeWidgetMus::NotifyFrameChanged(client_.get());
233 } 234 }
234 235
235 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { 236 gfx::Point WindowManagerConnection::GetCursorScreenPoint() {
236 return client_->GetCursorScreenPoint(); 237 return client_->GetCursorScreenPoint();
237 } 238 }
238 239
239 } // namespace views 240 } // namespace views
OLDNEW
« 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