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

Unified Diff: mojo/public/cpp/bindings/lib/serialization_util.h

Issue 2007813004: Mojo C++ bindings: support attaching context object for StructTraits. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/struct_traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/serialization_util.h
diff --git a/mojo/public/cpp/bindings/lib/serialization_util.h b/mojo/public/cpp/bindings/lib/serialization_util.h
index 698e90d96284476a454885e241632da5747d1215..3c9482ce6fb1a29480a70eaba7ac4ffdcb157d7e 100644
--- a/mojo/public/cpp/bindings/lib/serialization_util.h
+++ b/mojo/public/cpp/bindings/lib/serialization_util.h
@@ -213,18 +213,18 @@ struct CustomContextHelper<Traits, false> {
}
};
-template <typename ReturnType, typename ParamType, typename MaybeConstUserType>
+template <typename ReturnType, typename ParamType, typename InputUserType>
ReturnType CallWithContext(ReturnType (*f)(ParamType, void*),
- MaybeConstUserType& input,
+ InputUserType&& input,
void* context) {
- return f(input, context);
+ return f(std::forward<InputUserType>(input), context);
}
-template <typename ReturnType, typename ParamType, typename MaybeConstUserType>
+template <typename ReturnType, typename ParamType, typename InputUserType>
ReturnType CallWithContext(ReturnType (*f)(ParamType),
- MaybeConstUserType& input,
+ InputUserType&& input,
void* context) {
- return f(input);
+ return f(std::forward<InputUserType>(input));
}
} // namespace internal
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/struct_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698