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

Side by Side Diff: shell/in_process_dynamic_service_runner.h

Issue 974403002: Add --force-in-process flag to shell. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: amend comment Created 5 years, 9 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ 5 #ifndef SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_
6 #define SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ 6 #define SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
11 #include "base/scoped_native_library.h" 12 #include "base/scoped_native_library.h"
12 #include "base/threading/simple_thread.h" 13 #include "base/threading/simple_thread.h"
13 #include "shell/application_manager/application_manager.h" 14 #include "shell/application_manager/application_manager.h"
14 #include "shell/dynamic_service_runner.h" 15 #include "shell/dynamic_service_runner.h"
15 16
16 namespace mojo { 17 namespace mojo {
17 namespace shell { 18 namespace shell {
18 19
20 class Context;
21
22 // TODO(vtl): Rename this to "InProcessNativeRunner".
19 // An implementation of |DynamicServiceRunner| that loads/runs the given app 23 // An implementation of |DynamicServiceRunner| that loads/runs the given app
20 // (from the file system) on a separate thread (in the current process). 24 // (from the file system) on a separate thread (in the current process).
21 class InProcessDynamicServiceRunner 25 class InProcessDynamicServiceRunner
22 : public mojo::NativeRunner, 26 : public NativeRunner,
23 public base::DelegateSimpleThread::Delegate { 27 public base::DelegateSimpleThread::Delegate {
24 public: 28 public:
25 explicit InProcessDynamicServiceRunner(Context* context); 29 explicit InProcessDynamicServiceRunner(Context* context);
26 ~InProcessDynamicServiceRunner() override; 30 ~InProcessDynamicServiceRunner() override;
27 31
28 // |DynamicServiceRunner| method: 32 // |DynamicServiceRunner| method:
29 void Start(const base::FilePath& app_path, 33 void Start(const base::FilePath& app_path,
30 mojo::NativeRunner::CleanupBehavior cleanup_behavior, 34 NativeRunner::CleanupBehavior cleanup_behavior,
31 InterfaceRequest<Application> application_request, 35 InterfaceRequest<Application> application_request,
32 const base::Closure& app_completed_callback) override; 36 const base::Closure& app_completed_callback) override;
33 37
34 private: 38 private:
35 // |base::DelegateSimpleThread::Delegate| method: 39 // |base::DelegateSimpleThread::Delegate| method:
36 void Run() override; 40 void Run() override;
37 41
38 base::FilePath app_path_; 42 base::FilePath app_path_;
39 mojo::NativeRunner::CleanupBehavior cleanup_behavior_; 43 NativeRunner::CleanupBehavior cleanup_behavior_;
40 InterfaceRequest<Application> application_request_; 44 InterfaceRequest<Application> application_request_;
41 base::Callback<bool(void)> app_completed_callback_runner_; 45 base::Callback<bool(void)> app_completed_callback_runner_;
42 46
43 base::ScopedNativeLibrary app_library_; 47 base::ScopedNativeLibrary app_library_;
44 scoped_ptr<base::DelegateSimpleThread> thread_; 48 scoped_ptr<base::DelegateSimpleThread> thread_;
45 49
46 DISALLOW_COPY_AND_ASSIGN(InProcessDynamicServiceRunner); 50 DISALLOW_COPY_AND_ASSIGN(InProcessDynamicServiceRunner);
47 }; 51 };
48 52
49 typedef DynamicServiceRunnerFactoryImpl<InProcessDynamicServiceRunner> 53 class InProcessDynamicServiceRunnerFactory : public NativeRunnerFactory {
50 InProcessDynamicServiceRunnerFactory; 54 public:
55 explicit InProcessDynamicServiceRunnerFactory(Context* context)
56 : context_(context) {}
57 ~InProcessDynamicServiceRunnerFactory() override {}
58
59 scoped_ptr<NativeRunner> Create(const Options& options) override;
60
61 private:
62 Context* const context_;
63
64 DISALLOW_COPY_AND_ASSIGN(InProcessDynamicServiceRunnerFactory);
65 };
51 66
52 } // namespace shell 67 } // namespace shell
53 } // namespace mojo 68 } // namespace mojo
54 69
55 #endif // SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ 70 #endif // SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698