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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 for (auto& request : requests) { | 245 for (auto& request : requests) { |
245 if (request->wtf_request) | 246 if (request->wtf_request) |
246 Create(request->remote_identity, std::move(*request->wtf_request)); | 247 Create(request->remote_identity, std::move(*request->wtf_request)); |
247 else | 248 else |
248 Create(request->remote_identity, std::move(*request->dm_request)); | 249 Create(request->remote_identity, std::move(*request->dm_request)); |
249 } | 250 } |
250 } | 251 } |
251 | 252 |
252 void Service::OnNoMoreDisplays() { | 253 void Service::OnNoMoreDisplays() { |
253 // We may get here from the destructor, in which case there is no messageloop. | 254 // We may get here from the destructor, in which case there is no messageloop. |
254 if (base::MessageLoop::current() && | 255 if (base::RunLoop::IsRunningOnCurrentThread()) |
255 base::MessageLoop::current()->is_running()) { | |
256 base::MessageLoop::current()->QuitWhenIdle(); | 256 base::MessageLoop::current()->QuitWhenIdle(); |
257 } | |
258 } | 257 } |
259 | 258 |
260 bool Service::IsTestConfig() const { | 259 bool Service::IsTestConfig() const { |
261 return test_config_; | 260 return test_config_; |
262 } | 261 } |
263 | 262 |
264 void Service::Create(const service_manager::Identity& remote_identity, | 263 void Service::Create(const service_manager::Identity& remote_identity, |
265 mojom::AccessibilityManagerRequest request) { | 264 mojom::AccessibilityManagerRequest request) { |
266 UserState* user_state = GetUserState(remote_identity); | 265 UserState* user_state = GetUserState(remote_identity); |
267 if (!user_state->accessibility) { | 266 if (!user_state->accessibility) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 mojom::WindowServerTestRequest request) { | 368 mojom::WindowServerTestRequest request) { |
370 if (!test_config_) | 369 if (!test_config_) |
371 return; | 370 return; |
372 mojo::MakeStrongBinding( | 371 mojo::MakeStrongBinding( |
373 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), | 372 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), |
374 std::move(request)); | 373 std::move(request)); |
375 } | 374 } |
376 | 375 |
377 | 376 |
378 } // namespace ui | 377 } // namespace ui |
OLD | NEW |