OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/public/common/common_param_traits.h" | 5 #include "content/public/common/common_param_traits.h" |
6 | 6 |
7 #include "content/public/common/content_constants.h" | 7 #include "content/public/common/content_constants.h" |
8 #include "content/public/common/referrer.h" | 8 #include "content/public/common/referrer.h" |
9 #include "net/base/host_port_pair.h" | 9 #include "net/base/host_port_pair.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return false; | 144 return false; |
145 r->set_width(w); | 145 r->set_width(w); |
146 r->set_height(h); | 146 r->set_height(h); |
147 return true; | 147 return true; |
148 } | 148 } |
149 | 149 |
150 void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) { | 150 void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) { |
151 l->append(base::StringPrintf("(%d, %d)", p.width(), p.height())); | 151 l->append(base::StringPrintf("(%d, %d)", p.width(), p.height())); |
152 } | 152 } |
153 | 153 |
| 154 void ParamTraits<gfx::Vector2d>::Write(Message* m, const gfx::Vector2d& v) { |
| 155 m->WriteInt(v.x()); |
| 156 m->WriteInt(v.y()); |
| 157 } |
| 158 |
| 159 bool ParamTraits<gfx::Vector2d>::Read(const Message* m, PickleIterator* iter, |
| 160 gfx::Vector2d* r) { |
| 161 int x, y; |
| 162 if (!m->ReadInt(iter, &x) || |
| 163 !m->ReadInt(iter, &y)) |
| 164 return false; |
| 165 r->set_x(x); |
| 166 r->set_y(y); |
| 167 return true; |
| 168 } |
| 169 |
| 170 void ParamTraits<gfx::Vector2d>::Log(const gfx::Vector2d& v, std::string* l) { |
| 171 l->append(base::StringPrintf("(%d, %d)", v.x(), v.y())); |
| 172 } |
| 173 |
154 void ParamTraits<gfx::Rect>::Write(Message* m, const gfx::Rect& p) { | 174 void ParamTraits<gfx::Rect>::Write(Message* m, const gfx::Rect& p) { |
155 m->WriteInt(p.x()); | 175 m->WriteInt(p.x()); |
156 m->WriteInt(p.y()); | 176 m->WriteInt(p.y()); |
157 m->WriteInt(p.width()); | 177 m->WriteInt(p.width()); |
158 m->WriteInt(p.height()); | 178 m->WriteInt(p.height()); |
159 } | 179 } |
160 | 180 |
161 bool ParamTraits<gfx::Rect>::Read(const Message* m, | 181 bool ParamTraits<gfx::Rect>::Read(const Message* m, |
162 PickleIterator* iter, | 182 PickleIterator* iter, |
163 gfx::Rect* r) { | 183 gfx::Rect* r) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 283 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
264 #include "content/public/common/common_param_traits_macros.h" | 284 #include "content/public/common/common_param_traits_macros.h" |
265 } // namespace IPC | 285 } // namespace IPC |
266 | 286 |
267 // Generate param traits log methods. | 287 // Generate param traits log methods. |
268 #include "ipc/param_traits_log_macros.h" | 288 #include "ipc/param_traits_log_macros.h" |
269 namespace IPC { | 289 namespace IPC { |
270 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 290 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
271 #include "content/public/common/common_param_traits_macros.h" | 291 #include "content/public/common/common_param_traits_macros.h" |
272 } // namespace IPC | 292 } // namespace IPC |
OLD | NEW |