Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: services/service_manager/service_manager.cc

Issue 2573283002: Use a static catalog manifest for the standalone Mash runner (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/service_manager/service_manager.h" 5 #include "services/service_manager/service_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 return; 665 return;
666 666
667 // The catalog needs to see the source identity as that of the originating 667 // The catalog needs to see the source identity as that of the originating
668 // app so it loads the correct store. Since the catalog is itself run as root 668 // app so it loads the correct store. Since the catalog is itself run as root
669 // when this re-enters Connect() it'll be handled by 669 // when this re-enters Connect() it'll be handled by
670 // ConnectToExistingInstance(). 670 // ConnectToExistingInstance().
671 mojom::Resolver* resolver = GetResolver(Identity( 671 mojom::Resolver* resolver = GetResolver(Identity(
672 service_manager::mojom::kServiceName, params->target().user_id())); 672 service_manager::mojom::kServiceName, params->target().user_id()));
673 673
674 std::string name = params->target().name(); 674 std::string name = params->target().name();
675 resolver->ResolveMojoName( 675 resolver->ResolveServiceName(
676 name, 676 name,
677 base::Bind(&service_manager::ServiceManager::OnGotResolvedName, 677 base::Bind(&service_manager::ServiceManager::OnGotResolvedName,
678 weak_ptr_factory_.GetWeakPtr(), base::Passed(&params), 678 weak_ptr_factory_.GetWeakPtr(), base::Passed(&params),
679 base::Passed(&service), !!source_instance, source_instance)); 679 base::Passed(&service), !!source_instance, source_instance));
680 } 680 }
681 681
682 ServiceManager::Instance* ServiceManager::GetExistingInstance( 682 ServiceManager::Instance* ServiceManager::GetExistingInstance(
683 const Identity& identity) const { 683 const Identity& identity) const {
684 const auto& it = identity_to_instance_.find(identity); 684 const auto& it = identity_to_instance_.find(identity);
685 Instance* instance = it != identity_to_instance_.end() ? it->second : nullptr; 685 Instance* instance = it != identity_to_instance_.end() ? it->second : nullptr;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 void ServiceManager::OnGotResolvedName(std::unique_ptr<ConnectParams> params, 813 void ServiceManager::OnGotResolvedName(std::unique_ptr<ConnectParams> params,
814 mojom::ServicePtr service, 814 mojom::ServicePtr service,
815 bool has_source_instance, 815 bool has_source_instance,
816 base::WeakPtr<Instance> source_instance, 816 base::WeakPtr<Instance> source_instance,
817 mojom::ResolveResultPtr result) { 817 mojom::ResolveResultPtr result) {
818 // If this request was originated by a specific Instance and that Instance is 818 // If this request was originated by a specific Instance and that Instance is
819 // no longer around, we ignore this response. 819 // no longer around, we ignore this response.
820 if (has_source_instance && !source_instance) 820 if (has_source_instance && !source_instance)
821 return; 821 return;
822 822
823 // If name resolution failed, we drop the connection.
824 if (!result) {
825 LOG(ERROR) << "Failed to resolve service name: " << params->target().name();
826 if (!params->connect_callback().is_null()) {
827 params->connect_callback().Run(
828 mojom::ConnectResult::INVALID_ARGUMENT, "");
829 }
830 return;
831 }
832
823 std::string instance_name = params->target().instance(); 833 std::string instance_name = params->target().instance();
824 if (instance_name == params->target().name() && 834 if (instance_name == params->target().name() &&
825 result->qualifier != result->resolved_name) { 835 result->qualifier != result->resolved_name) {
826 instance_name = result->qualifier; 836 instance_name = result->qualifier;
827 } 837 }
828 // |result->interface_provider_specs| can be empty when there is no manifest, 838 // |result->interface_provider_specs| can be empty when there is no manifest,
829 // e.g. for URL types not resolvable by the resolver. 839 // e.g. for URL types not resolvable by the resolver.
830 InterfaceProviderSpec connection_spec = GetPermissiveInterfaceProviderSpec(); 840 InterfaceProviderSpec connection_spec = GetPermissiveInterfaceProviderSpec();
831 auto it = result->interface_provider_specs.find( 841 auto it = result->interface_provider_specs.find(
832 mojom::kServiceManager_ConnectorSpec); 842 mojom::kServiceManager_ConnectorSpec);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 // Now that the instance has a Service, we can connect to it. 951 // Now that the instance has a Service, we can connect to it.
942 bool connected = instance->ConnectToService(&params); 952 bool connected = instance->ConnectToService(&params);
943 DCHECK(connected); 953 DCHECK(connected);
944 } 954 }
945 955
946 base::WeakPtr<ServiceManager> ServiceManager::GetWeakPtr() { 956 base::WeakPtr<ServiceManager> ServiceManager::GetWeakPtr() {
947 return weak_ptr_factory_.GetWeakPtr(); 957 return weak_ptr_factory_.GetWeakPtr();
948 } 958 }
949 959
950 } // namespace service_manager 960 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/runner/host/service_process_launcher.cc ('k') | services/service_manager/service_overrides.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698