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