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

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

Issue 2644093002: aura: Some change to how the client-lib is set up. (Closed)
Patch Set: . Created 3 years, 11 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/mus_client.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr; 84 discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr;
85 connector->BindInterface(ui::mojom::kServiceName, &manager_ptr); 85 connector->BindInterface(ui::mojom::kServiceName, &manager_ptr);
86 86
87 discardable_shared_memory_manager_ = base::MakeUnique< 87 discardable_shared_memory_manager_ = base::MakeUnique<
88 discardable_memory::ClientDiscardableSharedMemoryManager>( 88 discardable_memory::ClientDiscardableSharedMemoryManager>(
89 std::move(manager_ptr), io_task_runner); 89 std::move(manager_ptr), io_task_runner);
90 base::DiscardableMemoryAllocator::SetInstance( 90 base::DiscardableMemoryAllocator::SetInstance(
91 discardable_shared_memory_manager_.get()); 91 discardable_shared_memory_manager_.get());
92 92
93 gpu_ = ui::Gpu::Create(connector, std::move(io_task_runner)); 93 window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>(
94 compositor_context_factory_ = 94 connector, this, nullptr /* window_manager_delegate */,
95 base::MakeUnique<aura::MusContextFactory>(gpu_.get()); 95 nullptr /* window_tree_client_request */, std::move(io_task_runner));
96 aura::Env::GetInstance()->set_context_factory(
97 compositor_context_factory_.get());
98 window_tree_client_ =
99 base::MakeUnique<aura::WindowTreeClient>(connector, this);
100 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); 96 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get());
101 window_tree_client_->ConnectViaWindowTreeFactory(); 97 window_tree_client_->ConnectViaWindowTreeFactory();
102 98
103 pointer_watcher_event_router_ = 99 pointer_watcher_event_router_ =
104 base::MakeUnique<PointerWatcherEventRouter>(window_tree_client_.get()); 100 base::MakeUnique<PointerWatcherEventRouter>(window_tree_client_.get());
105 101
106 screen_ = base::MakeUnique<ScreenMus>(this); 102 screen_ = base::MakeUnique<ScreenMus>(this);
107 screen_->Init(connector); 103 screen_->Init(connector);
108 104
109 std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); 105 std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>();
110 clipboard->Init(connector); 106 clipboard->Init(connector);
111 ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard)); 107 ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard));
112 108
113 ui::OSExchangeDataProviderFactory::SetFactory(this); 109 ui::OSExchangeDataProviderFactory::SetFactory(this);
114 110
115 ViewsDelegate::GetInstance()->set_native_widget_factory( 111 ViewsDelegate::GetInstance()->set_native_widget_factory(
116 base::Bind(&MusClient::CreateNativeWidget, base::Unretained(this))); 112 base::Bind(&MusClient::CreateNativeWidget, base::Unretained(this)));
117 } 113 }
118 114
119 MusClient::~MusClient() { 115 MusClient::~MusClient() {
120 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while 116 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while
121 // we are still valid. 117 // we are still valid.
122 window_tree_client_.reset(); 118 window_tree_client_.reset();
123 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); 119 ui::OSExchangeDataProviderFactory::SetFactory(nullptr);
124 ui::Clipboard::DestroyClipboardForCurrentThread(); 120 ui::Clipboard::DestroyClipboardForCurrentThread();
125 gpu_.reset();
126 121
127 if (ViewsDelegate::GetInstance()) { 122 if (ViewsDelegate::GetInstance()) {
128 ViewsDelegate::GetInstance()->set_native_widget_factory( 123 ViewsDelegate::GetInstance()->set_native_widget_factory(
129 ViewsDelegate::NativeWidgetFactory()); 124 ViewsDelegate::NativeWidgetFactory());
130 } 125 }
131 126
132 base::DiscardableMemoryAllocator::SetInstance(nullptr); 127 base::DiscardableMemoryAllocator::SetInstance(nullptr);
133 DCHECK_EQ(instance_, this); 128 DCHECK_EQ(instance_, this);
134 instance_ = nullptr; 129 instance_ = nullptr;
135 DCHECK(aura::Env::GetInstance()); 130 DCHECK(aura::Env::GetInstance());
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 return root->GetTopWindowContainingPoint(relative_point); 269 return root->GetTopWindowContainingPoint(relative_point);
275 } 270 }
276 return nullptr; 271 return nullptr;
277 } 272 }
278 273
279 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { 274 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() {
280 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); 275 return base::MakeUnique<aura::OSExchangeDataProviderMus>();
281 } 276 }
282 277
283 } // namespace views 278 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/mus_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698