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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SHELL_SERVICE_CONNECTOR_H_ 5 #ifndef MOJO_SHELL_SERVICE_CONNECTOR_H_
6 #define MOJO_SHELL_SERVICE_CONNECTOR_H_ 6 #define MOJO_SHELL_SERVICE_CONNECTOR_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 23 matching lines...) Expand all
34 // Sets the default Loader to be used if not overridden by SetLoaderForURL(). 34 // Sets the default Loader to be used if not overridden by SetLoaderForURL().
35 // Does not take ownership of |loader|. 35 // Does not take ownership of |loader|.
36 void set_default_loader(Loader* loader) { default_loader_ = loader; } 36 void set_default_loader(Loader* loader) { default_loader_ = loader; }
37 // Sets a Loader to be used for a specific url. 37 // Sets a Loader to be used for a specific url.
38 // Does not take ownership of |loader|. 38 // Does not take ownership of |loader|.
39 void SetLoaderForURL(Loader* loader, const GURL& gurl); 39 void SetLoaderForURL(Loader* loader, const GURL& gurl);
40 // Returns the Loader to use for a url (using default if not overridden.) 40 // Returns the Loader to use for a url (using default if not overridden.)
41 Loader* GetLoaderForURL(const GURL& gurl); 41 Loader* GetLoaderForURL(const GURL& gurl);
42 // Loads a service if necessary and establishes a new client connection. 42 // Loads a service if necessary and establishes a new client connection.
43 void Connect(const GURL& url, ScopedMessagePipeHandle client_handle); 43 void Connect(const GURL& url, ScopedMessagePipeHandle client_handle);
44 // Returns true if there is a ServiceFactory for this URL.
45 bool HasFactoryForURL(const GURL& url) const;
darin (slow to review) 2014/02/06 05:00:46 nit: the service factory is a private implementati
44 46
45 private: 47 private:
46 class ServiceFactory; 48 class ServiceFactory;
47 49
50 // Removes a ServiceFactory when it no longer has any connections.
51 void RemoveServiceFactory(ServiceFactory* service_factory);
52
48 Loader* default_loader_; 53 Loader* default_loader_;
49 typedef std::map<GURL, ServiceFactory*> ServiceFactoryMap; 54 typedef std::map<GURL, ServiceFactory*> ServiceFactoryMap;
50 ServiceFactoryMap url_to_service_factory_; 55 ServiceFactoryMap url_to_service_factory_;
51 typedef std::map<GURL, Loader*> LoaderMap; 56 typedef std::map<GURL, Loader*> LoaderMap;
52 LoaderMap url_to_loader_; 57 LoaderMap url_to_loader_;
53 DISALLOW_COPY_AND_ASSIGN(ServiceConnector); 58 DISALLOW_COPY_AND_ASSIGN(ServiceConnector);
54 }; 59 };
55 60
56 } // namespace shell 61 } // namespace shell
57 } // namespace mojo 62 } // namespace mojo
58 63
59 #endif // MOJO_SHELL_SERVICE_CONNECTOR_H_ 64 #endif // MOJO_SHELL_SERVICE_CONNECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698