Index: services/ui/service.cc |
diff --git a/services/ui/service.cc b/services/ui/service.cc |
index 052731b0d357d79c68379fe8b4287917884e4bcc..b963b3590315e083e4ed9f3b2fabe97d56c6f99e 100644 |
--- a/services/ui/service.cc |
+++ b/services/ui/service.cc |
@@ -91,8 +91,10 @@ struct Service::UserState { |
std::unique_ptr<ws::WindowTreeHostFactory> window_tree_host_factory; |
}; |
-Service::Service() |
- : test_config_(false), |
+Service::Service(scoped_refptr<base::SingleThreadTaskRunner> resource_runner) |
+ : resource_runner_(resource_runner), |
+ /*in_process_(resource_runner != nullptr),*/ |
+ test_config_(false), |
ime_registrar_(&ime_server_) {} |
Service::~Service() { |
@@ -158,11 +160,14 @@ void Service::AddUserIfNecessary( |
} |
void Service::OnStart() { |
- base::PlatformThread::SetName("mus"); |
+ if (!in_process()) |
+ base::PlatformThread::SetName("mus"); |
+ |
TRACE_EVENT0("mus", "Service::Initialize started"); |
test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kUseTestConfig); |
+ |
#if defined(USE_X11) |
XInitThreads(); |
ui::SetDefaultX11ErrorHandlers(); |
@@ -190,9 +195,13 @@ void Service::OnStart() { |
// Assume a client will change the layout to an appropriate configuration. |
ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine() |
->SetCurrentLayoutByName("us"); |
- client_native_pixmap_factory_ = ui::CreateClientNativePixmapFactoryOzone(); |
- gfx::ClientNativePixmapFactory::SetInstance( |
- client_native_pixmap_factory_.get()); |
+ |
+ // TODO: Ok? |
+ if (!in_process()) { |
+ client_native_pixmap_factory_ = ui::CreateClientNativePixmapFactoryOzone(); |
+ gfx::ClientNativePixmapFactory::SetInstance( |
+ client_native_pixmap_factory_.get()); |
+ } |
DCHECK(gfx::ClientNativePixmapFactory::GetInstance()); |
@@ -214,7 +223,7 @@ void Service::OnStart() { |
// so keep this line below both of those. |
input_device_server_.RegisterAsObserver(); |
- window_server_.reset(new ws::WindowServer(this)); |
+ window_server_.reset(new ws::WindowServer(this, resource_runner_)); |
std::unique_ptr<ws::GpuHost> gpu_host = |
base::MakeUnique<ws::DefaultGpuHost>(window_server_.get()); |
std::unique_ptr<ws::FrameSinkManagerClientBinding> frame_sink_manager = |
@@ -325,7 +334,8 @@ void Service::OnWillCreateTreeForWindowManager( |
if (window_server_->display_creation_config() == |
ws::DisplayCreationConfig::MANUAL) { |
#if defined(USE_OZONE) && defined(OS_CHROMEOS) |
- screen_manager_ = base::MakeUnique<display::ScreenManagerForwarding>(); |
+ screen_manager_ = |
+ base::MakeUnique<display::ScreenManagerForwarding>(in_process()); |
#else |
CHECK(false); |
#endif |