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

Side by Side Diff: mojo/public/cpp/application/lib/service_provider_impl.cc

Issue 1973653002: Add a new way of using ServiceProviderImpl without InterfaceFactory. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: RequestHandler -> InterfaceRequestHandler Created 4 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 "mojo/public/cpp/application/service_provider_impl.h" 5 #include "mojo/public/cpp/application/service_provider_impl.h"
6 6
7 #include "mojo/public/cpp/application/service_connector.h" 7 #include "mojo/public/cpp/application/service_connector.h"
8 #include "mojo/public/cpp/environment/logging.h" 8 #include "mojo/public/cpp/environment/logging.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 11
12 ServiceProviderImpl::ServiceProviderImpl() 12 ServiceProviderImpl::ServiceProviderImpl()
13 : binding_(this), fallback_service_provider_(nullptr) { 13 : binding_(this), fallback_service_provider_(nullptr) {
14 } 14 }
15 15
16 ServiceProviderImpl::ServiceProviderImpl( 16 ServiceProviderImpl::ServiceProviderImpl(
17 InterfaceRequest<ServiceProvider> request) 17 InterfaceRequest<ServiceProvider> service_provider_request)
18 : binding_(this, request.Pass()), fallback_service_provider_(nullptr) { 18 : binding_(this, service_provider_request.Pass()),
19 } 19 fallback_service_provider_(nullptr) {}
20 20
21 ServiceProviderImpl::~ServiceProviderImpl() { 21 ServiceProviderImpl::~ServiceProviderImpl() {}
22 }
23 22
24 void ServiceProviderImpl::Bind(InterfaceRequest<ServiceProvider> request) { 23 void ServiceProviderImpl::Bind(
25 binding_.Bind(request.Pass()); 24 InterfaceRequest<ServiceProvider> service_provider_request) {
25 binding_.Bind(service_provider_request.Pass());
26 } 26 }
27 27
28 void ServiceProviderImpl::Close() { 28 void ServiceProviderImpl::Close() {
29 if (binding_.is_bound()) 29 if (binding_.is_bound())
30 binding_.Close(); 30 binding_.Close();
31 } 31 }
32 32
33 void ServiceProviderImpl::ConnectToService( 33 void ServiceProviderImpl::ConnectToService(
34 const String& service_name, 34 const String& service_name,
35 ScopedMessagePipeHandle client_handle) { 35 ScopedMessagePipeHandle client_handle) {
36 // TODO(beng): perhaps take app connection thru ctor so that we can pass 36 // TODO(beng): perhaps take app connection thru ctor so that we can pass
37 // ApplicationConnection through? 37 // ApplicationConnection through?
38 bool service_found = service_connector_registry_.ConnectToService( 38 bool service_found = service_connector_registry_.ConnectToService(
39 nullptr, service_name, &client_handle); 39 nullptr, service_name, &client_handle);
40 if (!service_found && fallback_service_provider_) { 40 if (!service_found && fallback_service_provider_) {
41 fallback_service_provider_->ConnectToService(service_name, 41 fallback_service_provider_->ConnectToService(service_name,
42 client_handle.Pass()); 42 client_handle.Pass());
43 } 43 }
44 } 44 }
45 45
46 } // namespace mojo 46 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/application/application_connection.h ('k') | mojo/public/cpp/application/lib/service_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698