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" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/run_loop.h" |
13 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
14 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "components/discardable_memory/service/discardable_shared_memory_manage
r.h" | 17 #include "components/discardable_memory/service/discardable_shared_memory_manage
r.h" |
17 #include "mojo/public/cpp/bindings/strong_binding.h" | 18 #include "mojo/public/cpp/bindings/strong_binding.h" |
18 #include "services/catalog/public/cpp/resource_loader.h" | 19 #include "services/catalog/public/cpp/resource_loader.h" |
19 #include "services/catalog/public/interfaces/constants.mojom.h" | 20 #include "services/catalog/public/interfaces/constants.mojom.h" |
20 #include "services/service_manager/public/c/main.h" | 21 #include "services/service_manager/public/c/main.h" |
21 #include "services/service_manager/public/cpp/connector.h" | 22 #include "services/service_manager/public/cpp/connector.h" |
22 #include "services/service_manager/public/cpp/service_context.h" | 23 #include "services/service_manager/public/cpp/service_context.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 std::move(*request->wtf_request)); | 262 std::move(*request->wtf_request)); |
262 } else { | 263 } else { |
263 BindDisplayManagerRequest(request->source_info, | 264 BindDisplayManagerRequest(request->source_info, |
264 std::move(*request->dm_request)); | 265 std::move(*request->dm_request)); |
265 } | 266 } |
266 } | 267 } |
267 } | 268 } |
268 | 269 |
269 void Service::OnNoMoreDisplays() { | 270 void Service::OnNoMoreDisplays() { |
270 // We may get here from the destructor, in which case there is no messageloop. | 271 // We may get here from the destructor, in which case there is no messageloop. |
271 if (base::MessageLoop::current() && | 272 if (base::RunLoop::IsRunningOnCurrentThread()) |
272 base::MessageLoop::current()->is_running()) { | |
273 base::MessageLoop::current()->QuitWhenIdle(); | 273 base::MessageLoop::current()->QuitWhenIdle(); |
274 } | |
275 } | 274 } |
276 | 275 |
277 bool Service::IsTestConfig() const { | 276 bool Service::IsTestConfig() const { |
278 return test_config_; | 277 return test_config_; |
279 } | 278 } |
280 | 279 |
281 void Service::OnWillCreateTreeForWindowManager( | 280 void Service::OnWillCreateTreeForWindowManager( |
282 bool automatically_create_display_roots) { | 281 bool automatically_create_display_roots) { |
283 if (screen_manager_config_ != ScreenManagerConfig::UNKNOWN) | 282 if (screen_manager_config_ != ScreenManagerConfig::UNKNOWN) |
284 return; | 283 return; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 mojom::WindowServerTestRequest request) { | 421 mojom::WindowServerTestRequest request) { |
423 if (!test_config_) | 422 if (!test_config_) |
424 return; | 423 return; |
425 mojo::MakeStrongBinding( | 424 mojo::MakeStrongBinding( |
426 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), | 425 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), |
427 std::move(request)); | 426 std::move(request)); |
428 } | 427 } |
429 | 428 |
430 | 429 |
431 } // namespace ui | 430 } // namespace ui |
OLD | NEW |