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

Side by Side Diff: mojo/application/public/cpp/application_impl.h

Issue 1195003002: Mandoline: Introduce ApplicationConnection::CloseConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 5 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 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // the ApplicationImpl is destroyed. 72 // the ApplicationImpl is destroyed.
73 Shell* shell() const { return shell_.get(); } 73 Shell* shell() const { return shell_.get(); }
74 74
75 const std::string& url() const { return url_; } 75 const std::string& url() const { return url_; }
76 76
77 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; } 77 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; }
78 78
79 // Requests a new connection to an application. Returns a pointer to the 79 // Requests a new connection to an application. Returns a pointer to the
80 // connection if the connection is permitted by this application's delegate, 80 // connection if the connection is permitted by this application's delegate,
81 // or nullptr otherwise. Caller does not take ownership. The pointer remains 81 // or nullptr otherwise. Caller does not take ownership. The pointer remains
82 // valid until an error occurs on the connection with the Shell, or until the 82 // valid until an error occurs on the connection with the Shell, until the
83 // ApplicationImpl is destroyed, whichever occurs first. 83 // ApplicationImpl is destroyed, or until the connection is closed through a
84 // call to ApplicationConnection::CloseConnection.
84 ApplicationConnection* ConnectToApplication(mojo::URLRequestPtr request); 85 ApplicationConnection* ConnectToApplication(mojo::URLRequestPtr request);
85 86
87 // Closes the |connection|.
88 void CloseConnection(ApplicationConnection* connection);
89
86 // Connect to application identified by |request->url| and connect to the 90 // Connect to application identified by |request->url| and connect to the
87 // service implementation of the interface identified by |Interface|. 91 // service implementation of the interface identified by |Interface|.
88 template <typename Interface> 92 template <typename Interface>
89 void ConnectToService(mojo::URLRequestPtr request, 93 void ConnectToService(mojo::URLRequestPtr request,
90 InterfacePtr<Interface>* ptr) { 94 InterfacePtr<Interface>* ptr) {
91 ConnectToApplication(request.Pass())->ConnectToService(ptr); 95 ConnectToApplication(request.Pass())->ConnectToService(ptr);
92 } 96 }
93 97
94 // Application implementation. 98 // Application implementation.
95 void Initialize(ShellPtr shell, const mojo::String& url) override; 99 void Initialize(ShellPtr shell, const mojo::String& url) override;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 131
128 ServiceRegistryList incoming_service_registries_; 132 ServiceRegistryList incoming_service_registries_;
129 ServiceRegistryList outgoing_service_registries_; 133 ServiceRegistryList outgoing_service_registries_;
130 ApplicationDelegate* delegate_; 134 ApplicationDelegate* delegate_;
131 Binding<Application> binding_; 135 Binding<Application> binding_;
132 ShellPtr shell_; 136 ShellPtr shell_;
133 std::string url_; 137 std::string url_;
134 base::Closure termination_closure_; 138 base::Closure termination_closure_;
135 AppLifetimeHelper app_lifetime_helper_; 139 AppLifetimeHelper app_lifetime_helper_;
136 bool quit_requested_; 140 bool quit_requested_;
141 bool in_destructor_;
137 base::WeakPtrFactory<ApplicationImpl> weak_factory_; 142 base::WeakPtrFactory<ApplicationImpl> weak_factory_;
138 143
139 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); 144 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
140 }; 145 };
141 146
142 } // namespace mojo 147 } // namespace mojo
143 148
144 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 149 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698