| 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 #include "components/arc/standalone/arc_standalone_bridge_runner.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "base/run_loop.h" | |
| 9 #include "base/single_thread_task_runner.h" | |
| 10 | |
| 11 namespace arc { | |
| 12 | |
| 13 ArcStandaloneBridgeRunner::ArcStandaloneBridgeRunner() : exit_code_(0) { | |
| 14 } | |
| 15 | |
| 16 ArcStandaloneBridgeRunner::~ArcStandaloneBridgeRunner() { | |
| 17 } | |
| 18 | |
| 19 int ArcStandaloneBridgeRunner::Run() { | |
| 20 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 21 run_loop_.reset(new base::RunLoop()); | |
| 22 run_loop_->Run(); | |
| 23 run_loop_.reset(nullptr); | |
| 24 | |
| 25 return exit_code_; | |
| 26 } | |
| 27 | |
| 28 void ArcStandaloneBridgeRunner::Stop(int exit_code) { | |
| 29 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 30 exit_code_ = exit_code; | |
| 31 CHECK(run_loop_); | |
| 32 message_loop_.task_runner()->PostTask(FROM_HERE, run_loop_->QuitClosure()); | |
| 33 } | |
| 34 | |
| 35 } // namespace arc | |
| OLD | NEW |