OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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. |
| 4 |
| 5 #ifndef PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_ |
| 6 #define PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_ |
| 7 |
| 8 #include "ipc/ipc_message_utils.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_input_event.h" |
| 11 #include "ppapi/c/pp_rect.h" |
| 12 #include "ppapi/c/pp_var.h" |
| 13 #include "ppapi/proxy/serialized_var.h" // TODO(brettw) eraseme. |
| 14 |
| 15 class PP_ObjectProperty; |
| 16 |
| 17 namespace pp { |
| 18 namespace proxy { |
| 19 class SerializedVar; |
| 20 } |
| 21 } |
| 22 |
| 23 namespace IPC { |
| 24 |
| 25 template<> |
| 26 struct ParamTraits<PP_InputEvent> { |
| 27 typedef PP_InputEvent param_type; |
| 28 static void Write(Message* m, const param_type& p); |
| 29 static bool Read(const Message* m, void** iter, param_type* r); |
| 30 static void Log(const param_type& p, std::string* l); |
| 31 }; |
| 32 |
| 33 template<> |
| 34 struct ParamTraits<PP_ObjectProperty> { |
| 35 typedef PP_ObjectProperty param_type; |
| 36 static void Write(Message* m, const param_type& p); |
| 37 static bool Read(const Message* m, void** iter, param_type* r); |
| 38 static void Log(const param_type& p, std::string* l); |
| 39 }; |
| 40 |
| 41 template<> |
| 42 struct ParamTraits<PP_Point> { |
| 43 typedef PP_Point param_type; |
| 44 static void Write(Message* m, const param_type& p); |
| 45 static bool Read(const Message* m, void** iter, param_type* r); |
| 46 static void Log(const param_type& p, std::string* l); |
| 47 }; |
| 48 |
| 49 template<> |
| 50 struct ParamTraits<PP_Rect> { |
| 51 typedef PP_Rect param_type; |
| 52 static void Write(Message* m, const param_type& p); |
| 53 static bool Read(const Message* m, void** iter, param_type* r); |
| 54 static void Log(const param_type& p, std::string* l); |
| 55 }; |
| 56 |
| 57 template<> |
| 58 struct ParamTraits<PP_Size> { |
| 59 typedef PP_Size param_type; |
| 60 static void Write(Message* m, const param_type& p); |
| 61 static bool Read(const Message* m, void** iter, param_type* r); |
| 62 static void Log(const param_type& p, std::string* l); |
| 63 }; |
| 64 |
| 65 template<> |
| 66 struct ParamTraits<pp::proxy::SerializedVar> { |
| 67 typedef pp::proxy::SerializedVar param_type; |
| 68 static void Write(Message* m, const param_type& p); |
| 69 static bool Read(const Message* m, void** iter, param_type* r); |
| 70 static void Log(const param_type& p, std::string* l); |
| 71 }; |
| 72 |
| 73 // We need a special implementation of sending a vector of SerializedVars |
| 74 // because the behavior of vector doesn't always play nicely with our |
| 75 // weird SerializedVar implementation (see "Read" in the .cc file). |
| 76 template<> |
| 77 struct ParamTraits< std::vector<pp::proxy::SerializedVar> > { |
| 78 typedef std::vector<pp::proxy::SerializedVar> param_type; |
| 79 static void Write(Message* m, const param_type& p); |
| 80 static bool Read(const Message* m, void** iter, param_type* r); |
| 81 static void Log(const param_type& p, std::string* l); |
| 82 }; |
| 83 |
| 84 } // namespace IPC |
| 85 |
| 86 #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_ |
OLD | NEW |