summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorAvi Drissman <avi@chromium.org>2014-12-22 12:02:36 -0500
committerAvi Drissman <avi@chromium.org>2014-12-22 17:01:36 +0000
commit12f4b98357b9dedc93cb546aac0aece2c8d9e850 (patch)
tree9e09b958d6b8afe9d1bbc188e986714547c5cb4f /ipc
parentafe00d04124c924cd5564226b348f653b3df8509 (diff)
downloadchromium_src-12f4b98357b9dedc93cb546aac0aece2c8d9e850.zip
chromium_src-12f4b98357b9dedc93cb546aac0aece2c8d9e850.tar.gz
chromium_src-12f4b98357b9dedc93cb546aac0aece2c8d9e850.tar.bz2
Update legacy Tuple-using code.
BUG=440675 TEST=no change R=mdempsky@chromium.org, nasko@chromium.org TBR=ben@chromium.org Review URL: https://codereview.chromium.org/814403003 Cr-Commit-Position: refs/heads/master@{#309432}
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_message_macros.h35
-rw-r--r--ipc/ipc_message_utils.h116
2 files changed, 76 insertions, 75 deletions
diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h
index 20c8335..01789cb 100644
--- a/ipc/ipc_message_macros.h
+++ b/ipc/ipc_message_macros.h
@@ -457,7 +457,7 @@
void (T::*func)(P*, TA)) { \
Schema::Param p; \
if (Read(msg, &p)) { \
- (obj->*func)(parameter, p.a); \
+ (obj->*func)(parameter, get<0>(p)); \
return true; \
} \
return false; \
@@ -469,7 +469,7 @@
void (T::*func)(P*, TA, TB)) { \
Schema::Param p; \
if (Read(msg, &p)) { \
- (obj->*func)(parameter, p.a, p.b); \
+ (obj->*func)(parameter, get<0>(p), get<1>(p)); \
return true; \
} \
return false; \
@@ -481,7 +481,7 @@
void (T::*func)(P*, TA, TB, TC)) { \
Schema::Param p; \
if (Read(msg, &p)) { \
- (obj->*func)(parameter, p.a, p.b, p.c); \
+ (obj->*func)(parameter, get<0>(p), get<1>(p), get<2>(p)); \
return true; \
} \
return false; \
@@ -494,7 +494,7 @@
void (T::*func)(P*, TA, TB, TC, TD)) { \
Schema::Param p; \
if (Read(msg, &p)) { \
- (obj->*func)(parameter, p.a, p.b, p.c, p.d); \
+ (obj->*func)(parameter, get<0>(p), get<1>(p), get<2>(p), get<3>(p)); \
return true; \
} \
return false; \
@@ -507,7 +507,8 @@
void (T::*func)(P*, TA, TB, TC, TD, TE)) { \
Schema::Param p; \
if (Read(msg, &p)) { \
- (obj->*func)(parameter, p.a, p.b, p.c, p.d, p.e); \
+ (obj->*func)(parameter, get<0>(p), get<1>(p), get<2>(p), get<3>(p), \
+ get<4>(p)); \
return true; \
} \
return false; \
@@ -817,18 +818,18 @@
#define IPC_TYPE_OUT_3(t1, t2, t3) t1* arg6, t2* arg7, t3* arg8
#define IPC_TYPE_OUT_4(t1, t2, t3, t4) t1* arg6, t2* arg7, t3* arg8, t4* arg9
-#define IPC_TUPLE_IN_0() Tuple0
-#define IPC_TUPLE_IN_1(t1) Tuple1<t1>
-#define IPC_TUPLE_IN_2(t1, t2) Tuple2<t1, t2>
-#define IPC_TUPLE_IN_3(t1, t2, t3) Tuple3<t1, t2, t3>
-#define IPC_TUPLE_IN_4(t1, t2, t3, t4) Tuple4<t1, t2, t3, t4>
-#define IPC_TUPLE_IN_5(t1, t2, t3, t4, t5) Tuple5<t1, t2, t3, t4, t5>
-
-#define IPC_TUPLE_OUT_0() Tuple0
-#define IPC_TUPLE_OUT_1(t1) Tuple1<t1&>
-#define IPC_TUPLE_OUT_2(t1, t2) Tuple2<t1&, t2&>
-#define IPC_TUPLE_OUT_3(t1, t2, t3) Tuple3<t1&, t2&, t3&>
-#define IPC_TUPLE_OUT_4(t1, t2, t3, t4) Tuple4<t1&, t2&, t3&, t4&>
+#define IPC_TUPLE_IN_0() Tuple<>
+#define IPC_TUPLE_IN_1(t1) Tuple<t1>
+#define IPC_TUPLE_IN_2(t1, t2) Tuple<t1, t2>
+#define IPC_TUPLE_IN_3(t1, t2, t3) Tuple<t1, t2, t3>
+#define IPC_TUPLE_IN_4(t1, t2, t3, t4) Tuple<t1, t2, t3, t4>
+#define IPC_TUPLE_IN_5(t1, t2, t3, t4, t5) Tuple<t1, t2, t3, t4, t5>
+
+#define IPC_TUPLE_OUT_0() Tuple<>
+#define IPC_TUPLE_OUT_1(t1) Tuple<t1&>
+#define IPC_TUPLE_OUT_2(t1, t2) Tuple<t1&, t2&>
+#define IPC_TUPLE_OUT_3(t1, t2, t3) Tuple<t1&, t2&, t3&>
+#define IPC_TUPLE_OUT_4(t1, t2, t3, t4) Tuple<t1&, t2&, t3&, t4&>
#define IPC_NAME_IN_0() MakeTuple()
#define IPC_NAME_IN_1(t1) MakeRefTuple(arg1)
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 92351a6..d18ab61 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -520,8 +520,8 @@ struct IPC_EXPORT ParamTraits<base::TimeTicks> {
};
template <>
-struct ParamTraits<Tuple0> {
- typedef Tuple0 param_type;
+struct ParamTraits<Tuple<>> {
+ typedef Tuple<> param_type;
static void Write(Message* m, const param_type& p) {
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
@@ -532,112 +532,112 @@ struct ParamTraits<Tuple0> {
};
template <class A>
-struct ParamTraits< Tuple1<A> > {
- typedef Tuple1<A> param_type;
+struct ParamTraits<Tuple<A>> {
+ typedef Tuple<A> param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.a);
+ WriteParam(m, get<0>(p));
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return ReadParam(m, iter, &r->a);
+ return ReadParam(m, iter, &get<0>(*r));
}
static void Log(const param_type& p, std::string* l) {
- LogParam(p.a, l);
+ LogParam(get<0>(p), l);
}
};
template <class A, class B>
-struct ParamTraits< Tuple2<A, B> > {
- typedef Tuple2<A, B> param_type;
+struct ParamTraits< Tuple<A, B> > {
+ typedef Tuple<A, B> param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.a);
- WriteParam(m, p.b);
+ WriteParam(m, get<0>(p));
+ WriteParam(m, get<1>(p));
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return (ReadParam(m, iter, &r->a) &&
- ReadParam(m, iter, &r->b));
+ return (ReadParam(m, iter, &get<0>(*r)) &&
+ ReadParam(m, iter, &get<1>(*r)));
}
static void Log(const param_type& p, std::string* l) {
- LogParam(p.a, l);
+ LogParam(get<0>(p), l);
l->append(", ");
- LogParam(p.b, l);
+ LogParam(get<1>(p), l);
}
};
template <class A, class B, class C>
-struct ParamTraits< Tuple3<A, B, C> > {
- typedef Tuple3<A, B, C> param_type;
+struct ParamTraits< Tuple<A, B, C> > {
+ typedef Tuple<A, B, C> param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.a);
- WriteParam(m, p.b);
- WriteParam(m, p.c);
+ WriteParam(m, get<0>(p));
+ WriteParam(m, get<1>(p));
+ WriteParam(m, get<2>(p));
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return (ReadParam(m, iter, &r->a) &&
- ReadParam(m, iter, &r->b) &&
- ReadParam(m, iter, &r->c));
+ return (ReadParam(m, iter, &get<0>(*r)) &&
+ ReadParam(m, iter, &get<1>(*r)) &&
+ ReadParam(m, iter, &get<2>(*r)));
}
static void Log(const param_type& p, std::string* l) {
- LogParam(p.a, l);
+ LogParam(get<0>(p), l);
l->append(", ");
- LogParam(p.b, l);
+ LogParam(get<1>(p), l);
l->append(", ");
- LogParam(p.c, l);
+ LogParam(get<2>(p), l);
}
};
template <class A, class B, class C, class D>
-struct ParamTraits< Tuple4<A, B, C, D> > {
- typedef Tuple4<A, B, C, D> param_type;
+struct ParamTraits< Tuple<A, B, C, D> > {
+ typedef Tuple<A, B, C, D> param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.a);
- WriteParam(m, p.b);
- WriteParam(m, p.c);
- WriteParam(m, p.d);
+ WriteParam(m, get<0>(p));
+ WriteParam(m, get<1>(p));
+ WriteParam(m, get<2>(p));
+ WriteParam(m, get<3>(p));
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return (ReadParam(m, iter, &r->a) &&
- ReadParam(m, iter, &r->b) &&
- ReadParam(m, iter, &r->c) &&
- ReadParam(m, iter, &r->d));
+ return (ReadParam(m, iter, &get<0>(*r)) &&
+ ReadParam(m, iter, &get<1>(*r)) &&
+ ReadParam(m, iter, &get<2>(*r)) &&
+ ReadParam(m, iter, &get<3>(*r)));
}
static void Log(const param_type& p, std::string* l) {
- LogParam(p.a, l);
+ LogParam(get<0>(p), l);
l->append(", ");
- LogParam(p.b, l);
+ LogParam(get<1>(p), l);
l->append(", ");
- LogParam(p.c, l);
+ LogParam(get<2>(p), l);
l->append(", ");
- LogParam(p.d, l);
+ LogParam(get<3>(p), l);
}
};
template <class A, class B, class C, class D, class E>
-struct ParamTraits< Tuple5<A, B, C, D, E> > {
- typedef Tuple5<A, B, C, D, E> param_type;
+struct ParamTraits< Tuple<A, B, C, D, E> > {
+ typedef Tuple<A, B, C, D, E> param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.a);
- WriteParam(m, p.b);
- WriteParam(m, p.c);
- WriteParam(m, p.d);
- WriteParam(m, p.e);
+ WriteParam(m, get<0>(p));
+ WriteParam(m, get<1>(p));
+ WriteParam(m, get<2>(p));
+ WriteParam(m, get<3>(p));
+ WriteParam(m, get<4>(p));
}
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
- return (ReadParam(m, iter, &r->a) &&
- ReadParam(m, iter, &r->b) &&
- ReadParam(m, iter, &r->c) &&
- ReadParam(m, iter, &r->d) &&
- ReadParam(m, iter, &r->e));
+ return (ReadParam(m, iter, &get<0>(*r)) &&
+ ReadParam(m, iter, &get<1>(*r)) &&
+ ReadParam(m, iter, &get<2>(*r)) &&
+ ReadParam(m, iter, &get<3>(*r)) &&
+ ReadParam(m, iter, &get<4>(*r)));
}
static void Log(const param_type& p, std::string* l) {
- LogParam(p.a, l);
+ LogParam(get<0>(p), l);
l->append(", ");
- LogParam(p.b, l);
+ LogParam(get<1>(p), l);
l->append(", ");
- LogParam(p.c, l);
+ LogParam(get<2>(p), l);
l->append(", ");
- LogParam(p.d, l);
+ LogParam(get<3>(p), l);
l->append(", ");
- LogParam(p.e, l);
+ LogParam(get<4>(p), l);
}
};
@@ -912,7 +912,7 @@ class SyncMessageSchema {
Method func) {
Message* reply = SyncMessage::GenerateReply(msg);
if (ok) {
- Tuple1<Message&> t = MakeRefTuple(*reply);
+ Tuple<Message&> t = MakeRefTuple(*reply);
ConnectMessageAndReply(msg, reply);
DispatchToMethod(obj, func, send_params, &t);
} else {