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

Unified Diff: content/common/service_manager/embedded_service_runner.h

Issue 2476063002: Service Manager: Rework Service and ServiceContext lifetime (Closed)
Patch Set: . Created 4 years, 1 month 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 | « components/leveldb/leveldb_app.cc ('k') | content/common/service_manager/embedded_service_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/service_manager/embedded_service_runner.h
diff --git a/content/common/service_manager/embedded_service_runner.h b/content/common/service_manager/embedded_service_runner.h
index 0d58565ca17744796934a23104ae9cfe2488d430..9144c5c0f771b93e343d28c71239c2ffb2dfff18 100644
--- a/content/common/service_manager/embedded_service_runner.h
+++ b/content/common/service_manager/embedded_service_runner.h
@@ -19,37 +19,30 @@
namespace content {
-// Hosts an in-process service instance that supports multiple Service
-// connections. The first incoming connection will invoke a provided factory
-// function to instantiate the service, and the service will automatically be
-// torn down when its last connection is lost. The service may be launched and
-// torn down multiple times by a single EmbeddedServiceRunner instance.
+// Hosts in-process service instances for a given service.
class EmbeddedServiceRunner {
public:
- // Constructs a runner which hosts a service. If an existing instance of the
- // service is not running when an incoming connection is made, details from
- // |info| will be used to construct a new instance.
+ // Constructs a runner for a service. Every new instance started by the
+ // Service Manager for this service will invoke the factory function on |info|
+ // to create a new concrete instance of the Service implementation.
EmbeddedServiceRunner(const base::StringPiece& name,
const ServiceInfo& info);
~EmbeddedServiceRunner();
- // Binds an incoming ServiceRequest for this service. If the service isn't
- // already running, it is started. Otherwise the request is bound to the
- // running instance.
+ // Binds an incoming ServiceRequest for this service. This creates a new
+ // instance of the Service implementation.
void BindServiceRequest(service_manager::mojom::ServiceRequest request);
- // Sets a callback to run after the service loses its last connection and is
- // torn down.
+ // Sets a callback to run when all instances of the service have stopped.
void SetQuitClosure(const base::Closure& quit_closure);
private:
- class Instance;
+ class InstanceManager;
void OnQuit();
- // A reference to the service instance which may operate on the
- // |task_runner_|'s thread.
- scoped_refptr<Instance> instance_;
+ // A reference to the instance manager, which may operate on another thread.
+ scoped_refptr<InstanceManager> instance_manager_;
base::Closure quit_closure_;
« no previous file with comments | « components/leveldb/leveldb_app.cc ('k') | content/common/service_manager/embedded_service_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698