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

Unified Diff: components/filesystem/files_test_base.h

Issue 2062333002: mojo::Callback -> base::Callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
Index: components/filesystem/files_test_base.h
diff --git a/components/filesystem/files_test_base.h b/components/filesystem/files_test_base.h
index 80fc63314486c30b31e4b855d6f41c89bf6d6b0f..fc594b0e682b2d3b52c040e30dafab0099577b5a 100644
--- a/components/filesystem/files_test_base.h
+++ b/components/filesystem/files_test_base.h
@@ -5,6 +5,9 @@
#ifndef COMPONENTS_FILESYSTEM_FILES_TEST_BASE_H_
#define COMPONENTS_FILESYSTEM_FILES_TEST_BASE_H_
+#include <utility>
+
+#include "base/bind.h"
#include "base/macros.h"
#include "components/filesystem/public/interfaces/file_system.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
@@ -12,26 +15,26 @@
namespace filesystem {
+template <typename... Args> void IgnoreAllArgs(Args&&... args) {}
+
+template <typename... Args>
+void DoCaptures(Args*... out_args, Args... in_args) {
+ IgnoreAllArgs((*out_args = std::move(in_args))...);
+}
+
template <typename T1>
-mojo::Callback<void(T1)> Capture(T1* t1) {
- return [t1](T1 got_t1) { *t1 = std::move(got_t1); };
+base::Callback<void(T1)> Capture(T1* t1) {
+ return base::Bind(&DoCaptures<T1>, 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 = std::move(got_t1);
- *t2 = std::move(got_t2);
- };
+base::Callback<void(T1, T2)> Capture(T1* t1, T2* t2) {
+ return base::Bind(&DoCaptures<T1, T2>, t1, 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 = std::move(got_t1);
- *t2 = std::move(got_t2);
- *t3 = std::move(got_t3);
- };
+base::Callback<void(T1, T2, T3)> Capture(T1* t1, T2* t2, T3* t3) {
+ return base::Bind(&DoCaptures<T1, T2, T3>, t1, t2, t3);
}
class FilesTestBase : public shell::test::ShellTest {

Powered by Google App Engine
This is Rietveld 408576698