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 // 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 Loading... |
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 Loading... |
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 Loading... |
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_ |
OLD | NEW |