Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Side by Side Diff: mojo/util/capture_util.h

Issue 2008383002: Remove a bunch of stuff in //mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/util/BUILD.gn ('k') | mojo/util/filename_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « mojo/util/BUILD.gn ('k') | mojo/util/filename_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698