1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "TransportSecurityInfoUtils.h"
7 #include "ipc/IPCMessageUtils.h"
8 #include "mozilla/psm/TransportSecurityInfo.h"
12 void ParamTraits
<nsITransportSecurityInfo
*>::Write(
13 Message
* aMsg
, nsITransportSecurityInfo
* aParam
) {
14 bool nonNull
= !!aParam
;
15 WriteParam(aMsg
, nonNull
);
20 aParam
->SerializeToIPC(aMsg
);
23 bool ParamTraits
<nsITransportSecurityInfo
*>::Read(
24 const Message
* aMsg
, PickleIterator
* aIter
,
25 RefPtr
<nsITransportSecurityInfo
>* aResult
) {
29 if (!ReadParam(aMsg
, aIter
, &nonNull
)) {
37 RefPtr
<nsITransportSecurityInfo
> info
=
38 new mozilla::psm::TransportSecurityInfo();
39 if (!info
->DeserializeFromIPC(aMsg
, aIter
)) {
43 *aResult
= std::move(info
);
47 void ParamTraits
<nsIX509Cert
*>::Write(Message
* aMsg
, nsIX509Cert
* aParam
) {
48 bool nonNull
= !!aParam
;
49 WriteParam(aMsg
, nonNull
);
54 aParam
->SerializeToIPC(aMsg
);
57 bool ParamTraits
<nsIX509Cert
*>::Read(const Message
* aMsg
, PickleIterator
* aIter
,
58 RefPtr
<nsIX509Cert
>* aResult
) {
62 if (!ReadParam(aMsg
, aIter
, &nonNull
)) {
70 RefPtr
<nsIX509Cert
> cert
= new nsNSSCertificate();
71 if (!cert
->DeserializeFromIPC(aMsg
, aIter
)) {
75 *aResult
= std::move(cert
);