Bug 1797433 [wpt PR 36660] - [anchor-position] Add tests for fixed position in multic...
[gecko.git] / ipc / glue / TransportSecurityInfoUtils.cpp
blob692e44e48751f63629ca6565b7b9466baffe2395
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"
10 namespace IPC {
12 void ParamTraits<nsITransportSecurityInfo*>::Write(
13 MessageWriter* aWriter, nsITransportSecurityInfo* aParam) {
14 bool nonNull = !!aParam;
15 WriteParam(aWriter, nonNull);
16 if (!nonNull) {
17 return;
20 aParam->SerializeToIPC(aWriter);
23 bool ParamTraits<nsITransportSecurityInfo*>::Read(
24 MessageReader* aReader, RefPtr<nsITransportSecurityInfo>* aResult) {
25 *aResult = nullptr;
27 bool nonNull = false;
28 if (!ReadParam(aReader, &nonNull)) {
29 return false;
32 if (!nonNull) {
33 return true;
36 if (!mozilla::psm::TransportSecurityInfo::DeserializeFromIPC(aReader,
37 aResult)) {
38 return false;
41 return true;
44 void ParamTraits<nsIX509Cert*>::Write(MessageWriter* aWriter,
45 nsIX509Cert* aParam) {
46 bool nonNull = !!aParam;
47 WriteParam(aWriter, nonNull);
48 if (!nonNull) {
49 return;
52 aParam->SerializeToIPC(aWriter);
55 bool ParamTraits<nsIX509Cert*>::Read(MessageReader* aReader,
56 RefPtr<nsIX509Cert>* aResult) {
57 *aResult = nullptr;
59 bool nonNull = false;
60 if (!ReadParam(aReader, &nonNull)) {
61 return false;
64 if (!nonNull) {
65 return true;
68 RefPtr<nsIX509Cert> cert = new nsNSSCertificate();
69 if (!cert->DeserializeFromIPC(aReader)) {
70 return false;
73 *aResult = std::move(cert);
74 return true;
77 } // namespace IPC