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

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

Issue 1977023003: ApplicationConnection devolution, part 4 (the end). (Closed) Base URL: https://github.com/domokit/mojo.git@work790_app_conn_devo_3.1
Patch Set: 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/application_impl.h" 5 #include "mojo/public/cpp/application/application_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "mojo/public/cpp/application/application_delegate.h" 9 #include "mojo/public/cpp/application/application_delegate.h"
10 #include "mojo/public/cpp/application/connection_context.h" 10 #include "mojo/public/cpp/application/connection_context.h"
11 #include "mojo/public/cpp/application/lib/service_registry.h" 11 #include "mojo/public/cpp/application/service_provider_impl.h"
12 #include "mojo/public/cpp/bindings/interface_ptr.h" 12 #include "mojo/public/cpp/bindings/interface_ptr.h"
13 #include "mojo/public/cpp/bindings/interface_request.h" 13 #include "mojo/public/cpp/bindings/interface_request.h"
14 #include "mojo/public/cpp/environment/logging.h" 14 #include "mojo/public/cpp/environment/logging.h"
15 #include "mojo/public/cpp/system/message_pipe.h" 15 #include "mojo/public/cpp/system/message_pipe.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 18
19 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, 19 ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
20 InterfaceRequest<Application> request) 20 InterfaceRequest<Application> request)
21 : delegate_(delegate), binding_(this, request.Pass()) {} 21 : delegate_(delegate), binding_(this, request.Pass()) {}
(...skipping 23 matching lines...) Expand all
45 *application_request = binding_.Unbind(); 45 *application_request = binding_.Unbind();
46 shell->Bind(shell_.PassInterfaceHandle()); 46 shell->Bind(shell_.PassInterfaceHandle());
47 } 47 }
48 48
49 void ApplicationImpl::Initialize(InterfaceHandle<Shell> shell, 49 void ApplicationImpl::Initialize(InterfaceHandle<Shell> shell,
50 Array<String> args, 50 Array<String> args,
51 const mojo::String& url) { 51 const mojo::String& url) {
52 shell_ = ShellPtr::Create(std::move(shell)); 52 shell_ = ShellPtr::Create(std::move(shell));
53 shell_.set_connection_error_handler([this]() { 53 shell_.set_connection_error_handler([this]() {
54 delegate_->Quit(); 54 delegate_->Quit();
55 incoming_service_registries_.clear(); 55 service_provider_impls_.clear();
56 Terminate(); 56 Terminate();
57 }); 57 });
58 url_ = url; 58 url_ = url;
59 args_ = args.To<std::vector<std::string>>(); 59 args_ = args.To<std::vector<std::string>>();
60 delegate_->Initialize(this); 60 delegate_->Initialize(this);
61 } 61 }
62 62
63 void ApplicationImpl::AcceptConnection( 63 void ApplicationImpl::AcceptConnection(
64 const String& requestor_url, 64 const String& requestor_url,
65 InterfaceRequest<ServiceProvider> services, 65 InterfaceRequest<ServiceProvider> services,
66 InterfaceHandle<ServiceProvider> exposed_services, 66 InterfaceHandle<ServiceProvider> exposed_services,
67 const String& url) { 67 const String& url) {
68 // Note: The shell no longer actually connects |exposed_services|, so a) we 68 // Note: The shell no longer actually connects |exposed_services|, so a) we
69 // never actually get valid |exposed_services| here, b) it should be OK to 69 // never actually get valid |exposed_services| here, b) it should be OK to
70 // drop it on the floor. 70 // drop it on the floor.
71 MOJO_LOG_IF(ERROR, exposed_services) 71 MOJO_LOG_IF(ERROR, exposed_services)
72 << "DEPRECATED: exposed_services is going away"; 72 << "DEPRECATED: exposed_services is going away";
73 std::unique_ptr<internal::ServiceRegistry> registry( 73 std::unique_ptr<ServiceProviderImpl> service_provider_impl(
74 new internal::ServiceRegistry( 74 new ServiceProviderImpl(
75 ConnectionContext(ConnectionContext::Type::INCOMING, requestor_url, 75 ConnectionContext(ConnectionContext::Type::INCOMING, requestor_url,
76 url), 76 url),
77 services.Pass())); 77 services.Pass()));
78 if (!delegate_->ConfigureIncomingConnection( 78 if (!delegate_->ConfigureIncomingConnection(service_provider_impl.get()))
79 &registry->GetServiceProviderImpl()))
80 return; 79 return;
81 incoming_service_registries_.push_back(std::move(registry)); 80 service_provider_impls_.push_back(std::move(service_provider_impl));
82 } 81 }
83 82
84 void ApplicationImpl::RequestQuit() { 83 void ApplicationImpl::RequestQuit() {
85 delegate_->Quit(); 84 delegate_->Quit();
86 Terminate(); 85 Terminate();
87 } 86 }
88 87
89 } // namespace mojo 88 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698