OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 COMPONENTS_ARC_STANDALONE_ARC_STANDALONE_BRIDGE_RUNNER_H_ | |
6 #define COMPONENTS_ARC_STANDALONE_ARC_STANDALONE_BRIDGE_RUNNER_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/message_loop/message_loop.h" | |
12 #include "base/run_loop.h" | |
13 #include "base/threading/thread_checker.h" | |
14 | |
15 namespace arc { | |
16 | |
17 // Runner of the standalone ARC++ bridge, which hosts an IO message loop. | |
18 class ArcStandaloneBridgeRunner { | |
19 public: | |
20 ArcStandaloneBridgeRunner(); | |
21 ~ArcStandaloneBridgeRunner(); | |
22 | |
23 // Starts the message loop. Needs to be run on the thread where this | |
24 // instance is created. | |
25 int Run(); | |
26 | |
27 // Stops the message loop. Needs to be called in a message loop. | |
28 void Stop(int exit_code); | |
29 | |
30 private: | |
31 base::MessageLoopForIO message_loop_; | |
32 std::unique_ptr<base::RunLoop> run_loop_; | |
33 base::ThreadChecker thread_checker_; | |
34 int exit_code_; | |
35 | |
36 DISALLOW_COPY_AND_ASSIGN(ArcStandaloneBridgeRunner); | |
37 }; | |
38 | |
39 | |
40 } // namespace arc | |
41 | |
42 #endif // COMPONENTS_ARC_STANDALONE_ARC_STANDALONE_BRIDGE_RUNNER_H_ | |
OLD | NEW |