| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/ui/service.h" | 5 #include "services/ui/service.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 std::unique_ptr<mojom::DisplayManagerRequest> dm_request; | 73 std::unique_ptr<mojom::DisplayManagerRequest> dm_request; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 struct Service::UserState { | 76 struct Service::UserState { |
| 77 std::unique_ptr<clipboard::ClipboardImpl> clipboard; | 77 std::unique_ptr<clipboard::ClipboardImpl> clipboard; |
| 78 std::unique_ptr<ws::WindowTreeHostFactory> window_tree_host_factory; | 78 std::unique_ptr<ws::WindowTreeHostFactory> window_tree_host_factory; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 Service::Service() | 81 Service::Service() |
| 82 : test_config_(false), | 82 : test_config_(false), |
| 83 // TODO(penghuang): Kludge: Use mojo command buffer when running on | |
| 84 // Windows since chrome command buffer breaks unit tests | |
| 85 #if defined(OS_WIN) | |
| 86 use_chrome_gpu_command_buffer_(false), | |
| 87 #else | |
| 88 use_chrome_gpu_command_buffer_(true), | 83 use_chrome_gpu_command_buffer_(true), |
| 89 #endif | |
| 90 platform_screen_(display::PlatformScreen::Create()), | 84 platform_screen_(display::PlatformScreen::Create()), |
| 91 weak_ptr_factory_(this) { | 85 weak_ptr_factory_(this) { |
| 92 } | 86 } |
| 93 | 87 |
| 94 Service::~Service() { | 88 Service::~Service() { |
| 95 // Destroy |window_server_| first, since it depends on |event_source_|. | 89 // Destroy |window_server_| first, since it depends on |event_source_|. |
| 96 // WindowServer (or more correctly its Displays) may have state that needs to | 90 // WindowServer (or more correctly its Displays) may have state that needs to |
| 97 // be destroyed before GpuState as well. | 91 // be destroyed before GpuState as well. |
| 98 window_server_.reset(); | 92 window_server_.reset(); |
| 99 | 93 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const shell::Identity& identity, | 140 const shell::Identity& identity, |
| 147 uint32_t id) { | 141 uint32_t id) { |
| 148 platform_display_init_params_.surfaces_state = new SurfacesState; | 142 platform_display_init_params_.surfaces_state = new SurfacesState; |
| 149 | 143 |
| 150 base::PlatformThread::SetName("mus"); | 144 base::PlatformThread::SetName("mus"); |
| 151 tracing_.Initialize(connector, identity.name()); | 145 tracing_.Initialize(connector, identity.name()); |
| 152 TRACE_EVENT0("mus", "Service::Initialize started"); | 146 TRACE_EVENT0("mus", "Service::Initialize started"); |
| 153 | 147 |
| 154 test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch( | 148 test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 155 switches::kUseTestConfig); | 149 switches::kUseTestConfig); |
| 156 // TODO(penghuang): Kludge: use mojo command buffer when running on Windows | |
| 157 // since Chrome command buffer breaks unit tests | |
| 158 #if defined(OS_WIN) | |
| 159 use_chrome_gpu_command_buffer_ = false; | |
| 160 #else | |
| 161 use_chrome_gpu_command_buffer_ = | 150 use_chrome_gpu_command_buffer_ = |
| 162 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 151 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 163 switches::kUseMojoGpuCommandBufferInMus); | 152 switches::kUseMojoGpuCommandBufferInMus); |
| 164 #endif | |
| 165 #if defined(USE_X11) | 153 #if defined(USE_X11) |
| 166 XInitThreads(); | 154 XInitThreads(); |
| 167 if (test_config_) | 155 if (test_config_) |
| 168 ui::test::SetUseOverrideRedirectWindowByDefault(true); | 156 ui::test::SetUseOverrideRedirectWindowByDefault(true); |
| 169 #endif | 157 #endif |
| 170 | 158 |
| 171 InitializeResources(connector); | 159 InitializeResources(connector); |
| 172 | 160 |
| 173 #if defined(USE_OZONE) | 161 #if defined(USE_OZONE) |
| 174 // The ozone platform can provide its own event source. So initialize the | 162 // The ozone platform can provide its own event source. So initialize the |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // Display manages its own lifetime. | 368 // Display manages its own lifetime. |
| 381 ws::Display* host_impl = | 369 ws::Display* host_impl = |
| 382 new ws::Display(window_server_.get(), platform_display_init_params_); | 370 new ws::Display(window_server_.get(), platform_display_init_params_); |
| 383 host_impl->Init(nullptr); | 371 host_impl->Init(nullptr); |
| 384 | 372 |
| 385 if (touch_controller_) | 373 if (touch_controller_) |
| 386 touch_controller_->UpdateTouchTransforms(); | 374 touch_controller_->UpdateTouchTransforms(); |
| 387 } | 375 } |
| 388 | 376 |
| 389 } // namespace ui | 377 } // namespace ui |
| OLD | NEW |