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

Unified Diff: mojo/shell/service_connector.h

Issue 137623017: Cleanup Service<> and ServiceFactory<> when clients go away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review nits Created 6 years, 10 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
« no previous file with comments | « mojo/public/shell/service.h ('k') | mojo/shell/service_connector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/service_connector.h
diff --git a/mojo/shell/service_connector.h b/mojo/shell/service_connector.h
index 725b11921797f3f50f21fbd1ff39be4ed0be6afd..6b338b640da221cd763c5536871b8e807081a8d5 100644
--- a/mojo/shell/service_connector.h
+++ b/mojo/shell/service_connector.h
@@ -28,6 +28,17 @@ class ServiceConnector {
Loader();
};
+ // API for testing.
+ class TestAPI {
+ private:
+ friend class ServiceConnectorTest;
+ explicit TestAPI(ServiceConnector* connector) : connector_(connector) {}
+ // Returns true if there is a ServiceFactory for this URL.
+ bool HasFactoryForURL(const GURL& url) const;
+
+ ServiceConnector* connector_;
+ };
+
ServiceConnector();
~ServiceConnector();
@@ -41,10 +52,12 @@ class ServiceConnector {
Loader* GetLoaderForURL(const GURL& gurl);
// Loads a service if necessary and establishes a new client connection.
void Connect(const GURL& url, ScopedMessagePipeHandle client_handle);
-
private:
class ServiceFactory;
+ // Removes a ServiceFactory when it no longer has any connections.
+ void RemoveServiceFactory(ServiceFactory* service_factory);
+
Loader* default_loader_;
typedef std::map<GURL, ServiceFactory*> ServiceFactoryMap;
ServiceFactoryMap url_to_service_factory_;
« no previous file with comments | « mojo/public/shell/service.h ('k') | mojo/shell/service_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698