[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / mojo / shell / in_process_dynamic_service_runner.h
blobce6b029c782d5a0c6295f0449f27e4ca5b1214b0
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.
5 #ifndef MOJO_SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_
6 #define MOJO_SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_
8 #include "base/callback.h"
9 #include "base/files/file_path.h"
10 #include "base/macros.h"
11 #include "base/threading/simple_thread.h"
12 #include "mojo/shell/dynamic_service_runner.h"
13 #include "mojo/shell/keep_alive.h"
15 namespace mojo {
16 namespace shell {
18 // An implementation of |DynamicServiceRunner| that loads/runs the given app
19 // (from the file system) on a separate thread (in the current process).
20 class InProcessDynamicServiceRunner
21 : public DynamicServiceRunner,
22 public base::DelegateSimpleThread::Delegate {
23 public:
24 explicit InProcessDynamicServiceRunner(Context* context);
25 virtual ~InProcessDynamicServiceRunner();
27 // |DynamicServiceRunner| method:
28 virtual void Start(const base::FilePath& app_path,
29 ScopedMessagePipeHandle service_handle,
30 const base::Closure& app_completed_callback) OVERRIDE;
32 private:
33 // |base::DelegateSimpleThread::Delegate| method:
34 virtual void Run() OVERRIDE;
36 KeepAlive keep_alive_;
37 base::FilePath app_path_;
38 ScopedMessagePipeHandle service_handle_;
39 base::Callback<bool(void)> app_completed_callback_runner_;
41 base::DelegateSimpleThread thread_;
43 DISALLOW_COPY_AND_ASSIGN(InProcessDynamicServiceRunner);
46 typedef DynamicServiceRunnerFactoryImpl<InProcessDynamicServiceRunner>
47 InProcessDynamicServiceRunnerFactory;
49 } // namespace shell
50 } // namespace mojo
52 #endif // MOJO_SHELL_IN_PROCESS_DYNAMIC_SERVICE_RUNNER_H_