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

Unified Diff: ipc/ipc_message_utils.h

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « ipc/ipc_message_unittest.cc ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_utils.h
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index cf0dcbc1cc06c2409bc26bf35ab30fb0bb1b7c02..94651419be23314484f6fe6b91a8d2fc643c1e3e 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -96,9 +96,8 @@ static inline void WriteParam(Message* m, const P& p) {
}
template <class P>
-static inline bool WARN_UNUSED_RESULT ReadParam(const Message* m,
- base::PickleIterator* iter,
- P* p) {
+static inline bool WARN_UNUSED_RESULT
+ReadParam(const Message* m, base::PickleIterator* iter, P* p) {
typedef typename SimilarTypeTraits<P>::Type Type;
return ParamTraits<Type>::Read(m, iter, reinterpret_cast<Type* >(p));
}
@@ -117,7 +116,8 @@ struct ParamTraits<bool> {
static void Write(Message* m, const param_type& p) {
m->WriteBool(p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadBool(r);
}
@@ -128,7 +128,7 @@ template <>
struct IPC_EXPORT ParamTraits<unsigned char> {
typedef unsigned char param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -136,7 +136,9 @@ template <>
struct IPC_EXPORT ParamTraits<unsigned short> {
typedef unsigned short param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -146,7 +148,8 @@ struct ParamTraits<int> {
static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadInt(r);
}
@@ -159,7 +162,8 @@ struct ParamTraits<unsigned int> {
static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadInt(reinterpret_cast<int*>(r));
}
@@ -172,7 +176,8 @@ struct ParamTraits<long> {
static void Write(Message* m, const param_type& p) {
m->WriteLongUsingDangerousNonPortableLessPersistableForm(p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadLong(r);
}
@@ -185,7 +190,8 @@ struct ParamTraits<unsigned long> {
static void Write(Message* m, const param_type& p) {
m->WriteLongUsingDangerousNonPortableLessPersistableForm(p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadLong(reinterpret_cast<long*>(r));
}
@@ -198,7 +204,8 @@ struct ParamTraits<long long> {
static void Write(Message* m, const param_type& p) {
m->WriteInt64(static_cast<int64>(p));
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadInt64(reinterpret_cast<int64*>(r));
}
@@ -211,7 +218,8 @@ struct ParamTraits<unsigned long long> {
static void Write(Message* m, const param_type& p) {
m->WriteInt64(p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadInt64(reinterpret_cast<int64*>(r));
}
@@ -227,7 +235,8 @@ struct IPC_EXPORT ParamTraits<float> {
static void Write(Message* m, const param_type& p) {
m->WriteFloat(p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadFloat(r);
}
@@ -238,7 +247,9 @@ template <>
struct IPC_EXPORT ParamTraits<double> {
typedef double param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -250,7 +261,8 @@ struct ParamTraits<std::string> {
static void Write(Message* m, const param_type& p) {
m->WriteString(p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadString(r);
}
@@ -263,7 +275,8 @@ struct ParamTraits<base::string16> {
static void Write(Message* m, const param_type& p) {
m->WriteString16(p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return iter->ReadString16(r);
}
@@ -274,7 +287,9 @@ template <>
struct IPC_EXPORT ParamTraits<std::vector<char> > {
typedef std::vector<char> param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message*, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message*,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -282,7 +297,9 @@ template <>
struct IPC_EXPORT ParamTraits<std::vector<unsigned char> > {
typedef std::vector<unsigned char> param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -290,7 +307,9 @@ template <>
struct IPC_EXPORT ParamTraits<std::vector<bool> > {
typedef std::vector<bool> param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -302,7 +321,8 @@ struct ParamTraits<std::vector<P> > {
for (size_t i = 0; i < p.size(); i++)
WriteParam(m, p[i]);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
int size;
// ReadLength() checks for < 0 itself.
@@ -336,7 +356,8 @@ struct ParamTraits<std::set<P> > {
for (iter = p.begin(); iter != p.end(); ++iter)
WriteParam(m, *iter);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
int size;
if (!iter->ReadLength(&size))
@@ -365,7 +386,8 @@ struct ParamTraits<std::map<K, V, C, A> > {
WriteParam(m, iter->second);
}
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
int size;
if (!ReadParam(m, iter, &size) || size < 0)
@@ -392,7 +414,8 @@ struct ParamTraits<std::pair<A, B> > {
WriteParam(m, p.first);
WriteParam(m, p.second);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return ReadParam(m, iter, &r->first) && ReadParam(m, iter, &r->second);
}
@@ -411,7 +434,9 @@ template <>
struct IPC_EXPORT ParamTraits<base::DictionaryValue> {
typedef base::DictionaryValue param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -435,7 +460,9 @@ template<>
struct IPC_EXPORT ParamTraits<base::FileDescriptor> {
typedef base::FileDescriptor param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
#endif // defined(OS_POSIX)
@@ -444,7 +471,9 @@ template <>
struct IPC_EXPORT ParamTraits<base::FilePath> {
typedef base::FilePath param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -452,7 +481,9 @@ template <>
struct IPC_EXPORT ParamTraits<base::ListValue> {
typedef base::ListValue param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -460,7 +491,8 @@ template <>
struct IPC_EXPORT ParamTraits<base::NullableString16> {
typedef base::NullableString16 param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -469,7 +501,9 @@ template <>
struct IPC_EXPORT ParamTraits<base::File::Info> {
typedef base::File::Info param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -489,7 +523,9 @@ template <>
struct IPC_EXPORT ParamTraits<base::Time> {
typedef base::Time param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -497,7 +533,9 @@ template <>
struct IPC_EXPORT ParamTraits<base::TimeDelta> {
typedef base::TimeDelta param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -505,7 +543,9 @@ template <>
struct IPC_EXPORT ParamTraits<base::TimeTicks> {
typedef base::TimeTicks param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -513,7 +553,9 @@ template <>
struct IPC_EXPORT ParamTraits<base::TraceTicks> {
typedef base::TraceTicks param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -522,7 +564,8 @@ struct ParamTraits<base::Tuple<>> {
typedef base::Tuple<> param_type;
static void Write(Message* m, const param_type& p) {
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return true;
}
@@ -536,7 +579,8 @@ struct ParamTraits<base::Tuple<A>> {
static void Write(Message* m, const param_type& p) {
WriteParam(m, base::get<0>(p));
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return ReadParam(m, iter, &base::get<0>(*r));
}
@@ -552,7 +596,8 @@ struct ParamTraits<base::Tuple<A, B>> {
WriteParam(m, base::get<0>(p));
WriteParam(m, base::get<1>(p));
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return (ReadParam(m, iter, &base::get<0>(*r)) &&
ReadParam(m, iter, &base::get<1>(*r)));
@@ -572,7 +617,8 @@ struct ParamTraits<base::Tuple<A, B, C>> {
WriteParam(m, base::get<1>(p));
WriteParam(m, base::get<2>(p));
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return (ReadParam(m, iter, &base::get<0>(*r)) &&
ReadParam(m, iter, &base::get<1>(*r)) &&
@@ -596,7 +642,8 @@ struct ParamTraits<base::Tuple<A, B, C, D>> {
WriteParam(m, base::get<2>(p));
WriteParam(m, base::get<3>(p));
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return (ReadParam(m, iter, &base::get<0>(*r)) &&
ReadParam(m, iter, &base::get<1>(*r)) &&
@@ -624,7 +671,8 @@ struct ParamTraits<base::Tuple<A, B, C, D, E>> {
WriteParam(m, base::get<3>(p));
WriteParam(m, base::get<4>(p));
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
return (ReadParam(m, iter, &base::get<0>(*r)) &&
ReadParam(m, iter, &base::get<1>(*r)) &&
@@ -653,7 +701,8 @@ struct ParamTraits<ScopedVector<P> > {
for (size_t i = 0; i < p.size(); i++)
WriteParam(m, *p[i]);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
int size = 0;
if (!iter->ReadLength(&size))
@@ -693,7 +742,8 @@ struct ParamTraits<base::SmallMap<NormalMap, kArraySize, EqualKey, MapInit> > {
WriteParam(m, iter->second);
}
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
int size;
if (!iter->ReadLength(&size))
@@ -722,7 +772,8 @@ struct ParamTraits<scoped_ptr<P> > {
if (valid)
WriteParam(m, *p);
}
- static bool Read(const Message* m, base::PickleIterator* iter,
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
param_type* r) {
bool valid = false;
if (!ReadParam(m, iter, &valid))
@@ -757,7 +808,9 @@ template<>
struct IPC_EXPORT ParamTraits<IPC::ChannelHandle> {
typedef ChannelHandle param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -765,14 +818,18 @@ template <>
struct IPC_EXPORT ParamTraits<LogData> {
typedef LogData param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
template <>
struct IPC_EXPORT ParamTraits<Message> {
static void Write(Message* m, const Message& p);
- static bool Read(const Message* m, base::PickleIterator* iter, Message* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ Message* r);
static void Log(const Message& p, std::string* l);
};
@@ -783,7 +840,9 @@ template <>
struct IPC_EXPORT ParamTraits<HANDLE> {
typedef HANDLE param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -791,7 +850,9 @@ template <>
struct IPC_EXPORT ParamTraits<LOGFONT> {
typedef LOGFONT param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
@@ -799,7 +860,9 @@ template <>
struct IPC_EXPORT ParamTraits<MSG> {
typedef MSG param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static bool Read(const Message* m,
+ base::PickleIterator* iter,
+ param_type* r);
static void Log(const param_type& p, std::string* l);
};
#endif // defined(OS_WIN)
« no previous file with comments | « ipc/ipc_message_unittest.cc ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698