| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_GFX_IPC_GFX_PARAM_TRAITS_H_ | 5 #ifndef UI_GFX_IPC_GFX_PARAM_TRAITS_H_ |
| 6 #define UI_GFX_IPC_GFX_PARAM_TRAITS_H_ | 6 #define UI_GFX_IPC_GFX_PARAM_TRAITS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ipc/ipc_message_utils.h" | 10 #include "ipc/ipc_message_utils.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class Vector2d; | 24 class Vector2d; |
| 25 class Vector2dF; | 25 class Vector2dF; |
| 26 } // namespace gfx | 26 } // namespace gfx |
| 27 | 27 |
| 28 namespace IPC { | 28 namespace IPC { |
| 29 | 29 |
| 30 template <> | 30 template <> |
| 31 struct GFX_IPC_EXPORT ParamTraits<gfx::Point> { | 31 struct GFX_IPC_EXPORT ParamTraits<gfx::Point> { |
| 32 typedef gfx::Point param_type; | 32 typedef gfx::Point param_type; |
| 33 static void Write(Message* m, const param_type& p); | 33 static void Write(Message* m, const param_type& p); |
| 34 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 34 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 35 static void Log(const param_type& p, std::string* l); | 35 static void Log(const param_type& p, std::string* l); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 template <> | 38 template <> |
| 39 struct GFX_IPC_EXPORT ParamTraits<gfx::PointF> { | 39 struct GFX_IPC_EXPORT ParamTraits<gfx::PointF> { |
| 40 typedef gfx::PointF param_type; | 40 typedef gfx::PointF param_type; |
| 41 static void Write(Message* m, const param_type& p); | 41 static void Write(Message* m, const param_type& p); |
| 42 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 42 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 43 static void Log(const param_type& p, std::string* l); | 43 static void Log(const param_type& p, std::string* l); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 template <> | 46 template <> |
| 47 struct GFX_IPC_EXPORT ParamTraits<gfx::Size> { | 47 struct GFX_IPC_EXPORT ParamTraits<gfx::Size> { |
| 48 typedef gfx::Size param_type; | 48 typedef gfx::Size param_type; |
| 49 static void Write(Message* m, const param_type& p); | 49 static void Write(Message* m, const param_type& p); |
| 50 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 50 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 51 static void Log(const param_type& p, std::string* l); | 51 static void Log(const param_type& p, std::string* l); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 template <> | 54 template <> |
| 55 struct GFX_IPC_EXPORT ParamTraits<gfx::SizeF> { | 55 struct GFX_IPC_EXPORT ParamTraits<gfx::SizeF> { |
| 56 typedef gfx::SizeF param_type; | 56 typedef gfx::SizeF param_type; |
| 57 static void Write(Message* m, const param_type& p); | 57 static void Write(Message* m, const param_type& p); |
| 58 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 58 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 59 static void Log(const param_type& p, std::string* l); | 59 static void Log(const param_type& p, std::string* l); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 template <> | 62 template <> |
| 63 struct GFX_IPC_EXPORT ParamTraits<gfx::Vector2d> { | 63 struct GFX_IPC_EXPORT ParamTraits<gfx::Vector2d> { |
| 64 typedef gfx::Vector2d param_type; | 64 typedef gfx::Vector2d param_type; |
| 65 static void Write(Message* m, const param_type& p); | 65 static void Write(Message* m, const param_type& p); |
| 66 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 66 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 67 static void Log(const param_type& p, std::string* l); | 67 static void Log(const param_type& p, std::string* l); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 template <> | 70 template <> |
| 71 struct GFX_IPC_EXPORT ParamTraits<gfx::Vector2dF> { | 71 struct GFX_IPC_EXPORT ParamTraits<gfx::Vector2dF> { |
| 72 typedef gfx::Vector2dF param_type; | 72 typedef gfx::Vector2dF param_type; |
| 73 static void Write(Message* m, const param_type& p); | 73 static void Write(Message* m, const param_type& p); |
| 74 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 74 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 75 static void Log(const param_type& p, std::string* l); | 75 static void Log(const param_type& p, std::string* l); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 template <> | 78 template <> |
| 79 struct GFX_IPC_EXPORT ParamTraits<gfx::Rect> { | 79 struct GFX_IPC_EXPORT ParamTraits<gfx::Rect> { |
| 80 typedef gfx::Rect param_type; | 80 typedef gfx::Rect param_type; |
| 81 static void Write(Message* m, const param_type& p); | 81 static void Write(Message* m, const param_type& p); |
| 82 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 82 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 83 static void Log(const param_type& p, std::string* l); | 83 static void Log(const param_type& p, std::string* l); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 template <> | 86 template <> |
| 87 struct GFX_IPC_EXPORT ParamTraits<gfx::RectF> { | 87 struct GFX_IPC_EXPORT ParamTraits<gfx::RectF> { |
| 88 typedef gfx::RectF param_type; | 88 typedef gfx::RectF param_type; |
| 89 static void Write(Message* m, const param_type& p); | 89 static void Write(Message* m, const param_type& p); |
| 90 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 90 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 91 static void Log(const param_type& p, std::string* l); | 91 static void Log(const param_type& p, std::string* l); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 template <> | 94 template <> |
| 95 struct GFX_IPC_EXPORT ParamTraits<SkBitmap> { | 95 struct GFX_IPC_EXPORT ParamTraits<SkBitmap> { |
| 96 typedef SkBitmap param_type; | 96 typedef SkBitmap param_type; |
| 97 static void Write(Message* m, const param_type& p); | 97 static void Write(Message* m, const param_type& p); |
| 98 | 98 |
| 99 // Note: This function expects parameter |r| to be of type &SkBitmap since | 99 // Note: This function expects parameter |r| to be of type &SkBitmap since |
| 100 // r->SetConfig() and r->SetPixels() are called. | 100 // r->SetConfig() and r->SetPixels() are called. |
| 101 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 101 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 102 | 102 |
| 103 static void Log(const param_type& p, std::string* l); | 103 static void Log(const param_type& p, std::string* l); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 template <> | 106 template <> |
| 107 struct GFX_IPC_EXPORT ParamTraits<gfx::Range> { | 107 struct GFX_IPC_EXPORT ParamTraits<gfx::Range> { |
| 108 typedef gfx::Range param_type; | 108 typedef gfx::Range param_type; |
| 109 static void Write(Message* m, const param_type& p); | 109 static void Write(Message* m, const param_type& p); |
| 110 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 110 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 111 static void Log(const param_type& p, std::string* l); | 111 static void Log(const param_type& p, std::string* l); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace IPC | 114 } // namespace IPC |
| 115 | 115 |
| 116 #endif // UI_GFX_IPC_GFX_PARAM_TRAITS_H_ | 116 #endif // UI_GFX_IPC_GFX_PARAM_TRAITS_H_ |
| OLD | NEW |