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

Unified Diff: services/service_manager/standalone/context.h

Issue 2651953002: Revert of [Service Manager] Get rid of dynamic service discovery (Closed)
Patch Set: Created 3 years, 11 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 | « services/service_manager/service_manager.cc ('k') | services/service_manager/standalone/context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/service_manager/standalone/context.h
diff --git a/services/service_manager/standalone/context.h b/services/service_manager/standalone/context.h
index a10e572ebd3d0e3efda0d5bd0199bb1412f1cce6..e9d9aa6e4666ae2437c9978bee99f1776f9146d9 100644
--- a/services/service_manager/standalone/context.h
+++ b/services/service_manager/standalone/context.h
@@ -7,16 +7,19 @@
#include <memory>
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/threading/thread.h"
#include "base/time/time.h"
#include "base/values.h"
#include "services/service_manager/runner/host/service_process_launcher.h"
+#include "services/service_manager/service_manager.h"
#include "services/service_manager/standalone/tracer.h"
#include "services/tracing/public/cpp/provider.h"
namespace base {
-class Value;
+class SingleThreadTaskRunner;
}
namespace catalog {
@@ -25,16 +28,33 @@
namespace service_manager {
-class ServiceManager;
-
constexpr size_t kThreadPoolMaxThreads = 3;
// The "global" context for the service manager's main process.
class Context {
public:
- Context(ServiceProcessLauncher::Delegate* launcher_delegate,
- std::unique_ptr<base::Value> catalog_content);
+ struct InitParams {
+ InitParams();
+ ~InitParams();
+
+ ServiceProcessLauncher::Delegate*
+ service_process_launcher_delegate = nullptr;
+ std::unique_ptr<base::Value> static_catalog;
+ // If true the edk is initialized.
+ bool init_edk = true;
+ };
+
+ Context();
~Context();
+
+ static void EnsureEmbedderIsInitialized();
+
+ // This must be called with a message loop set up for the current thread,
+ // which must remain alive until after Shutdown() is called.
+ void Init(std::unique_ptr<InitParams> init_params);
+
+ // If Init() was called and succeeded, this must be called before destruction.
+ void Shutdown();
// Run the application specified on the command line.
void RunCommandLineApplication();
@@ -42,16 +62,23 @@
ServiceManager* service_manager() { return service_manager_.get(); }
private:
+ void OnShutdownComplete();
+
// Runs the app specified by |name|.
void Run(const std::string& name);
+ scoped_refptr<base::SingleThreadTaskRunner> service_manager_runner_;
+ std::unique_ptr<base::Thread> io_thread_;
scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
+ // Ensure this is destructed before task_runners_ since it owns a message pipe
+ // that needs the IO thread to destruct cleanly.
Tracer tracer_;
tracing::Provider provider_;
std::unique_ptr<catalog::Catalog> catalog_;
std::unique_ptr<ServiceManager> service_manager_;
base::Time main_entry_time_;
+ bool init_edk_ = false;
DISALLOW_COPY_AND_ASSIGN(Context);
};
« no previous file with comments | « services/service_manager/service_manager.cc ('k') | services/service_manager/standalone/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698