Add a histogram for Blink decoded image type
[chromium-blink-merge.git] / mojo / util / capture_util.h
blob4b89eb72d05d4f0f1cd357fee3eb6bb82bb2b73f
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.
5 #ifndef MOJO_UTIL_CAPTURE_UTIL_H_
6 #define MOJO_UTIL_CAPTURE_UTIL_H_
8 #include "mojo/public/cpp/bindings/lib/template_util.h"
10 namespace mojo {
12 template <typename T1>
13 mojo::Callback<void(T1)> Capture(T1* t1) {
14 return [t1](T1 got_t1) { *t1 = mojo::internal::Forward(got_t1); };
17 template <typename T1, typename T2>
18 mojo::Callback<void(T1, T2)> Capture(T1* t1, T2* t2) {
19 return [t1, t2](T1 got_t1, T2 got_t2) {
20 *t1 = mojo::internal::Forward(got_t1);
21 *t2 = mojo::internal::Forward(got_t2);
25 template <typename T1, typename T2, typename T3>
26 mojo::Callback<void(T1, T2, T3)> Capture(T1* t1, T2* t2, T3* t3) {
27 return [t1, t2, t3](T1 got_t1, T2 got_t2, T3 got_t3) {
28 *t1 = mojo::internal::Forward(got_t1);
29 *t2 = mojo::internal::Forward(got_t2);
30 *t3 = mojo::internal::Forward(got_t3);
34 } // namespace mojo
36 #endif // MOJO_UTIL_CAPTURE_UTIL_H_