Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: content/public/common/common_param_traits.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/common/common_param_traits.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) {
piman 2012/10/31 18:07:23 nit: indentation
Peter Kasting 2012/10/31 18:09:28 Also, one arg per line if they don't all fit on on
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
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
OLDNEW
« no previous file with comments | « content/public/common/common_param_traits.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698