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

Unified Diff: base/tuple.h

Issue 1736643005: Decouple Media Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another try to fix Windows Created 4 years, 10 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 | content/common/content_message_generator.h » ('j') | ipc/ipc_message_templates.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tuple.h
diff --git a/base/tuple.h b/base/tuple.h
index 8898fe0d2e0af00bae59de17225243bb27148792..b9cd791eff282957bc16cd9077ad8d597d43ed78 100644
--- a/base/tuple.h
+++ b/base/tuple.h
@@ -228,6 +228,40 @@ inline void DispatchToFunction(Function function, const Tuple<Ts...>& arg) {
template <typename ObjT,
typename Method,
+ typename P,
+ typename... InTs,
+ typename... OutTs,
+ size_t... InNs,
+ size_t... OutNs>
+inline void DispatchToMethodImpl(const ObjT& obj,
+ Method method,
+ P* parameter,
+ const Tuple<InTs...>& in,
+ Tuple<OutTs...>* out,
+ IndexSequence<InNs...>,
+ IndexSequence<OutNs...>) {
+ (obj->*method)(parameter, internal::Unwrap(get<InNs>(in))...,
+ &get<OutNs>(*out)...);
+}
+
+template <typename ObjT,
+ typename P,
+ typename... Args,
+ typename... InTs,
+ typename... OutTs,
+ typename std::enable_if<!std::is_void<P>::value>::type* = nullptr>
danakj 2016/03/03 21:00:28 I know you're working around msvc bugs but I don't
+void DispatchToMethod(ObjT* obj,
+ void (ObjT::*method)(P*, Args...),
+ P* parameter,
+ const base::Tuple<InTs...>& tuple,
+ base::Tuple<OutTs...>* out) {
+ DispatchToMethodImpl(obj, method, parameter, tuple, out,
+ MakeIndexSequence<sizeof...(InTs)>(),
+ MakeIndexSequence<sizeof...(OutTs)>());
+}
+
+template <typename ObjT,
+ typename Method,
typename... InTs,
typename... OutTs,
size_t... InNs,
@@ -241,9 +275,14 @@ inline void DispatchToMethodImpl(const ObjT& obj,
(obj->*method)(internal::Unwrap(get<InNs>(in))..., &get<OutNs>(*out)...);
}
-template <typename ObjT, typename Method, typename... InTs, typename... OutTs>
+template <typename ObjT,
+ typename Method,
+ typename P,
+ typename... InTs,
+ typename... OutTs>
inline void DispatchToMethod(const ObjT& obj,
Method method,
+ P* parameter,
const Tuple<InTs...>& in,
Tuple<OutTs...>* out) {
DispatchToMethodImpl(obj, method, in, out,
« no previous file with comments | « no previous file | content/common/content_message_generator.h » ('j') | ipc/ipc_message_templates.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698