Use Persistent::Reset.
[chromium-blink-merge.git] / ppapi / proxy / ppapi_param_traits.h
blob196ef9e5ddc3be118bf377ebc581104851f00e2c
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/ppapi_permissions.h"
19 #include "ppapi/shared_impl/ppb_file_ref_shared.h"
21 struct PP_FileInfo;
22 struct PP_NetAddress_Private;
24 namespace ppapi {
26 class HostResource;
27 class PPB_X509Certificate_Fields;
29 namespace proxy {
31 struct PPBFlash_DrawGlyphs_Params;
32 struct PPBURLLoader_UpdateProgress_Params;
33 struct SerializedDirEntry;
34 struct SerializedFontDescription;
35 struct SerializedTrueTypeFontDesc;
36 class SerializedFlashMenu;
37 class SerializedHandle;
38 class SerializedVar;
40 } // namespace proxy
41 } // namespace ppapi
43 namespace IPC {
45 template<>
46 struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> {
47 typedef PP_Bool param_type;
48 static void Write(Message* m, const param_type& p);
49 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
50 static void Log(const param_type& p, std::string* l);
53 template<>
54 struct PPAPI_PROXY_EXPORT ParamTraits<PP_FileInfo> {
55 typedef PP_FileInfo param_type;
56 static void Write(Message* m, const param_type& p);
57 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
58 static void Log(const param_type& p, std::string* l);
61 template <>
62 struct PPAPI_PROXY_EXPORT ParamTraits<PP_NetAddress_Private> {
63 typedef PP_NetAddress_Private param_type;
64 static void Write(Message* m, const param_type& p);
65 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
66 static void Log(const param_type& p, std::string* l);
69 template<>
70 struct PPAPI_PROXY_EXPORT ParamTraits<
71 ppapi::proxy::PPBFlash_DrawGlyphs_Params> {
72 typedef ppapi::proxy::PPBFlash_DrawGlyphs_Params param_type;
73 static void Write(Message* m, const param_type& p);
74 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
75 static void Log(const param_type& p, std::string* l);
78 template<>
79 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PPB_FileRef_CreateInfo> {
80 typedef ppapi::PPB_FileRef_CreateInfo param_type;
81 static void Write(Message* m, const param_type& p);
82 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
83 static void Log(const param_type& p, std::string* l);
86 template<>
87 struct PPAPI_PROXY_EXPORT ParamTraits<
88 ppapi::proxy::PPBURLLoader_UpdateProgress_Params> {
89 typedef ppapi::proxy::PPBURLLoader_UpdateProgress_Params param_type;
90 static void Write(Message* m, const param_type& p);
91 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
92 static void Log(const param_type& p, std::string* l);
95 template<>
96 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedDirEntry> {
97 typedef ppapi::proxy::SerializedDirEntry param_type;
98 static void Write(Message* m, const param_type& p);
99 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
100 static void Log(const param_type& p, std::string* l);
103 template<>
104 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFontDescription> {
105 typedef ppapi::proxy::SerializedFontDescription param_type;
106 static void Write(Message* m, const param_type& p);
107 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
108 static void Log(const param_type& p, std::string* l);
111 template<>
112 struct PPAPI_PROXY_EXPORT
113 ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc> {
114 typedef ppapi::proxy::SerializedTrueTypeFontDesc param_type;
115 static void Write(Message* m, const param_type& p);
116 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
117 static void Log(const param_type& p, std::string* l);
120 template<>
121 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedHandle> {
122 typedef ppapi::proxy::SerializedHandle param_type;
123 static void Write(Message* m, const param_type& p);
124 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
125 static void Log(const param_type& p, std::string* l);
128 template<>
129 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::HostResource> {
130 typedef ppapi::HostResource param_type;
131 static void Write(Message* m, const param_type& p);
132 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
133 static void Log(const param_type& p, std::string* l);
136 template<>
137 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedVar> {
138 typedef ppapi::proxy::SerializedVar param_type;
139 static void Write(Message* m, const param_type& p);
140 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
141 static void Log(const param_type& p, std::string* l);
144 template<>
145 struct PPAPI_PROXY_EXPORT ParamTraits<
146 std::vector<ppapi::proxy::SerializedVar> > {
147 typedef std::vector<ppapi::proxy::SerializedVar> param_type;
148 static void Write(Message* m, const param_type& p);
149 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
150 static void Log(const param_type& p, std::string* l);
153 template<>
154 struct PPAPI_PROXY_EXPORT ParamTraits< std::vector<
155 ppapi::PPB_FileRef_CreateInfo> > {
156 typedef std::vector<ppapi::PPB_FileRef_CreateInfo> param_type;
157 static void Write(Message* m, const param_type& p);
158 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
159 static void Log(const param_type& p, std::string* l);
162 template<>
163 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PpapiPermissions> {
164 typedef ppapi::PpapiPermissions param_type;
165 static void Write(Message* m, const param_type& p);
166 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
167 static void Log(const param_type& p, std::string* l);
170 #if !defined(OS_NACL) && !defined(NACL_WIN64)
171 template <>
172 struct ParamTraits<ppapi::PepperFilePath> {
173 typedef ppapi::PepperFilePath param_type;
174 static void Write(Message* m, const param_type& p);
175 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
176 static void Log(const param_type& p, std::string* l);
179 template<>
180 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFlashMenu> {
181 typedef ppapi::proxy::SerializedFlashMenu param_type;
182 static void Write(Message* m, const param_type& p);
183 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
184 static void Log(const param_type& p, std::string* l);
186 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
188 template<>
189 struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PPB_X509Certificate_Fields> {
190 typedef ppapi::PPB_X509Certificate_Fields param_type;
191 static void Write(Message* m, const param_type& p);
192 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
193 static void Log(const param_type& p, std::string* l);
197 } // namespace IPC
199 #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_