Chromium Code Reviews| Index: ipc/ipc_message_utils.h |
| diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h |
| index d8b660740d8b67d1c739efe44be20c950a1f153b..4adeabe630483b1220ca8f4f7d1248a69796555e 100644 |
| --- a/ipc/ipc_message_utils.h |
| +++ b/ipc/ipc_message_utils.h |
| @@ -19,6 +19,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" |
| @@ -976,6 +977,27 @@ struct ParamTraits<scoped_ptr<P> > { |
| } |
| }; |
| +template <typename TypeMarker, typename WrappedType, WrappedType kInvalidValue> |
| +struct ParamTraits<base::IdType<TypeMarker, WrappedType, kInvalidValue>> { |
| + typedef base::IdType<TypeMarker, WrappedType, kInvalidValue> param_type; |
| + typedef ParamTraits<WrappedType> base_param_traits; |
| + static void Write(base::Pickle* m, const param_type& p) { |
| + base_param_traits::Write(m, p.GetUnsafeValue()); |
| + } |
| + static bool Read(const base::Pickle* 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); |
| + } |
| +}; |
|
Nico
2016/02/09 20:04:29
This isn't more type-safe than just sending the in
Łukasz Anforowicz
2016/02/09 23:06:32
It *is* more type-safe to use gpu::CommandBufferId
|
| + |
| // IPC types ParamTraits ------------------------------------------------------- |
| // A ChannelHandle is basically a platform-inspecific wrapper around the |