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

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

Issue 7800015: prune down content_dll change to just the CONTENT_EXPORTS (Closed)
Patch Set: update copyright headers, merge Created 9 years, 3 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
OLDNEW
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/content_export.h"
19 #include "content/common/dom_storage_common.h" 20 #include "content/common/dom_storage_common.h"
20 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
21 #include "ipc/ipc_message_utils.h" 22 #include "ipc/ipc_message_utils.h"
22 #include "net/base/ip_endpoint.h" 23 #include "net/base/ip_endpoint.h"
23 #include "net/url_request/url_request_status.h" 24 #include "net/url_request/url_request_status.h"
24 #include "ui/gfx/native_widget_types.h" 25 #include "ui/gfx/native_widget_types.h"
25 #include "ui/gfx/surface/transport_dib.h" 26 #include "ui/gfx/surface/transport_dib.h"
26 #include "webkit/glue/resource_type.h" 27 #include "webkit/glue/resource_type.h"
27 28
28 class SkBitmap; 29 class SkBitmap;
(...skipping 10 matching lines...) Expand all
39 class UploadData; 40 class UploadData;
40 } 41 }
41 42
42 namespace ui { 43 namespace ui {
43 class Range; 44 class Range;
44 } 45 }
45 46
46 namespace IPC { 47 namespace IPC {
47 48
48 template <> 49 template <>
49 struct ParamTraits<GURL> { 50 struct CONTENT_EXPORT ParamTraits<GURL> {
50 typedef GURL param_type; 51 typedef GURL param_type;
51 static void Write(Message* m, const param_type& p); 52 static void Write(Message* m, const param_type& p);
52 static bool Read(const Message* m, void** iter, param_type* p); 53 static bool Read(const Message* m, void** iter, param_type* p);
53 static void Log(const param_type& p, std::string* l); 54 static void Log(const param_type& p, std::string* l);
54 }; 55 };
55 56
56 template <> 57 template <>
57 struct ParamTraits<ResourceType::Type> { 58 struct ParamTraits<ResourceType::Type> {
58 typedef ResourceType::Type param_type; 59 typedef ResourceType::Type param_type;
59 static void Write(Message* m, const param_type& p); 60 static void Write(Message* m, const param_type& p);
60 static bool Read(const Message* m, void** iter, param_type* p); 61 static bool Read(const Message* m, void** iter, param_type* p);
61 static void Log(const param_type& p, std::string* l); 62 static void Log(const param_type& p, std::string* l);
62 }; 63 };
63 64
64 template <> 65 template <>
65 struct ParamTraits<net::URLRequestStatus> { 66 struct CONTENT_EXPORT ParamTraits<net::URLRequestStatus> {
66 typedef net::URLRequestStatus param_type; 67 typedef net::URLRequestStatus param_type;
67 static void Write(Message* m, const param_type& p); 68 static void Write(Message* m, const param_type& p);
68 static bool Read(const Message* m, void** iter, param_type* r); 69 static bool Read(const Message* m, void** iter, param_type* r);
69 static void Log(const param_type& p, std::string* l); 70 static void Log(const param_type& p, std::string* l);
70 }; 71 };
71 72
72 template <> 73 template <>
73 struct ParamTraits<scoped_refptr<net::UploadData> > { 74 struct CONTENT_EXPORT ParamTraits<scoped_refptr<net::UploadData> > {
74 typedef scoped_refptr<net::UploadData> param_type; 75 typedef scoped_refptr<net::UploadData> param_type;
75 static void Write(Message* m, const param_type& p); 76 static void Write(Message* m, const param_type& p);
76 static bool Read(const Message* m, void** iter, param_type* r); 77 static bool Read(const Message* m, void** iter, param_type* r);
77 static void Log(const param_type& p, std::string* l); 78 static void Log(const param_type& p, std::string* l);
78 }; 79 };
79 80
80 template<> 81 template<>
81 struct ParamTraits<net::HostPortPair> { 82 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> {
82 typedef net::HostPortPair param_type; 83 typedef net::HostPortPair param_type;
83 static void Write(Message* m, const param_type& p); 84 static void Write(Message* m, const param_type& p);
84 static bool Read(const Message* m, void** iter, param_type* r); 85 static bool Read(const Message* m, void** iter, param_type* r);
85 static void Log(const param_type& p, std::string* l); 86 static void Log(const param_type& p, std::string* l);
86 }; 87 };
87 88
88 template <> 89 template <>
89 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { 90 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > {
90 typedef scoped_refptr<net::HttpResponseHeaders> param_type; 91 typedef scoped_refptr<net::HttpResponseHeaders> param_type;
91 static void Write(Message* m, const param_type& p); 92 static void Write(Message* m, const param_type& p);
(...skipping 11 matching lines...) Expand all
103 104
104 template <> 105 template <>
105 struct ParamTraits<base::PlatformFileInfo> { 106 struct ParamTraits<base::PlatformFileInfo> {
106 typedef base::PlatformFileInfo param_type; 107 typedef base::PlatformFileInfo param_type;
107 static void Write(Message* m, const param_type& p); 108 static void Write(Message* m, const param_type& p);
108 static bool Read(const Message* m, void** iter, param_type* r); 109 static bool Read(const Message* m, void** iter, param_type* r);
109 static void Log(const param_type& p, std::string* l); 110 static void Log(const param_type& p, std::string* l);
110 }; 111 };
111 112
112 template <> 113 template <>
113 struct ParamTraits<gfx::Point> { 114 struct CONTENT_EXPORT ParamTraits<gfx::Point> {
114 typedef gfx::Point param_type; 115 typedef gfx::Point param_type;
115 static void Write(Message* m, const param_type& p); 116 static void Write(Message* m, const param_type& p);
116 static bool Read(const Message* m, void** iter, param_type* r); 117 static bool Read(const Message* m, void** iter, param_type* r);
117 static void Log(const param_type& p, std::string* l); 118 static void Log(const param_type& p, std::string* l);
118 }; 119 };
119 120
120 template <> 121 template <>
121 struct ParamTraits<gfx::Size> { 122 struct CONTENT_EXPORT ParamTraits<gfx::Size> {
122 typedef gfx::Size param_type; 123 typedef gfx::Size param_type;
123 static void Write(Message* m, const param_type& p); 124 static void Write(Message* m, const param_type& p);
124 static bool Read(const Message* m, void** iter, param_type* r); 125 static bool Read(const Message* m, void** iter, param_type* r);
125 static void Log(const param_type& p, std::string* l); 126 static void Log(const param_type& p, std::string* l);
126 }; 127 };
127 128
128 template <> 129 template <>
129 struct ParamTraits<gfx::Rect> { 130 struct CONTENT_EXPORT ParamTraits<gfx::Rect> {
130 typedef gfx::Rect param_type; 131 typedef gfx::Rect param_type;
131 static void Write(Message* m, const param_type& p); 132 static void Write(Message* m, const param_type& p);
132 static bool Read(const Message* m, void** iter, param_type* r); 133 static bool Read(const Message* m, void** iter, param_type* r);
133 static void Log(const param_type& p, std::string* l); 134 static void Log(const param_type& p, std::string* l);
134 }; 135 };
135 136
136 template <> 137 template <>
137 struct ParamTraits<gfx::NativeWindow> { 138 struct ParamTraits<gfx::NativeWindow> {
138 typedef gfx::NativeWindow param_type; 139 typedef gfx::NativeWindow param_type;
139 static void Write(Message* m, const param_type& p) { 140 static void Write(Message* m, const param_type& p) {
(...skipping 19 matching lines...) Expand all
159 } 160 }
160 return result; 161 return result;
161 #endif 162 #endif
162 } 163 }
163 static void Log(const param_type& p, std::string* l) { 164 static void Log(const param_type& p, std::string* l) {
164 l->append("<gfx::NativeWindow>"); 165 l->append("<gfx::NativeWindow>");
165 } 166 }
166 }; 167 };
167 168
168 template <> 169 template <>
169 struct ParamTraits<ui::Range> { 170 struct CONTENT_EXPORT ParamTraits<ui::Range> {
170 typedef ui::Range param_type; 171 typedef ui::Range param_type;
171 static void Write(Message* m, const param_type& p); 172 static void Write(Message* m, const param_type& p);
172 static bool Read(const Message* m, void** iter, param_type* r); 173 static bool Read(const Message* m, void** iter, param_type* r);
173 static void Log(const param_type& p, std::string* l); 174 static void Log(const param_type& p, std::string* l);
174 }; 175 };
175 176
176 #if defined(OS_WIN) 177 #if defined(OS_WIN)
177 template<> 178 template<>
178 struct ParamTraits<TransportDIB::Id> { 179 struct ParamTraits<TransportDIB::Id> {
179 typedef TransportDIB::Id param_type; 180 typedef TransportDIB::Id param_type;
(...skipping 27 matching lines...) Expand all
207 } 208 }
208 static void Log(const param_type& p, std::string* l) { 209 static void Log(const param_type& p, std::string* l) {
209 l->append("TransportDIB("); 210 l->append("TransportDIB(");
210 LogParam(p.shmkey, l); 211 LogParam(p.shmkey, l);
211 l->append(")"); 212 l->append(")");
212 } 213 }
213 }; 214 };
214 #endif 215 #endif
215 216
216 template <> 217 template <>
217 struct ParamTraits<SkBitmap> { 218 struct CONTENT_EXPORT ParamTraits<SkBitmap> {
218 typedef SkBitmap param_type; 219 typedef SkBitmap param_type;
219 static void Write(Message* m, const param_type& p); 220 static void Write(Message* m, const param_type& p);
220 221
221 // Note: This function expects parameter |r| to be of type &SkBitmap since 222 // Note: This function expects parameter |r| to be of type &SkBitmap since
222 // r->SetConfig() and r->SetPixels() are called. 223 // r->SetConfig() and r->SetPixels() are called.
223 static bool Read(const Message* m, void** iter, param_type* r); 224 static bool Read(const Message* m, void** iter, param_type* r);
224 225
225 static void Log(const param_type& p, std::string* l); 226 static void Log(const param_type& p, std::string* l);
226 }; 227 };
227 228
228 template <> 229 template <>
229 struct SimilarTypeTraits<base::PlatformFileError> { 230 struct SimilarTypeTraits<base::PlatformFileError> {
230 typedef int Type; 231 typedef int Type;
231 }; 232 };
232 233
233 template <> 234 template <>
234 struct SimilarTypeTraits<DOMStorageType> { 235 struct SimilarTypeTraits<DOMStorageType> {
235 typedef int Type; 236 typedef int Type;
236 }; 237 };
237 238
238 } // namespace IPC 239 } // namespace IPC
239 240
240 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ 241 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698