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

Unified Diff: mojo/application/public/cpp/application_impl.h

Issue 1254383016: ApplicationConnection lifetime management changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: mojo/application/public/cpp/application_impl.h
diff --git a/mojo/application/public/cpp/application_impl.h b/mojo/application/public/cpp/application_impl.h
index 5d2eb45f64b5ae66a46a7c4b591db70b39835ff6..cc932d2ba13ac8fc12d5e5279cbe79753f0faf47 100644
--- a/mojo/application/public/cpp/application_impl.h
+++ b/mojo/application/public/cpp/application_impl.h
@@ -7,6 +7,7 @@
#include <vector>
+#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "mojo/application/public/cpp/app_lifetime_helper.h"
#include "mojo/application/public/cpp/application_connection.h"
@@ -84,20 +85,18 @@ class ApplicationImpl : public Application {
// call to ApplicationConnection::CloseConnection.
// TODO(beng): consider replacing default value in a separate CL per style
// guide.
- ApplicationConnection* ConnectToApplication(
+ scoped_ptr<ApplicationConnection> ConnectToApplication(
URLRequestPtr request,
CapabilityFilterPtr filter = nullptr);
- // Closes the |connection|.
- void CloseConnection(ApplicationConnection* connection);
-
// Connect to application identified by |request->url| and connect to the
// service implementation of the interface identified by |Interface|.
template <typename Interface>
void ConnectToService(mojo::URLRequestPtr request,
InterfacePtr<Interface>* ptr) {
- ApplicationConnection* connection = ConnectToApplication(request.Pass());
- if (!connection)
+ scoped_ptr<ApplicationConnection> connection =
+ ConnectToApplication(request.Pass());
+ if (!connection.get())
return;
connection->ConnectToService(ptr);
}
@@ -129,16 +128,13 @@ class ApplicationImpl : public Application {
void OnConnectionError();
- void ClearConnections();
-
// Called from Quit() when there is no Shell connection, or asynchronously
// from Quit() once the Shell has OK'ed shutdown.
void QuitNow();
- typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList;
-
- ServiceRegistryList incoming_service_registries_;
- ServiceRegistryList outgoing_service_registries_;
+ // We track the lifetime of incoming connection registries as it more
+ // convenient for the client.
+ ScopedVector<ApplicationConnection> incoming_connections_;
ApplicationDelegate* delegate_;
Binding<Application> binding_;
ShellPtr shell_;
@@ -146,7 +142,6 @@ class ApplicationImpl : public Application {
Closure termination_closure_;
AppLifetimeHelper app_lifetime_helper_;
bool quit_requested_;
- bool in_destructor_;
base::WeakPtrFactory<ApplicationImpl> weak_factory_;
MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);

Powered by Google App Engine
This is Rietveld 408576698