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/. */
6 
7 #ifndef GFX_RENDERROOTTYPES_H
8 #define GFX_RENDERROOTTYPES_H
9 
10 #include "mozilla/webrender/WebRenderAPI.h"
11 #include "mozilla/webrender/WebRenderTypes.h"
12 #include "mozilla/layers/WebRenderMessages.h"
13 #include "mozilla/layers/WebRenderScrollData.h"
14 
15 namespace mozilla {
16 
17 namespace layers {
18 
19 struct DisplayListData {
20   wr::IdNamespace mIdNamespace;
21   LayoutDeviceRect mRect;
22   nsTArray<WebRenderParentCommand> mCommands;
23   Maybe<mozilla::ipc::ByteBuf> mDLItems;
24   Maybe<mozilla::ipc::ByteBuf> mDLCache;
25   Maybe<mozilla::ipc::ByteBuf> mDLSpatialTree;
26   wr::BuiltDisplayListDescriptor mDLDesc;
27   nsTArray<wr::PipelineId> mRemotePipelineIds;
28   nsTArray<OpUpdateResource> mResourceUpdates;
29   nsTArray<RefCountedShmem> mSmallShmems;
30   nsTArray<mozilla::ipc::Shmem> mLargeShmems;
31   Maybe<WebRenderScrollData> mScrollData;
32 };
33 
34 struct TransactionData {
35   wr::IdNamespace mIdNamespace;
36   nsTArray<WebRenderParentCommand> mCommands;
37   nsTArray<OpUpdateResource> mResourceUpdates;
38   nsTArray<RefCountedShmem> mSmallShmems;
39   nsTArray<mozilla::ipc::Shmem> mLargeShmems;
40   ScrollUpdatesMap mScrollUpdates;
41   uint32_t mPaintSequenceNumber;
42 };
43 
44 typedef Maybe<TransactionData> MaybeTransactionData;
45 
46 }  // namespace layers
47 
48 namespace ipc {
49 
50 template <>
51 struct IPDLParamTraits<mozilla::layers::DisplayListData> {
52   typedef mozilla::layers::DisplayListData paramType;
53 
54   static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
55                     paramType&& aParam);
56 
57   static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
58                    paramType* aResult);
59 };
60 
61 template <>
62 struct IPDLParamTraits<mozilla::layers::TransactionData> {
63   typedef mozilla::layers::TransactionData paramType;
64 
65   static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
66                     paramType&& aParam);
67 
68   static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
69                    paramType* aResult);
70 };
71 
72 }  // namespace ipc
73 }  // namespace mozilla
74 
75 #endif /* GFX_RENDERROOTTYPES_H */
76