Chromium Code Reviews| Index: ui/gfx/ipc/gfx_param_traits.cc |
| diff --git a/ui/gfx/ipc/gfx_param_traits.cc b/ui/gfx/ipc/gfx_param_traits.cc |
| index abcb24aaebb6db8d772f73b6a042c0c17c9ce4e7..f0f929d85a391a15b7655b7998d2aaeb91cac49f 100644 |
| --- a/ui/gfx/ipc/gfx_param_traits.cc |
| +++ b/ui/gfx/ipc/gfx_param_traits.cc |
| @@ -9,6 +9,7 @@ |
| #include <string> |
| +#include "ui/gfx/ipc/geometry/gfx_param_traits.h" |
| #include "ui/gfx/range/range.h" |
| #if defined(OS_MACOSX) |
| @@ -76,6 +77,55 @@ void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Log( |
| } |
| #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| +void ParamTraits<gfx::SelectionBound>::GetSize(base::PickleSizer* s, |
| + const param_type& p) { |
| + GetParamSize(s, static_cast<uint32_t>(p.type())); |
| + GetParamSize(s, p.edge_top()); |
| + GetParamSize(s, p.edge_bottom()); |
| + GetParamSize(s, p.visible()); |
| +} |
| + |
| +void ParamTraits<gfx::SelectionBound>::Write(base::Pickle* m, |
| + const param_type& p) { |
| + WriteParam(m, static_cast<uint32_t>(p.type())); |
| + WriteParam(m, p.edge_top()); |
| + WriteParam(m, p.edge_bottom()); |
| + WriteParam(m, p.visible()); |
| +} |
| + |
| +bool ParamTraits<gfx::SelectionBound>::Read(const base::Pickle* m, |
| + base::PickleIterator* iter, |
| + param_type* r) { |
| + uint32_t type; |
| + gfx::PointF edge_top; |
| + gfx::PointF edge_bottom; |
| + bool visible = false; |
| + |
| + if (!ReadParam(m, iter, &type) || !ReadParam(m, iter, &edge_top) || |
| + !ReadParam(m, iter, &edge_bottom) || !ReadParam(m, iter, &visible)) { |
| + return false; |
| + } |
| + |
| + r->set_type(static_cast<gfx::SelectionBound::Type>(type)); |
|
Tom Sepez
2016/06/03 17:17:06
We should add traits for the type enum in IDL usin
Fady Samuel
2016/06/03 17:39:06
Done. Added IPC_ENUM_TRAITS_MAX_VALUE to ui/gfx/ip
|
| + r->SetEdgeTop(edge_top); |
| + r->SetEdgeBottom(edge_bottom); |
| + r->set_visible(visible); |
| + return true; |
| +} |
| + |
| +void ParamTraits<gfx::SelectionBound>::Log(const param_type& p, |
| + std::string* l) { |
| + l->append("gfx::SelectionBound("); |
| + LogParam(static_cast<uint32_t>(p.type()), l); |
| + l->append(", "); |
| + LogParam(p.edge_top(), l); |
| + l->append(", "); |
| + LogParam(p.edge_bottom(), l); |
| + l->append(", "); |
| + LogParam(p.visible(), l); |
| + l->append(")"); |
| +} |
| + |
| } // namespace IPC |
| // Generate param traits size methods. |