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

Unified Diff: mojo/util/capture_util.h

Issue 1176653002: mandoline filesystem: add a sqlite3 vfs to proxy filesystem usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win 8 Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/tools/data/apptests ('k') | sql/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/util/capture_util.h
diff --git a/mojo/util/capture_util.h b/mojo/util/capture_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b89eb72d05d4f0f1cd357fee3eb6bb82bb2b73f
--- /dev/null
+++ b/mojo/util/capture_util.h
@@ -0,0 +1,36 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_UTIL_CAPTURE_UTIL_H_
+#define MOJO_UTIL_CAPTURE_UTIL_H_
+
+#include "mojo/public/cpp/bindings/lib/template_util.h"
+
+namespace mojo {
+
+template <typename T1>
+mojo::Callback<void(T1)> Capture(T1* t1) {
+ return [t1](T1 got_t1) { *t1 = mojo::internal::Forward(got_t1); };
+}
+
+template <typename T1, typename T2>
+mojo::Callback<void(T1, T2)> Capture(T1* t1, T2* t2) {
+ return [t1, t2](T1 got_t1, T2 got_t2) {
+ *t1 = mojo::internal::Forward(got_t1);
+ *t2 = mojo::internal::Forward(got_t2);
+ };
+}
+
+template <typename T1, typename T2, typename T3>
+mojo::Callback<void(T1, T2, T3)> Capture(T1* t1, T2* t2, T3* t3) {
+ return [t1, t2, t3](T1 got_t1, T2 got_t2, T3 got_t3) {
+ *t1 = mojo::internal::Forward(got_t1);
+ *t2 = mojo::internal::Forward(got_t2);
+ *t3 = mojo::internal::Forward(got_t3);
+ };
+}
+
+} // namespace mojo
+
+#endif // MOJO_UTIL_CAPTURE_UTIL_H_
« no previous file with comments | « mojo/tools/data/apptests ('k') | sql/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698