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

Unified Diff: ash/mus/window_manager_application.cc

Issue 2741063002: Setup DiscardableMemory in the ash process (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/window_manager_application.cc
diff --git a/ash/mus/window_manager_application.cc b/ash/mus/window_manager_application.cc
index c3dbcf58f3767b43a26762b77312395bebfe22a1..0d6af99f348feadc1f257d880cd9899e88be7619 100644
--- a/ash/mus/window_manager_application.cc
+++ b/ash/mus/window_manager_application.cc
@@ -20,6 +20,7 @@
#include "chromeos/network/network_connect.h"
#include "chromeos/network/network_handler.h"
#include "chromeos/system/fake_statistics_provider.h"
+#include "components/discardable_memory/client/client_discardable_shared_memory_manager.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "services/service_manager/public/cpp/connection.h"
@@ -27,6 +28,7 @@
#include "services/service_manager/public/cpp/service_context.h"
#include "services/tracing/public/cpp/provider.h"
#include "services/ui/common/accelerator_util.h"
+#include "services/ui/public/interfaces/constants.mojom.h"
#include "ui/aura/env.h"
#include "ui/aura/mus/window_tree_client.h"
#include "ui/events/event.h"
@@ -107,17 +109,31 @@ void WindowManagerApplication::ShutdownComponents() {
}
void WindowManagerApplication::OnStart() {
+ 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));
+ auto io_task_runner = io_thread_->task_runner();
aura_init_ = base::MakeUnique<views::AuraInit>(
context()->connector(), context()->identity(), "ash_mus_resources.pak",
- "ash_mus_resources_200.pak", nullptr,
+ "ash_mus_resources_200.pak", io_task_runner,
James Cook 2017/03/09 21:00:21 Can you add a comment somewhere (maybe in the Aura
views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER);
window_manager_.reset(new WindowManager(context()->connector()));
+ discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr;
James Cook 2017/03/09 21:00:21 This block of code seems like it should live down
Peng 2017/03/09 21:35:43 +sky, for his opinion.
+ context()->connector()->BindInterface(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());
+
tracing_.Initialize(context()->connector(), context()->identity().name());
std::unique_ptr<aura::WindowTreeClient> window_tree_client =
base::MakeUnique<aura::WindowTreeClient>(
- context()->connector(), window_manager_.get(), window_manager_.get());
+ context()->connector(), window_manager_.get(), window_manager_.get(),
+ nullptr, io_task_runner);
window_tree_client->ConnectAsWindowManager();
const size_t kMaxNumberThreads = 3u; // Matches that of content.
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698