/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef GFX_WEBRENDERMESSAGEUTILS_H #define GFX_WEBRENDERMESSAGEUTILS_H #include "chrome/common/ipc_message_utils.h" #include "ipc/EnumSerializer.h" #include "ipc/IPCMessageUtils.h" #include "mozilla/webrender/webrender_ffi.h" #include "mozilla/webrender/WebRenderTypes.h" #include "mozilla/dom/MediaIPCUtils.h" namespace IPC { template <> struct ParamTraits { typedef mozilla::wr::ByteBuffer paramType; static void Write(Message* aMsg, const paramType& aParam) { WriteParam(aMsg, aParam.mLength); aMsg->WriteBytes(aParam.mData, aParam.mLength); } static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) { size_t length; return ReadParam(aMsg, aIter, &length) && aResult->Allocate(length) && aMsg->ReadBytesInto(aIter, aResult->mData, length); } }; template <> struct ParamTraits { typedef mozilla::wr::ImageDescriptor paramType; static void Write(Message* aMsg, const paramType& aParam) { WriteParam(aMsg, aParam.format); WriteParam(aMsg, aParam.width); WriteParam(aMsg, aParam.height); WriteParam(aMsg, aParam.stride); WriteParam(aMsg, aParam.opacity); } static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) { return ReadParam(aMsg, aIter, &aResult->format) && ReadParam(aMsg, aIter, &aResult->width) && ReadParam(aMsg, aIter, &aResult->height) && ReadParam(aMsg, aIter, &aResult->stride) && ReadParam(aMsg, aIter, &aResult->opacity); } }; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer { }; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public ContiguousEnumSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public ContiguousEnumSerializer {}; template <> struct ParamTraits : public ContiguousEnumSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public ContiguousEnumSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; template <> struct ParamTraits : public PlainOldDataSerializer {}; } // namespace IPC #endif // GFX_WEBRENDERMESSAGEUTILS_H