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

Side by Side Diff: content/child/service_factory.cc

Issue 2706383002: DO NOT SUBMIT: Show silent service manager failure (Closed)
Patch Set: Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/child/service_factory.h" 5 #include "content/child/service_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "content/common/service_manager/embedded_service_runner.h" 11 #include "content/common/service_manager/embedded_service_runner.h"
12 #include "content/public/common/content_client.h" 12 #include "content/public/common/content_client.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 ServiceFactory::ServiceFactory() {} 16 ServiceFactory::ServiceFactory() {}
17 ServiceFactory::~ServiceFactory() {} 17 ServiceFactory::~ServiceFactory() {}
18 18
19 void ServiceFactory::CreateService( 19 void ServiceFactory::CreateService(
20 service_manager::mojom::ServiceRequest request, 20 service_manager::mojom::ServiceRequest request,
21 const std::string& name) { 21 const std::string& name) {
22 LOG(INFO) << "ServiceFactory::CreateService";
22 // Only register services on first run. 23 // Only register services on first run.
23 if (!has_registered_services_) { 24 if (!has_registered_services_) {
24 DCHECK(services_.empty()); 25 DCHECK(services_.empty());
25 ServiceMap services; 26 ServiceMap services;
26 RegisterServices(&services); 27 RegisterServices(&services);
27 for (const auto& service : services) { 28 for (const auto& service : services) {
28 std::unique_ptr<EmbeddedServiceRunner> runner( 29 std::unique_ptr<EmbeddedServiceRunner> runner(
29 new EmbeddedServiceRunner(service.first, service.second)); 30 new EmbeddedServiceRunner(service.first, service.second));
30 runner->SetQuitClosure(base::Bind(&ServiceFactory::OnServiceQuit, 31 runner->SetQuitClosure(base::Bind(&ServiceFactory::OnServiceQuit,
31 base::Unretained(this))); 32 base::Unretained(this)));
32 services_.insert(std::make_pair(service.first, std::move(runner))); 33 services_.insert(std::make_pair(service.first, std::move(runner)));
33 } 34 }
34 has_registered_services_ = true; 35 has_registered_services_ = true;
35 } 36 }
36 37
37 auto it = services_.find(name); 38 auto it = services_.find(name);
38 if (it == services_.end()) { 39 if (it == services_.end()) {
39 OnLoadFailed(); 40 OnLoadFailed();
40 return; 41 return;
41 } 42 }
42 43
43 it->second->BindServiceRequest(std::move(request)); 44 it->second->BindServiceRequest(std::move(request));
44 } 45 }
45 46
46 } // namespace content 47 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698