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

Unified Diff: mojo/application/public/cpp/lib/service_registry.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/lib/service_registry.h
diff --git a/mojo/application/public/cpp/lib/service_registry.h b/mojo/application/public/cpp/lib/service_registry.h
index c34ecede1b8f2654efcf5049d419f9585a908b90..7e4d604d6861e0981780d476679e839309737264 100644
--- a/mojo/application/public/cpp/lib/service_registry.h
+++ b/mojo/application/public/cpp/lib/service_registry.h
@@ -13,10 +13,6 @@
#include "mojo/application/public/interfaces/service_provider.mojom.h"
namespace mojo {
-
-class Application;
-class ApplicationImpl;
-
namespace internal {
// A ServiceRegistry represents each half of a connection between two
@@ -28,12 +24,12 @@ class ServiceRegistry : public ServiceProvider, public ApplicationConnection {
// |allowed_interfaces| are the set of interfaces that the shell has allowed
// an application to expose to another application. If this set contains only
// the string value "*" all interfaces may be exposed.
- ServiceRegistry(ApplicationImpl* application_impl,
- const std::string& connection_url,
+ ServiceRegistry(const std::string& connection_url,
const std::string& remote_url,
ServiceProviderPtr remote_services,
InterfaceRequest<ServiceProvider> local_services,
const std::set<std::string>& allowed_interfaces);
+ ~ServiceRegistry() override;
// ApplicationConnection overrides.
void SetServiceConnector(ServiceConnector* service_connector) override;
@@ -45,20 +41,15 @@ class ServiceRegistry : public ServiceProvider, public ApplicationConnection {
ServiceProvider* GetLocalServiceProvider() override;
void SetRemoteServiceProviderConnectionErrorHandler(
const Closure& handler) override;
+ base::WeakPtr<ApplicationConnection> GetWeakPtr() override;
void RemoveServiceConnectorForName(const std::string& interface_name);
private:
- ~ServiceRegistry() override;
-
- // ApplicationConnection overrides.
- void OnCloseConnection() override;
-
// ServiceProvider method.
void ConnectToService(const mojo::String& service_name,
ScopedMessagePipeHandle client_handle) override;
- ApplicationImpl* application_impl_;
const std::string connection_url_;
const std::string remote_url_;
Binding<ServiceProvider> local_binding_;
@@ -66,6 +57,7 @@ class ServiceRegistry : public ServiceProvider, public ApplicationConnection {
ServiceConnectorRegistry service_connector_registry_;
const std::set<std::string> allowed_interfaces_;
const bool allow_all_interfaces_;
+ base::WeakPtrFactory<ApplicationConnection> weak_factory_;
MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry);
};
« no previous file with comments | « mojo/application/public/cpp/lib/application_impl.cc ('k') | mojo/application/public/cpp/lib/service_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698