OLD | NEW |
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 MOJO_SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ | 5 #ifndef MOJO_SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ |
6 #define MOJO_SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ | 6 #define MOJO_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/threading/simple_thread.h" | 11 #include "base/threading/simple_thread.h" |
12 #include "mojo/shell/dynamic_service_runner.h" | 12 #include "mojo/shell/dynamic_service_runner.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 namespace shell { | 15 namespace shell { |
16 | 16 |
17 // An implementation of |DynamicServiceRunner| that loads/runs the given app | 17 // An implementation of |DynamicServiceRunner| that loads/runs the given app |
18 // (from the file system) on a separate thread (in the current process). | 18 // (from the file system) on a separate thread (in the current process). |
19 class InProcessDynamicServiceRunner | 19 class InProcessDynamicServiceRunner |
20 : public DynamicServiceRunner, | 20 : public DynamicServiceRunner, |
21 public base::DelegateSimpleThread::Delegate { | 21 public base::DelegateSimpleThread::Delegate { |
22 public: | 22 public: |
23 explicit InProcessDynamicServiceRunner(Context* context); | 23 explicit InProcessDynamicServiceRunner(Context* context); |
24 virtual ~InProcessDynamicServiceRunner(); | 24 virtual ~InProcessDynamicServiceRunner(); |
25 | 25 |
26 // |DynamicServiceRunner| method: | 26 // |DynamicServiceRunner| method: |
27 virtual void Start(const base::FilePath& app_path, | 27 virtual void Start(const base::FilePath& app_path, |
28 ScopedShellHandle service_handle, | 28 ScopedMessagePipeHandle service_handle, |
29 const base::Closure& app_completed_callback) OVERRIDE; | 29 const base::Closure& app_completed_callback) OVERRIDE; |
30 | 30 |
31 private: | 31 private: |
32 // |base::DelegateSimpleThread::Delegate| method: | 32 // |base::DelegateSimpleThread::Delegate| method: |
33 virtual void Run() OVERRIDE; | 33 virtual void Run() OVERRIDE; |
34 | 34 |
35 base::FilePath app_path_; | 35 base::FilePath app_path_; |
36 ScopedShellHandle service_handle_; | 36 ScopedMessagePipeHandle service_handle_; |
37 base::Callback<bool(void)> app_completed_callback_runner_; | 37 base::Callback<bool(void)> app_completed_callback_runner_; |
38 | 38 |
39 base::DelegateSimpleThread thread_; | 39 base::DelegateSimpleThread thread_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(InProcessDynamicServiceRunner); | 41 DISALLOW_COPY_AND_ASSIGN(InProcessDynamicServiceRunner); |
42 }; | 42 }; |
43 | 43 |
44 typedef DynamicServiceRunnerFactoryImpl<InProcessDynamicServiceRunner> | 44 typedef DynamicServiceRunnerFactoryImpl<InProcessDynamicServiceRunner> |
45 InProcessDynamicServiceRunnerFactory; | 45 InProcessDynamicServiceRunnerFactory; |
46 | 46 |
47 } // namespace shell | 47 } // namespace shell |
48 } // namespace mojo | 48 } // namespace mojo |
49 | 49 |
50 #endif // MOJO_SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ | 50 #endif // MOJO_SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ |
OLD | NEW |