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

Side by Side Diff: services/shell/runner/host/in_process_native_runner.h

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
6 #define SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
7
8 #include <memory>
9
10 #include "base/callback.h"
11 #include "base/files/file_path.h"
12 #include "base/macros.h"
13 #include "base/scoped_native_library.h"
14 #include "base/threading/simple_thread.h"
15 #include "services/shell/native_runner.h"
16
17 namespace base {
18 class TaskRunner;
19 }
20
21 namespace shell {
22
23 // An implementation of |NativeRunner| that loads/runs the given service (from
24 // the file system) on a separate thread (in the current process).
25 class InProcessNativeRunner : public NativeRunner,
26 public base::DelegateSimpleThread::Delegate {
27 public:
28 InProcessNativeRunner();
29 ~InProcessNativeRunner() override;
30
31 // NativeRunner:
32 mojom::ServicePtr Start(
33 const base::FilePath& library_path,
34 const Identity& target,
35 bool start_sandboxed,
36 const base::Callback<void(base::ProcessId)>& pid_available_callback,
37 const base::Closure& service_completed_callback) override;
38
39 private:
40 // |base::DelegateSimpleThread::Delegate| method:
41 void Run() override;
42
43 base::FilePath library_path_;
44 mojom::ServiceRequest request_;
45 base::Callback<bool(void)> service_completed_callback_runner_;
46
47 base::ScopedNativeLibrary library_;
48 std::unique_ptr<base::DelegateSimpleThread> thread_;
49
50 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner);
51 };
52
53 class InProcessNativeRunnerFactory : public NativeRunnerFactory {
54 public:
55 explicit InProcessNativeRunnerFactory(base::TaskRunner* launch_process_runner)
56 : launch_process_runner_(launch_process_runner) {}
57 ~InProcessNativeRunnerFactory() override {}
58
59 std::unique_ptr<NativeRunner> Create(
60 const base::FilePath& library_path) override;
61
62 private:
63 base::TaskRunner* const launch_process_runner_;
64
65 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory);
66 };
67
68 } // namespace shell
69
70 #endif // SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
OLDNEW
« no previous file with comments | « services/shell/runner/host/host_unittests.cc ('k') | services/shell/runner/host/in_process_native_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698