Roll Clang 206824:209387
[chromium-blink-merge.git] / ppapi / proxy / ppapi_param_traits.h
blob96ff11c9618f22ebb913c4dded11851a9cfde2c7
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
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_
6 #define PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_
8 #include <string>
9 #include <vector>
11 #include "ipc/ipc_message_utils.h"
12 #include "ipc/ipc_platform_file.h"
13 #include "ppapi/c/pp_completion_callback.h"
14 #include "ppapi/c/pp_rect.h"
15 #include "ppapi/c/pp_var.h"
16 #include "ppapi/proxy/ppapi_proxy_export.h"
17 #include "ppapi/shared_impl/file_path.h"
18 #include "ppapi/shared_impl/file_ref_create_info.h"
19 #include "ppapi/shared_impl/media_stream_video_track_shared.h"
20 #include "ppapi/shared_impl/ppapi_permissions.h"
21 #include "ppapi/shared_impl/socket_option_data.h"
23 struct PP_NetAddress_Private;
25 namespace ppapi {
27 class HostResource;
28 class PPB_X509Certificate_Fields;
30 namespace proxy {
32 struct PPBFlash_DrawGlyphs_Params;
33 struct PPBURLLoader_UpdateProgress_Params;
34 struct SerializedDirEntry;
35 struct SerializedFontDescription;
36 struct SerializedTrueTypeFontDesc;
37 class SerializedFlashMenu;
38 class SerializedHandle;
39 class SerializedVar;
41 } // namespace proxy
42 } // namespace ppapi
44 namespace IPC {
46 template<>
47 struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> {
48 typedef PP_Bool param_type;
49 static void Write(Message* m, const param_type& p);
50 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
51 static void Log(const param_type& p, std::string* l);
54 template <>
55 struct PPAPI_PROXY_EXPORT ParamTraits<PP_NetAddress_Private> {
56 typedef PP_NetAddress_Private param_type;
57 static void Write(Message* m, const param_type& p);
58 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
59 static void Log(const param_type& p, std::string* l);
62 template<>
63 struct PPAPI_PROXY_EXPORT ParamTraits<
64 ppapi::proxy::PPBFlash_DrawGlyphs_Params> {
65 typedef ppapi::proxy::PPBFlash_DrawGlyphs_Params param_type;
66 static void Write(Message* m, const param_type& p);
67 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
68 static void Log(const param_type& p, std::string* l);
71 template<>
72 struct PPAPI_PROXY_EXPORT ParamTraits<
73 ppapi::proxy::PPBURLLoader_UpdateProgress_Params> {
74 typedef ppapi::proxy::PPBURLLoader_UpdateProgress_Params param_type;
75 static void Write(Message* m, const param_type& p);
76 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
77 static void Log(const param_type& p, std::string* l);
80 template<>
81 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedDirEntry> {
82 typedef ppapi::proxy::SerializedDirEntry param_type;
83 static void Write(Message* m, const param_type& p);
84 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
85 static void Log(const param_type& p, std::string* l);
88 template<>
89 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFontDescription> {
90 typedef ppapi::proxy::SerializedFontDescription param_type;
91 static void Write(Message* m, const param_type& p);
92 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
93 static void Log(const param_type& p, std::string* l);
96 template<>
97 struct PPAPI_PROXY_EXPORT
98 ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc> {
99 typedef ppapi::proxy::SerializedTrueTypeFontDesc param_type;
100 static void Write(Message* m, const param_type& p);
101 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
102 static void Log(const param_type& p, std::string* l);
105 template<>
106 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedHandle> {
107 typedef ppapi::proxy::SerializedHandle param_type;
108 static void Write(Message* m, const param_type& p);
109 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
110 static void Log(const param_type& p, std::string* l);
113 template<>
114 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::HostResource> {
115 typedef ppapi::HostResource param_type;
116 static void Write(Message* m, const param_type& p);
117 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
118 static void Log(const param_type& p, std::string* l);
121 template<>
122 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedVar> {
123 typedef ppapi::proxy::SerializedVar param_type;
124 static void Write(Message* m, const param_type& p);
125 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
126 static void Log(const param_type& p, std::string* l);
129 template<>
130 struct PPAPI_PROXY_EXPORT ParamTraits<
131 std::vector<ppapi::proxy::SerializedVar> > {
132 typedef std::vector<ppapi::proxy::SerializedVar> param_type;
133 static void Write(Message* m, const param_type& p);
134 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
135 static void Log(const param_type& p, std::string* l);
138 template<>
139 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PpapiPermissions> {
140 typedef ppapi::PpapiPermissions param_type;
141 static void Write(Message* m, const param_type& p);
142 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
143 static void Log(const param_type& p, std::string* l);
146 #if !defined(OS_NACL) && !defined(NACL_WIN64)
147 template <>
148 struct ParamTraits<ppapi::PepperFilePath> {
149 typedef ppapi::PepperFilePath param_type;
150 static void Write(Message* m, const param_type& p);
151 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
152 static void Log(const param_type& p, std::string* l);
155 template<>
156 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFlashMenu> {
157 typedef ppapi::proxy::SerializedFlashMenu param_type;
158 static void Write(Message* m, const param_type& p);
159 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
160 static void Log(const param_type& p, std::string* l);
162 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
164 template<>
165 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PPB_X509Certificate_Fields> {
166 typedef ppapi::PPB_X509Certificate_Fields param_type;
167 static void Write(Message* m, const param_type& p);
168 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
169 static void Log(const param_type& p, std::string* l);
172 template<>
173 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::SocketOptionData> {
174 typedef ppapi::SocketOptionData param_type;
175 static void Write(Message* m, const param_type& p);
176 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
177 static void Log(const param_type& p, std::string* l);
180 } // namespace IPC
182 #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_