OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
11 // public members.. | 11 // public members.. |
12 | 12 |
13 #ifndef CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ | 13 #ifndef CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ |
14 #define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ | 14 #define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ |
15 #pragma once | 15 #pragma once |
16 | 16 |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/platform_file.h" | 18 #include "base/platform_file.h" |
| 19 #include "content/common/dom_storage_common.h" |
19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
20 #include "ipc/ipc_message_utils.h" | 21 #include "ipc/ipc_message_utils.h" |
21 #include "net/base/ip_endpoint.h" | 22 #include "net/base/ip_endpoint.h" |
22 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
23 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
24 #include "ui/gfx/surface/transport_dib.h" | 25 #include "ui/gfx/surface/transport_dib.h" |
25 #include "webkit/glue/resource_type.h" | 26 #include "webkit/glue/resource_type.h" |
26 | 27 |
27 class SkBitmap; | 28 class SkBitmap; |
28 | 29 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 103 |
103 template <> | 104 template <> |
104 struct ParamTraits<base::PlatformFileInfo> { | 105 struct ParamTraits<base::PlatformFileInfo> { |
105 typedef base::PlatformFileInfo param_type; | 106 typedef base::PlatformFileInfo param_type; |
106 static void Write(Message* m, const param_type& p); | 107 static void Write(Message* m, const param_type& p); |
107 static bool Read(const Message* m, void** iter, param_type* r); | 108 static bool Read(const Message* m, void** iter, param_type* r); |
108 static void Log(const param_type& p, std::string* l); | 109 static void Log(const param_type& p, std::string* l); |
109 }; | 110 }; |
110 | 111 |
111 template <> | 112 template <> |
112 struct SimilarTypeTraits<base::PlatformFileError> { | |
113 typedef int Type; | |
114 }; | |
115 | |
116 template <> | |
117 struct ParamTraits<gfx::Point> { | 113 struct ParamTraits<gfx::Point> { |
118 typedef gfx::Point param_type; | 114 typedef gfx::Point param_type; |
119 static void Write(Message* m, const param_type& p); | 115 static void Write(Message* m, const param_type& p); |
120 static bool Read(const Message* m, void** iter, param_type* r); | 116 static bool Read(const Message* m, void** iter, param_type* r); |
121 static void Log(const param_type& p, std::string* l); | 117 static void Log(const param_type& p, std::string* l); |
122 }; | 118 }; |
123 | 119 |
124 template <> | 120 template <> |
125 struct ParamTraits<gfx::Size> { | 121 struct ParamTraits<gfx::Size> { |
126 typedef gfx::Size param_type; | 122 typedef gfx::Size param_type; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 typedef SkBitmap param_type; | 218 typedef SkBitmap param_type; |
223 static void Write(Message* m, const param_type& p); | 219 static void Write(Message* m, const param_type& p); |
224 | 220 |
225 // Note: This function expects parameter |r| to be of type &SkBitmap since | 221 // Note: This function expects parameter |r| to be of type &SkBitmap since |
226 // r->SetConfig() and r->SetPixels() are called. | 222 // r->SetConfig() and r->SetPixels() are called. |
227 static bool Read(const Message* m, void** iter, param_type* r); | 223 static bool Read(const Message* m, void** iter, param_type* r); |
228 | 224 |
229 static void Log(const param_type& p, std::string* l); | 225 static void Log(const param_type& p, std::string* l); |
230 }; | 226 }; |
231 | 227 |
| 228 template <> |
| 229 struct SimilarTypeTraits<base::PlatformFileError> { |
| 230 typedef int Type; |
| 231 }; |
| 232 |
| 233 template <> |
| 234 struct SimilarTypeTraits<DOMStorageType> { |
| 235 typedef int Type; |
| 236 }; |
| 237 |
232 } // namespace IPC | 238 } // namespace IPC |
233 | 239 |
234 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ | 240 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |