Wez | 500d443 | 2019-03-08 18:12:49 | [diff] [blame] | 1 | // Copyright 2019 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 "fuchsia/base/lifecycle_impl.h" |
| 6 | |
Wez | 500d443 | 2019-03-08 18:12:49 | [diff] [blame] | 7 | namespace cr_fuchsia { |
| 8 | |
Sharon Yang | 461c3ac8 | 2019-08-22 21:05:20 | [diff] [blame] | 9 | LifecycleImpl::LifecycleImpl(sys::OutgoingDirectory* outgoing_directory, |
Wez | 500d443 | 2019-03-08 18:12:49 | [diff] [blame] | 10 | base::OnceClosure on_terminate) |
Sharon Yang | 461c3ac8 | 2019-08-22 21:05:20 | [diff] [blame] | 11 | : binding_(outgoing_directory, this), |
Wez | 500d443 | 2019-03-08 18:12:49 | [diff] [blame] | 12 | on_terminate_(std::move(on_terminate)) {} |
| 13 | |
| 14 | LifecycleImpl::~LifecycleImpl() = default; |
| 15 | |
| 16 | void LifecycleImpl::Terminate() { |
| 17 | if (on_terminate_) |
| 18 | std::move(on_terminate_).Run(); |
| 19 | } |
| 20 | |
| 21 | } // namespace cr_fuchsia |