Index: ipc/ipc_message_utils.h |
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h |
index 97b95e986a9237ee881594416e93ebefbf99b875..567e89d9f7a0400718d01fc73f0d4bb3cc55fd06 100644 |
--- a/ipc/ipc_message_utils.h |
+++ b/ipc/ipc_message_utils.h |
@@ -17,6 +17,7 @@ |
#include "base/containers/stack_container.h" |
#include "base/files/file.h" |
#include "base/format_macros.h" |
+#include "base/id_type.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/scoped_vector.h" |
#include "base/strings/string16.h" |
@@ -858,6 +859,31 @@ struct ParamTraits<scoped_ptr<P> > { |
} |
}; |
+template <typename TypeBeingIdentified, |
+ typename WrappedType, |
+ WrappedType kInvalidValue> |
+struct ParamTraits< |
+ base::IdType<TypeBeingIdentified, WrappedType, kInvalidValue>> { |
+ typedef base::IdType<TypeBeingIdentified, WrappedType, kInvalidValue> |
+ param_type; |
+ typedef ParamTraits<WrappedType> base_param_traits; |
+ static void Write(Message* m, const param_type& p) { |
+ base_param_traits::Write(m, p.GetUnsafeValue()); |
+ } |
+ static bool Read(const Message* m, |
+ base::PickleIterator* iter, |
+ param_type* r) { |
+ WrappedType value; |
+ if (!base_param_traits::Read(m, iter, &value)) |
+ return false; |
+ *r = param_type::FromUnsafeValue(value); |
+ return true; |
+ } |
+ static void Log(const param_type& p, std::string* l) { |
+ base_param_traits::Log(p.GetUnsafeValue(), l); |
+ } |
+}; |
+ |
// IPC types ParamTraits ------------------------------------------------------- |
// A ChannelHandle is basically a platform-inspecific wrapper around the |