Bug 1743256 [wpt PR 31764] - Implement contain-intrinsic-size: auto, a=testonly
[gecko.git] / ipc / glue / Transport_posix.h
blobdceb6e125671511a109c6ebfb50ed40b116fed89
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_ipc_Transport_posix_h
8 #define mozilla_ipc_Transport_posix_h 1
10 #include "ipc/IPCMessageUtils.h"
12 namespace mozilla {
13 namespace ipc {
15 struct TransportDescriptor {
16 int mFd;
19 } // namespace ipc
20 } // namespace mozilla
22 namespace IPC {
24 template <>
25 struct ParamTraits<mozilla::ipc::TransportDescriptor> {
26 typedef mozilla::ipc::TransportDescriptor paramType;
27 static void Write(Message* aMsg, const paramType& aParam) {
28 WriteParam(aMsg, mozilla::UniqueFileHandle{aParam.mFd});
30 static bool Read(const Message* aMsg, PickleIterator* aIter,
31 paramType* aResult) {
32 mozilla::UniqueFileHandle fd;
33 if (!ReadParam(aMsg, aIter, &fd)) {
34 return false;
36 aResult->mFd = fd.release();
37 return true;
41 } // namespace IPC
43 #endif // mozilla_ipc_Transport_posix_h