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"
9 #include "nsNSSCertificate.h"
13 void ParamTraits
<nsITransportSecurityInfo
*>::Write(
14 MessageWriter
* aWriter
, nsITransportSecurityInfo
* aParam
) {
15 bool nonNull
= !!aParam
;
16 WriteParam(aWriter
, nonNull
);
21 aParam
->SerializeToIPC(aWriter
);
24 bool ParamTraits
<nsITransportSecurityInfo
*>::Read(
25 MessageReader
* aReader
, RefPtr
<nsITransportSecurityInfo
>* aResult
) {
29 if (!ReadParam(aReader
, &nonNull
)) {
37 if (!mozilla::psm::TransportSecurityInfo::DeserializeFromIPC(aReader
,
45 void ParamTraits
<nsIX509Cert
*>::Write(MessageWriter
* aWriter
,
46 nsIX509Cert
* aParam
) {
47 bool nonNull
= !!aParam
;
48 WriteParam(aWriter
, nonNull
);
53 aParam
->SerializeToIPC(aWriter
);
56 bool ParamTraits
<nsIX509Cert
*>::Read(MessageReader
* aReader
,
57 RefPtr
<nsIX509Cert
>* aResult
) {
61 if (!ReadParam(aReader
, &nonNull
)) {
69 RefPtr
<nsIX509Cert
> cert
= new nsNSSCertificate();
70 if (!cert
->DeserializeFromIPC(aReader
)) {
74 *aResult
= std::move(cert
);