OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "ppapi/proxy/ppapi_param_traits.h" | 5 #include "ppapi/proxy/ppapi_param_traits.h" |
6 | 6 |
7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
8 | 8 |
9 #include "ppapi/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 if (!ParamTraits<bool>::Read(m, iter, &result)) | 90 if (!ParamTraits<bool>::Read(m, iter, &result)) |
91 return false; | 91 return false; |
92 *r = PP_FromBool(result); | 92 *r = PP_FromBool(result); |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
96 // static | 96 // static |
97 void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { | 97 void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { |
98 } | 98 } |
99 | 99 |
100 // PP_KeyInformation ------------------------------------------------------- | |
101 | |
102 // static | |
103 void ParamTraits<PP_KeyInformation>::Write(Message* m, const param_type& p) { | |
104 WriteParam(m, p.key_id_size); | |
105 m->WriteBytes(p.key_id, static_cast<int>(p.key_id_size)); | |
106 WriteParam(m, p.key_status); | |
107 WriteParam(m, p.system_code); | |
dmichael (off chromium)
2015/01/08 18:23:18
Did you try using the IPC_STRUCT_TRAITS_BEGIN/END
jrummell
2015/01/08 18:40:50
I did try it, but got compile errors with ParamTra
| |
108 } | |
109 | |
110 // static | |
111 bool ParamTraits<PP_KeyInformation>::Read(const Message* m, | |
112 PickleIterator* iter, | |
113 param_type* p) { | |
114 uint32 size; | |
dcheng
2015/01/08 19:12:31
uint32_t
jrummell
2015/01/08 20:12:12
Done.
| |
115 if (!ReadParam(m, iter, &size)) | |
116 return false; | |
117 if (size > sizeof(p->key_id)) | |
118 return false; | |
119 p->key_id_size = size; | |
120 | |
121 const char* data; | |
122 if (!iter->ReadBytes(&data, size)) | |
123 return false; | |
124 memcpy(p->key_id, data, size); | |
125 | |
126 PP_CdmKeyStatus key_status; | |
127 if (!ReadParam(m, iter, &key_status)) | |
128 return false; | |
129 p->key_status = key_status; | |
130 | |
131 uint32 system_code; | |
dcheng
2015/01/08 19:12:31
Here too.
jrummell
2015/01/08 20:12:12
Done.
| |
132 if (!ReadParam(m, iter, &system_code)) | |
133 return false; | |
134 p->system_code = system_code; | |
135 | |
136 return true; | |
137 } | |
138 | |
139 // static | |
140 void ParamTraits<PP_KeyInformation>::Log(const param_type& p, std::string* l) { | |
141 l->append("<PP_KeyInformation ("); | |
142 LogParam(p.key_id_size, l); | |
143 l->append(" bytes)>"); | |
144 } | |
145 | |
100 // PP_NetAddress_Private ------------------------------------------------------- | 146 // PP_NetAddress_Private ------------------------------------------------------- |
101 | 147 |
102 // static | 148 // static |
103 void ParamTraits<PP_NetAddress_Private>::Write(Message* m, | 149 void ParamTraits<PP_NetAddress_Private>::Write(Message* m, |
104 const param_type& p) { | 150 const param_type& p) { |
105 WriteParam(m, p.size); | 151 WriteParam(m, p.size); |
106 m->WriteBytes(p.data, static_cast<int>(p.size)); | 152 m->WriteBytes(p.data, static_cast<int>(p.size)); |
107 } | 153 } |
108 | 154 |
109 // static | 155 // static |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 } | 700 } |
655 return true; | 701 return true; |
656 } | 702 } |
657 | 703 |
658 void ParamTraits<ppapi::CompositorLayerData::Transform>::Log( | 704 void ParamTraits<ppapi::CompositorLayerData::Transform>::Log( |
659 const param_type& p, | 705 const param_type& p, |
660 std::string* l) { | 706 std::string* l) { |
661 } | 707 } |
662 | 708 |
663 } // namespace IPC | 709 } // namespace IPC |
OLD | NEW |