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 MessageWriter
* aWriter
, nsITransportSecurityInfo
* aParam
) {
14 bool nonNull
= !!aParam
;
15 WriteParam(aWriter
, nonNull
);
20 aParam
->SerializeToIPC(aWriter
);
23 bool ParamTraits
<nsITransportSecurityInfo
*>::Read(
24 MessageReader
* aReader
, RefPtr
<nsITransportSecurityInfo
>* aResult
) {
28 if (!ReadParam(aReader
, &nonNull
)) {
36 if (!mozilla::psm::TransportSecurityInfo::DeserializeFromIPC(aReader
,
44 void ParamTraits
<nsIX509Cert
*>::Write(MessageWriter
* aWriter
,
45 nsIX509Cert
* aParam
) {
46 bool nonNull
= !!aParam
;
47 WriteParam(aWriter
, nonNull
);
52 aParam
->SerializeToIPC(aWriter
);
55 bool ParamTraits
<nsIX509Cert
*>::Read(MessageReader
* aReader
,
56 RefPtr
<nsIX509Cert
>* aResult
) {
60 if (!ReadParam(aReader
, &nonNull
)) {
68 RefPtr
<nsIX509Cert
> cert
= new nsNSSCertificate();
69 if (!cert
->DeserializeFromIPC(aReader
)) {
73 *aResult
= std::move(cert
);