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