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

Side by Side Diff: services/service_manager/public/cpp/lib/service_context.cc

Issue 2850743004: Replace ServiceInfo with BindSourceInfo. (Closed)
Patch Set: . Created 3 years, 7 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/public/cpp/service_context.h" 5 #include "services/service_manager/public/cpp/service_context.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 binding_.Close(); 66 binding_.Close();
67 if (!quit_closure_.is_null()) { 67 if (!quit_closure_.is_null()) {
68 // CAUTION: May delete |this|. 68 // CAUTION: May delete |this|.
69 base::ResetAndReturn(&quit_closure_).Run(); 69 base::ResetAndReturn(&quit_closure_).Run();
70 } 70 }
71 } 71 }
72 72
73 //////////////////////////////////////////////////////////////////////////////// 73 ////////////////////////////////////////////////////////////////////////////////
74 // ServiceContext, mojom::Service implementation: 74 // ServiceContext, mojom::Service implementation:
75 75
76 void ServiceContext::OnStart(const ServiceInfo& info, 76 void ServiceContext::OnStart(const Identity& identity,
77 const OnStartCallback& callback) { 77 const OnStartCallback& callback) {
78 local_info_ = info; 78 identity_ = identity;
79 callback.Run(std::move(pending_connector_request_), 79 callback.Run(std::move(pending_connector_request_),
80 mojo::MakeRequest(&service_control_)); 80 mojo::MakeRequest(&service_control_));
81 service_->OnStart(); 81 service_->OnStart();
82 } 82 }
83 83
84 void ServiceContext::OnBindInterface( 84 void ServiceContext::OnBindInterface(
85 const ServiceInfo& source_info, 85 const BindSourceInfo& source_info,
86 const std::string& interface_name, 86 const std::string& interface_name,
87 mojo::ScopedMessagePipeHandle interface_pipe, 87 mojo::ScopedMessagePipeHandle interface_pipe,
88 const OnBindInterfaceCallback& callback) { 88 const OnBindInterfaceCallback& callback) {
89 // Acknowledge the request regardless of whether it's accepted. 89 // Acknowledge the request regardless of whether it's accepted.
90 callback.Run(); 90 callback.Run();
91 91
92 service_->OnBindInterface(source_info, interface_name, 92 service_->OnBindInterface(source_info, interface_name,
93 std::move(interface_pipe)); 93 std::move(interface_pipe));
94 } 94 }
95 95
96 //////////////////////////////////////////////////////////////////////////////// 96 ////////////////////////////////////////////////////////////////////////////////
97 // ServiceContext, private: 97 // ServiceContext, private:
98 98
99 void ServiceContext::OnConnectionError() { 99 void ServiceContext::OnConnectionError() {
100 if (service_->OnServiceManagerConnectionLost()) { 100 if (service_->OnServiceManagerConnectionLost()) {
101 // CAUTION: May delete |this|. 101 // CAUTION: May delete |this|.
102 QuitNow(); 102 QuitNow();
103 } 103 }
104 } 104 }
105 105
106 } // namespace service_manager 106 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/lib/service.cc ('k') | services/service_manager/public/cpp/lib/service_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698