| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CONTENT_COMMON_SERVICE_MANAGER_EMBEDDED_SERVICE_RUNNER_H_ | 5 #ifndef CONTENT_COMMON_SERVICE_MANAGER_EMBEDDED_SERVICE_RUNNER_H_ |
| 6 #define CONTENT_COMMON_SERVICE_MANAGER_EMBEDDED_SERVICE_RUNNER_H_ | 6 #define CONTENT_COMMON_SERVICE_MANAGER_EMBEDDED_SERVICE_RUNNER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Constructs a runner which hosts a service. If an existing instance of the | 29 // Constructs a runner which hosts a service. If an existing instance of the |
| 30 // service is not running when an incoming connection is made, details from | 30 // service is not running when an incoming connection is made, details from |
| 31 // |info| will be used to construct a new instance. | 31 // |info| will be used to construct a new instance. |
| 32 EmbeddedServiceRunner(const base::StringPiece& name, | 32 EmbeddedServiceRunner(const base::StringPiece& name, |
| 33 const ServiceInfo& info); | 33 const ServiceInfo& info); |
| 34 ~EmbeddedServiceRunner(); | 34 ~EmbeddedServiceRunner(); |
| 35 | 35 |
| 36 // Binds an incoming ServiceRequest for this service. If the service isn't | 36 // Binds an incoming ServiceRequest for this service. If the service isn't |
| 37 // already running, it is started. Otherwise the request is bound to the | 37 // already running, it is started. Otherwise the request is bound to the |
| 38 // running instance. | 38 // running instance. |
| 39 void BindServiceRequest(shell::mojom::ServiceRequest request); | 39 void BindServiceRequest(service_manager::mojom::ServiceRequest request); |
| 40 | 40 |
| 41 // Sets a callback to run after the service loses its last connection and is | 41 // Sets a callback to run after the service loses its last connection and is |
| 42 // torn down. | 42 // torn down. |
| 43 void SetQuitClosure(const base::Closure& quit_closure); | 43 void SetQuitClosure(const base::Closure& quit_closure); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 class Instance; | 46 class Instance; |
| 47 | 47 |
| 48 void OnQuit(); | 48 void OnQuit(); |
| 49 | 49 |
| 50 // A reference to the service instance which may operate on the | 50 // A reference to the service instance which may operate on the |
| 51 // |task_runner_|'s thread. | 51 // |task_runner_|'s thread. |
| 52 scoped_refptr<Instance> instance_; | 52 scoped_refptr<Instance> instance_; |
| 53 | 53 |
| 54 base::Closure quit_closure_; | 54 base::Closure quit_closure_; |
| 55 | 55 |
| 56 base::WeakPtrFactory<EmbeddedServiceRunner> weak_factory_; | 56 base::WeakPtrFactory<EmbeddedServiceRunner> weak_factory_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(EmbeddedServiceRunner); | 58 DISALLOW_COPY_AND_ASSIGN(EmbeddedServiceRunner); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace content | 61 } // namespace content |
| 62 | 62 |
| 63 #endif // CONTENT_COMMON_SERVICE_MANAGER_EMBEDDED_SERVICE_RUNNER_H_ | 63 #endif // CONTENT_COMMON_SERVICE_MANAGER_EMBEDDED_SERVICE_RUNNER_H_ |
| OLD | NEW |