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

Unified Diff: ui/views/mus/mus_client.cc

Issue 2548423002: Hosting the discardable memory service in the mus process (Closed)
Patch Set: Update Created 4 years 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 side-by-side diff with in-line comments
Download patch
« services/ui/service.cc ('K') | « ui/views/mus/mus_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/mus_client.cc
diff --git a/ui/views/mus/mus_client.cc b/ui/views/mus/mus_client.cc
index 93b437ed81f00f1888b8102e2a0290c9ad76d3fa..e641d31482f4301401172507a6135688414119b3 100644
--- a/ui/views/mus/mus_client.cc
+++ b/ui/views/mus/mus_client.cc
@@ -6,10 +6,13 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
+#include "base/threading/thread.h"
+#include "components/discardable_memory/client/client_discardable_shared_memory_manager.h"
#include "services/service_manager/public/cpp/connection.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/ui/public/cpp/gpu/gpu_service.h"
#include "services/ui/public/cpp/property_type_converters.h"
+#include "services/ui/public/interfaces/constants.mojom.h"
#include "services/ui/public/interfaces/event_matcher.mojom.h"
#include "services/ui/public/interfaces/window_manager.mojom.h"
#include "ui/aura/env.h"
@@ -174,11 +177,29 @@ MusClient::MusClient(service_manager::Connector* connector,
: identity_(identity) {
DCHECK(!instance_);
instance_ = this;
+
+ if (!io_task_runner) {
dcheng 2016/12/16 09:13:01 Random thought: I looked through all the callsites
Peng 2016/12/16 15:03:10 Good suggestion. I will make a separate CL for it.
+ io_thread_ = base::MakeUnique<base::Thread>("IOThread");
+ base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
+ thread_options.priority = base::ThreadPriority::NORMAL;
+ CHECK(io_thread_->StartWithOptions(thread_options));
+ io_task_runner = io_thread_->task_runner();
+ }
+
// TODO(msw): Avoid this... use some default value? Allow clients to extend?
property_converter_ = base::MakeUnique<aura::PropertyConverter>();
wm_state_ = base::MakeUnique<wm::WMState>();
+ discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr;
+ connector->ConnectToInterface(ui::mojom::kServiceName, &manager_ptr);
+
+ discardable_shared_memory_manager_ = base::MakeUnique<
+ discardable_memory::ClientDiscardableSharedMemoryManager>(
+ std::move(manager_ptr), io_task_runner);
+ base::DiscardableMemoryAllocator::SetInstance(
+ discardable_shared_memory_manager_.get());
+
gpu_service_ = ui::GpuService::Create(connector, std::move(io_task_runner));
compositor_context_factory_ =
base::MakeUnique<aura::MusContextFactory>(gpu_service_.get());
« services/ui/service.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