summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_message_utils.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index b05f76d..102992d 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -11,6 +11,7 @@
#include <string>
#include <vector>
+#include "base/containers/small_map.h"
#include "base/files/file.h"
#include "base/format_macros.h"
#include "base/memory/scoped_vector.h"
@@ -670,6 +671,41 @@ struct ParamTraits<ScopedVector<P> > {
}
};
+template <typename NormalMap,
+ int kArraySize,
+ typename EqualKey,
+ typename MapInit>
+struct ParamTraits<base::SmallMap<NormalMap, kArraySize, EqualKey, MapInit> > {
+ typedef base::SmallMap<NormalMap, kArraySize, EqualKey, MapInit> param_type;
+ typedef typename param_type::key_type K;
+ typedef typename param_type::data_type V;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, static_cast<int>(p.size()));
+ typename param_type::const_iterator iter;
+ for (iter = p.begin(); iter != p.end(); ++iter) {
+ WriteParam(m, iter->first);
+ WriteParam(m, iter->second);
+ }
+ }
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
+ int size;
+ if (!m->ReadLength(iter, &size))
+ return false;
+ for (int i = 0; i < size; ++i) {
+ K key;
+ if (!ReadParam(m, iter, &key))
+ return false;
+ V& value = (*r)[key];
+ if (!ReadParam(m, iter, &value))
+ return false;
+ }
+ return true;
+ }
+ static void Log(const param_type& p, std::string* l) {
+ l->append("<base::SmallMap>");
+ }
+};
+
// IPC types ParamTraits -------------------------------------------------------
// A ChannelHandle is basically a platform-inspecific wrapper around the