diff options
Diffstat (limited to 'ppapi/proxy/ppapi_param_traits.cc')
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc index 94ec2e6..c3e5af1 100644 --- a/ppapi/proxy/ppapi_param_traits.cc +++ b/ppapi/proxy/ppapi_param_traits.cc @@ -97,6 +97,52 @@ bool ParamTraits<PP_Bool>::Read(const Message* m, void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { } +// PP_KeyInformation ------------------------------------------------------- + +// static +void ParamTraits<PP_KeyInformation>::Write(Message* m, const param_type& p) { + WriteParam(m, p.key_id_size); + m->WriteBytes(p.key_id, static_cast<int>(p.key_id_size)); + WriteParam(m, p.key_status); + WriteParam(m, p.system_code); +} + +// static +bool ParamTraits<PP_KeyInformation>::Read(const Message* m, + PickleIterator* iter, + param_type* p) { + uint32_t size; + if (!ReadParam(m, iter, &size)) + return false; + if (size > sizeof(p->key_id)) + return false; + p->key_id_size = size; + + const char* data; + if (!iter->ReadBytes(&data, size)) + return false; + memcpy(p->key_id, data, size); + + PP_CdmKeyStatus key_status; + if (!ReadParam(m, iter, &key_status)) + return false; + p->key_status = key_status; + + uint32_t system_code; + if (!ReadParam(m, iter, &system_code)) + return false; + p->system_code = system_code; + + return true; +} + +// static +void ParamTraits<PP_KeyInformation>::Log(const param_type& p, std::string* l) { + l->append("<PP_KeyInformation ("); + LogParam(p.key_id_size, l); + l->append(" bytes)>"); +} + // PP_NetAddress_Private ------------------------------------------------------- // static |