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 RefPtr
<nsITransportSecurityInfo
> info
=
37 new mozilla::psm::TransportSecurityInfo();
38 if (!info
->DeserializeFromIPC(aReader
)) {
42 *aResult
= std::move(info
);
46 void ParamTraits
<nsIX509Cert
*>::Write(MessageWriter
* aWriter
,
47 nsIX509Cert
* aParam
) {
48 bool nonNull
= !!aParam
;
49 WriteParam(aWriter
, nonNull
);
54 aParam
->SerializeToIPC(aWriter
);
57 bool ParamTraits
<nsIX509Cert
*>::Read(MessageReader
* aReader
,
58 RefPtr
<nsIX509Cert
>* aResult
) {
62 if (!ReadParam(aReader
, &nonNull
)) {
70 RefPtr
<nsIX509Cert
> cert
= new nsNSSCertificate();
71 if (!cert
->DeserializeFromIPC(aReader
)) {
75 *aResult
= std::move(cert
);