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/interface_registry.h" | 23 #include "services/service_manager/public/cpp/interface_registry.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 for (auto& request : requests) { | 246 for (auto& request : requests) { |
246 if (request->wtf_request) | 247 if (request->wtf_request) |
247 Create(request->remote_identity, std::move(*request->wtf_request)); | 248 Create(request->remote_identity, std::move(*request->wtf_request)); |
248 else | 249 else |
249 Create(request->remote_identity, std::move(*request->dm_request)); | 250 Create(request->remote_identity, std::move(*request->dm_request)); |
250 } | 251 } |
251 } | 252 } |
252 | 253 |
253 void Service::OnNoMoreDisplays() { | 254 void Service::OnNoMoreDisplays() { |
254 // We may get here from the destructor, in which case there is no messageloop. | 255 // We may get here from the destructor, in which case there is no messageloop. |
255 if (base::MessageLoop::current() && | 256 if (base::RunLoop::IsRunningOnCurrentThread()) |
256 base::MessageLoop::current()->is_running()) { | |
257 base::MessageLoop::current()->QuitWhenIdle(); | 257 base::MessageLoop::current()->QuitWhenIdle(); |
258 } | |
259 } | 258 } |
260 | 259 |
261 bool Service::IsTestConfig() const { | 260 bool Service::IsTestConfig() const { |
262 return test_config_; | 261 return test_config_; |
263 } | 262 } |
264 | 263 |
265 void Service::OnWillCreateTreeForWindowManager( | 264 void Service::OnWillCreateTreeForWindowManager( |
266 bool automatically_create_display_roots) { | 265 bool automatically_create_display_roots) { |
267 if (screen_manager_config_ != ScreenManagerConfig::UNKNOWN) | 266 if (screen_manager_config_ != ScreenManagerConfig::UNKNOWN) |
268 return; | 267 return; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 mojom::WindowServerTestRequest request) { | 393 mojom::WindowServerTestRequest request) { |
395 if (!test_config_) | 394 if (!test_config_) |
396 return; | 395 return; |
397 mojo::MakeStrongBinding( | 396 mojo::MakeStrongBinding( |
398 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), | 397 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), |
399 std::move(request)); | 398 std::move(request)); |
400 } | 399 } |
401 | 400 |
402 | 401 |
403 } // namespace ui | 402 } // namespace ui |
OLD | NEW |