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

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

Issue 2741063002: Setup DiscardableMemory in the ash process (Closed)
Patch Set: Fix issues. 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
« ui/aura/mus/window_tree_client.cc ('K') | « 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"
11 #include "services/service_manager/public/cpp/connection.h" 10 #include "services/service_manager/public/cpp/connection.h"
12 #include "services/service_manager/public/cpp/connector.h" 11 #include "services/service_manager/public/cpp/connector.h"
13 #include "services/ui/public/cpp/gpu/gpu.h" 12 #include "services/ui/public/cpp/gpu/gpu.h"
14 #include "services/ui/public/cpp/property_type_converters.h" 13 #include "services/ui/public/cpp/property_type_converters.h"
15 #include "services/ui/public/interfaces/constants.mojom.h" 14 #include "services/ui/public/interfaces/constants.mojom.h"
16 #include "services/ui/public/interfaces/event_matcher.mojom.h" 15 #include "services/ui/public/interfaces/event_matcher.mojom.h"
17 #include "services/ui/public/interfaces/window_manager.mojom.h" 16 #include "services/ui/public/interfaces/window_manager.mojom.h"
18 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
19 #include "ui/aura/mus/capture_synchronizer.h" 18 #include "ui/aura/mus/capture_synchronizer.h"
20 #include "ui/aura/mus/mus_context_factory.h" 19 #include "ui/aura/mus/mus_context_factory.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // TODO(msw): Avoid this... use some default value? Allow clients to extend? 78 // TODO(msw): Avoid this... use some default value? Allow clients to extend?
80 property_converter_ = base::MakeUnique<aura::PropertyConverter>(); 79 property_converter_ = base::MakeUnique<aura::PropertyConverter>();
81 property_converter_->RegisterProperty( 80 property_converter_->RegisterProperty(
82 wm::kShadowElevationKey, 81 wm::kShadowElevationKey,
83 ui::mojom::WindowManager::kShadowElevation_Property, 82 ui::mojom::WindowManager::kShadowElevation_Property,
84 base::Bind(&wm::IsValidShadowElevation)); 83 base::Bind(&wm::IsValidShadowElevation));
85 84
86 if (create_wm_state) 85 if (create_wm_state)
87 wm_state_ = base::MakeUnique<wm::WMState>(); 86 wm_state_ = base::MakeUnique<wm::WMState>();
88 87
89 discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr;
90 connector->BindInterface(ui::mojom::kServiceName, &manager_ptr);
91
92 discardable_shared_memory_manager_ = base::MakeUnique<
93 discardable_memory::ClientDiscardableSharedMemoryManager>(
94 std::move(manager_ptr), io_task_runner);
95 base::DiscardableMemoryAllocator::SetInstance(
96 discardable_shared_memory_manager_.get());
97
98 window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>( 88 window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>(
99 connector, this, nullptr /* window_manager_delegate */, 89 connector, this, nullptr /* window_manager_delegate */,
100 nullptr /* window_tree_client_request */, std::move(io_task_runner)); 90 nullptr /* window_tree_client_request */, std::move(io_task_runner));
101 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); 91 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get());
102 window_tree_client_->ConnectViaWindowTreeFactory(); 92 window_tree_client_->ConnectViaWindowTreeFactory();
103 93
104 pointer_watcher_event_router_ = 94 pointer_watcher_event_router_ =
105 base::MakeUnique<PointerWatcherEventRouter>(window_tree_client_.get()); 95 base::MakeUnique<PointerWatcherEventRouter>(window_tree_client_.get());
106 96
107 screen_ = base::MakeUnique<ScreenMus>(this); 97 screen_ = base::MakeUnique<ScreenMus>(this);
(...skipping 12 matching lines...) Expand all
120 // we are still valid. 110 // we are still valid.
121 window_tree_client_.reset(); 111 window_tree_client_.reset();
122 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); 112 ui::OSExchangeDataProviderFactory::SetFactory(nullptr);
123 ui::Clipboard::DestroyClipboardForCurrentThread(); 113 ui::Clipboard::DestroyClipboardForCurrentThread();
124 114
125 if (ViewsDelegate::GetInstance()) { 115 if (ViewsDelegate::GetInstance()) {
126 ViewsDelegate::GetInstance()->set_native_widget_factory( 116 ViewsDelegate::GetInstance()->set_native_widget_factory(
127 ViewsDelegate::NativeWidgetFactory()); 117 ViewsDelegate::NativeWidgetFactory());
128 } 118 }
129 119
130 base::DiscardableMemoryAllocator::SetInstance(nullptr);
131 DCHECK_EQ(instance_, this); 120 DCHECK_EQ(instance_, this);
132 instance_ = nullptr; 121 instance_ = nullptr;
133 DCHECK(aura::Env::GetInstance()); 122 DCHECK(aura::Env::GetInstance());
134 } 123 }
135 124
136 // static 125 // static
137 bool MusClient::ShouldCreateDesktopNativeWidgetAura( 126 bool MusClient::ShouldCreateDesktopNativeWidgetAura(
138 const Widget::InitParams& init_params) { 127 const Widget::InitParams& init_params) {
139 // TYPE_CONTROL and child widgets require a NativeWidgetAura. 128 // TYPE_CONTROL and child widgets require a NativeWidgetAura.
140 return init_params.type != Widget::InitParams::TYPE_CONTROL && 129 return init_params.type != Widget::InitParams::TYPE_CONTROL &&
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // TODO: this likely gets z-order wrong. http://crbug.com/663606. 277 // TODO: this likely gets z-order wrong. http://crbug.com/663606.
289 gfx::Point relative_point(point); 278 gfx::Point relative_point(point);
290 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point); 279 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point);
291 if (gfx::Rect(root->bounds().size()).Contains(relative_point)) 280 if (gfx::Rect(root->bounds().size()).Contains(relative_point))
292 return root->GetTopWindowContainingPoint(relative_point); 281 return root->GetTopWindowContainingPoint(relative_point);
293 } 282 }
294 return nullptr; 283 return nullptr;
295 } 284 }
296 285
297 } // namespace views 286 } // namespace views
OLDNEW
« ui/aura/mus/window_tree_client.cc ('K') | « ui/views/mus/mus_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698