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

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

Issue 10818011: Allow floating point rectangles to be sent via IPC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: using ParamTraits<float> instead of Pickle. Created 8 years, 5 months 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 | « no previous file | content/public/common/common_param_traits.cc » ('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 // This file is used to define IPC::ParamTraits<> specializations for a number 5 // This file is used to define IPC::ParamTraits<> specializations for a number
6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> 6 // of types so that they can be serialized over IPC. IPC::ParamTraits<>
7 // specializations for basic types (like int and std::string) and types in the 7 // specializations for basic types (like int and std::string) and types in the
8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains 8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains
9 // specializations for types that are used by the content code, and which need 9 // specializations for types that are used by the content code, and which need
10 // manual serialization code. This is usually because they're not structs with 10 // manual serialization code. This is usually because they're not structs with
(...skipping 15 matching lines...) Expand all
26 26
27 class SkBitmap; 27 class SkBitmap;
28 28
29 namespace content { 29 namespace content {
30 struct Referrer; 30 struct Referrer;
31 } 31 }
32 32
33 namespace gfx { 33 namespace gfx {
34 class Point; 34 class Point;
35 class Rect; 35 class Rect;
36 class RectF;
36 class Size; 37 class Size;
37 } // namespace gfx 38 } // namespace gfx
38 39
39 namespace net { 40 namespace net {
40 class HttpResponseHeaders; 41 class HttpResponseHeaders;
41 class HostPortPair; 42 class HostPortPair;
42 class UploadData; 43 class UploadData;
43 } 44 }
44 45
45 namespace ui { 46 namespace ui {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 123
123 template <> 124 template <>
124 struct CONTENT_EXPORT ParamTraits<gfx::Rect> { 125 struct CONTENT_EXPORT ParamTraits<gfx::Rect> {
125 typedef gfx::Rect param_type; 126 typedef gfx::Rect param_type;
126 static void Write(Message* m, const param_type& p); 127 static void Write(Message* m, const param_type& p);
127 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 128 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
128 static void Log(const param_type& p, std::string* l); 129 static void Log(const param_type& p, std::string* l);
129 }; 130 };
130 131
131 template <> 132 template <>
133 struct CONTENT_EXPORT ParamTraits<gfx::RectF> {
134 typedef gfx::RectF param_type;
135 static void Write(Message* m, const param_type& p);
136 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
137 static void Log(const param_type& p, std::string* l);
138 };
139
140 template <>
132 struct ParamTraits<gfx::NativeWindow> { 141 struct ParamTraits<gfx::NativeWindow> {
133 typedef gfx::NativeWindow param_type; 142 typedef gfx::NativeWindow param_type;
134 static void Write(Message* m, const param_type& p) { 143 static void Write(Message* m, const param_type& p) {
135 #if defined(OS_WIN) 144 #if defined(OS_WIN)
136 // HWNDs are always 32 bits on Windows, even on 64 bit systems. 145 // HWNDs are always 32 bits on Windows, even on 64 bit systems.
137 m->WriteUInt32(reinterpret_cast<uint32>(p)); 146 m->WriteUInt32(reinterpret_cast<uint32>(p));
138 #else 147 #else
139 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p)); 148 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p));
140 #endif 149 #endif
141 } 150 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Note: This function expects parameter |r| to be of type &SkBitmap since 225 // Note: This function expects parameter |r| to be of type &SkBitmap since
217 // r->SetConfig() and r->SetPixels() are called. 226 // r->SetConfig() and r->SetPixels() are called.
218 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 227 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
219 228
220 static void Log(const param_type& p, std::string* l); 229 static void Log(const param_type& p, std::string* l);
221 }; 230 };
222 231
223 } // namespace IPC 232 } // namespace IPC
224 233
225 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ 234 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_
OLDNEW
« no previous file with comments | « no previous file | content/public/common/common_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698