| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 MOJO_UTIL_CAPTURE_UTIL_H_ | |
| 6 #define MOJO_UTIL_CAPTURE_UTIL_H_ | |
| 7 | |
| 8 #include <utility> | |
| 9 | |
| 10 #include "mojo/public/cpp/bindings/callback.h" | |
| 11 | |
| 12 namespace mojo { | |
| 13 | |
| 14 template <typename T1> | |
| 15 mojo::Callback<void(T1)> Capture(T1* t1) { | |
| 16 return [t1](T1 got_t1) { *t1 = std::move(got_t1); }; | |
| 17 } | |
| 18 | |
| 19 template <typename T1, typename T2> | |
| 20 mojo::Callback<void(T1, T2)> Capture(T1* t1, T2* t2) { | |
| 21 return [t1, t2](T1 got_t1, T2 got_t2) { | |
| 22 *t1 = std::move(got_t1); | |
| 23 *t2 = std::move(got_t2); | |
| 24 }; | |
| 25 } | |
| 26 | |
| 27 template <typename T1, typename T2, typename T3> | |
| 28 mojo::Callback<void(T1, T2, T3)> Capture(T1* t1, T2* t2, T3* t3) { | |
| 29 return [t1, t2, t3](T1 got_t1, T2 got_t2, T3 got_t3) { | |
| 30 *t1 = std::move(got_t1); | |
| 31 *t2 = std::move(got_t2); | |
| 32 *t3 = std::move(got_t3); | |
| 33 }; | |
| 34 } | |
| 35 | |
| 36 } // namespace mojo | |
| 37 | |
| 38 #endif // MOJO_UTIL_CAPTURE_UTIL_H_ | |
| OLD | NEW |