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