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

Unified Diff: services/service_manager/runner/host/in_process_native_runner.h

Issue 2566663004: Revert of Build services as standalone executables (Closed)
Patch Set: Created 4 years 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
Index: services/service_manager/runner/host/in_process_native_runner.h
diff --git a/services/service_manager/runner/host/in_process_native_runner.h b/services/service_manager/runner/host/in_process_native_runner.h
new file mode 100644
index 0000000000000000000000000000000000000000..9da7becae09d273de34c11de982da578a7498394
--- /dev/null
+++ b/services/service_manager/runner/host/in_process_native_runner.h
@@ -0,0 +1,70 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
+
+#include <memory>
+
+#include "base/callback.h"
+#include "base/files/file_path.h"
+#include "base/macros.h"
+#include "base/scoped_native_library.h"
+#include "base/threading/simple_thread.h"
+#include "services/service_manager/native_runner.h"
+
+namespace base {
+class TaskRunner;
+}
+
+namespace service_manager {
+
+// An implementation of |NativeRunner| that loads/runs the given service (from
+// the file system) on a separate thread (in the current process).
+class InProcessNativeRunner : public NativeRunner,
+ public base::DelegateSimpleThread::Delegate {
+ public:
+ InProcessNativeRunner();
+ ~InProcessNativeRunner() override;
+
+ // NativeRunner:
+ mojom::ServicePtr Start(
+ const base::FilePath& library_path,
+ const Identity& target,
+ bool start_sandboxed,
+ const base::Callback<void(base::ProcessId)>& pid_available_callback,
+ const base::Closure& service_completed_callback) override;
+
+ private:
+ // |base::DelegateSimpleThread::Delegate| method:
+ void Run() override;
+
+ base::FilePath library_path_;
+ mojom::ServiceRequest request_;
+ base::Callback<bool(void)> service_completed_callback_runner_;
+
+ base::ScopedNativeLibrary library_;
+ std::unique_ptr<base::DelegateSimpleThread> thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner);
+};
+
+class InProcessNativeRunnerFactory : public NativeRunnerFactory {
+ public:
+ explicit InProcessNativeRunnerFactory(base::TaskRunner* launch_process_runner)
+ : launch_process_runner_(launch_process_runner) {}
+ ~InProcessNativeRunnerFactory() override {}
+
+ std::unique_ptr<NativeRunner> Create(
+ const base::FilePath& library_path) override;
+
+ private:
+ base::TaskRunner* const launch_process_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory);
+};
+
+} // namespace service_manager
+
+#endif // SERVICES_SERVICE_MANAGER_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_

Powered by Google App Engine
This is Rietveld 408576698