Chromium Code Reviews| 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/shell/service_manager.h" | 5 #include "services/shell/service_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/debug/alias.h" | |
| 13 #include "base/guid.h" | 14 #include "base/guid.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/process/process.h" | 17 #include "base/process/process.h" |
| 17 #include "base/process/process_handle.h" | 18 #include "base/process/process_handle.h" |
| 18 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
| 19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 20 #include "base/trace_event/trace_event.h" | 21 #include "base/trace_event/trace_event.h" |
| 21 #include "mojo/public/cpp/bindings/binding.h" | 22 #include "mojo/public/cpp/bindings/binding.h" |
| 22 #include "mojo/public/cpp/bindings/binding_set.h" | 23 #include "mojo/public/cpp/bindings/binding_set.h" |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 814 // Otherwise we create a new Service pipe. | 815 // Otherwise we create a new Service pipe. |
| 815 mojom::ServiceRequest request = GetProxy(&service); | 816 mojom::ServiceRequest request = GetProxy(&service); |
| 816 CHECK(!result->package_path.empty() && result->capabilities.has_value()); | 817 CHECK(!result->package_path.empty() && result->capabilities.has_value()); |
| 817 | 818 |
| 818 if (target.name() != result->resolved_name) { | 819 if (target.name() != result->resolved_name) { |
| 819 instance->StartWithService(std::move(service)); | 820 instance->StartWithService(std::move(service)); |
| 820 Identity factory(result->resolved_name, target.user_id(), | 821 Identity factory(result->resolved_name, target.user_id(), |
| 821 instance_name); | 822 instance_name); |
| 822 CreateServiceWithFactory(factory, target.name(), std::move(request)); | 823 CreateServiceWithFactory(factory, target.name(), std::move(request)); |
| 823 } else { | 824 } else { |
| 825 Identity source_instance_identity; | |
| 826 base::debug::Alias(&has_source_instance); | |
| 827 base::FilePath package_path = result->package_path; | |
| 828 base::debug::Alias(&package_path); | |
| 829 base::debug::Alias(&source); | |
| 830 base::debug::Alias(&target); | |
| 831 if (source_instance) | |
| 832 source_instance_identity = source_instance->identity(); | |
| 833 base::debug::Alias(&source_instance_identity); | |
| 834 #if defined(GOOGLE_CHROME_BUILD) | |
| 835 // We do not currently want to hit this code path in production, but it's | |
| 836 // happening somehow. https://crbug.com/649673. | |
| 837 CHECK(false); | |
|
xhwang
2016/12/03 00:25:31
I am hitting this CHECK when running a ServiceTest
| |
| 838 #endif | |
| 824 instance->StartWithFilePath(result->package_path); | 839 instance->StartWithFilePath(result->package_path); |
| 825 } | 840 } |
| 826 } | 841 } |
| 827 | 842 |
| 828 // Now that the instance has a Service, we can connect to it. | 843 // Now that the instance has a Service, we can connect to it. |
| 829 bool connected = instance->ConnectToService(¶ms); | 844 bool connected = instance->ConnectToService(¶ms); |
| 830 DCHECK(connected); | 845 DCHECK(connected); |
| 831 } | 846 } |
| 832 | 847 |
| 833 base::WeakPtr<ServiceManager> ServiceManager::GetWeakPtr() { | 848 base::WeakPtr<ServiceManager> ServiceManager::GetWeakPtr() { |
| 834 return weak_ptr_factory_.GetWeakPtr(); | 849 return weak_ptr_factory_.GetWeakPtr(); |
| 835 } | 850 } |
| 836 | 851 |
| 837 } // namespace shell | 852 } // namespace shell |
| OLD | NEW |