Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/layers/WebRenderMessageUtils.h
Line
Count
Source (jump to first uncovered line)
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_WEBRENDERMESSAGEUTILS_H
8
#define GFX_WEBRENDERMESSAGEUTILS_H
9
10
#include "chrome/common/ipc_message_utils.h"
11
12
#include "ipc/IPCMessageUtils.h"
13
#include "mozilla/webrender/webrender_ffi.h"
14
#include "mozilla/webrender/WebRenderTypes.h"
15
16
namespace IPC {
17
18
template<>
19
struct ParamTraits<mozilla::wr::ByteBuffer>
20
{
21
  typedef mozilla::wr::ByteBuffer paramType;
22
23
  static void
24
  Write(Message* aMsg, const paramType& aParam)
25
0
  {
26
0
    WriteParam(aMsg, aParam.mLength);
27
0
    aMsg->WriteBytes(aParam.mData, aParam.mLength);
28
0
  }
29
30
  static bool
31
  Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
32
0
  {
33
0
    size_t length;
34
0
    return ReadParam(aMsg, aIter, &length)
35
0
        && aResult->Allocate(length)
36
0
        && aMsg->ReadBytesInto(aIter, aResult->mData, length);
37
0
  }
38
};
39
40
template<>
41
struct ParamTraits<mozilla::wr::ImageDescriptor>
42
{
43
  typedef mozilla::wr::ImageDescriptor paramType;
44
45
  static void
46
  Write(Message* aMsg, const paramType& aParam)
47
0
  {
48
0
    WriteParam(aMsg, aParam.format);
49
0
    WriteParam(aMsg, aParam.width);
50
0
    WriteParam(aMsg, aParam.height);
51
0
    WriteParam(aMsg, aParam.stride);
52
0
    WriteParam(aMsg, aParam.is_opaque);
53
0
  }
54
55
  static bool
56
  Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
57
0
  {
58
0
    return ReadParam(aMsg, aIter, &aResult->format)
59
0
        && ReadParam(aMsg, aIter, &aResult->width)
60
0
        && ReadParam(aMsg, aIter, &aResult->height)
61
0
        && ReadParam(aMsg, aIter, &aResult->stride)
62
0
        && ReadParam(aMsg, aIter, &aResult->is_opaque);
63
0
  }
64
};
65
66
template<>
67
struct ParamTraits<mozilla::wr::IdNamespace>
68
  : public PlainOldDataSerializer<mozilla::wr::IdNamespace>
69
{
70
};
71
72
template<>
73
struct ParamTraits<mozilla::wr::ImageKey>
74
  : public PlainOldDataSerializer<mozilla::wr::ImageKey>
75
{
76
};
77
78
template<>
79
struct ParamTraits<mozilla::wr::FontKey>
80
  : public PlainOldDataSerializer<mozilla::wr::FontKey>
81
{
82
};
83
84
template<>
85
struct ParamTraits<mozilla::wr::FontInstanceKey>
86
  : public PlainOldDataSerializer<mozilla::wr::FontInstanceKey>
87
{
88
};
89
90
template<>
91
struct ParamTraits<mozilla::wr::FontInstanceOptions>
92
  : public PlainOldDataSerializer<mozilla::wr::FontInstanceOptions>
93
{
94
};
95
96
template<>
97
struct ParamTraits<mozilla::wr::FontInstancePlatformOptions>
98
  : public PlainOldDataSerializer<mozilla::wr::FontInstancePlatformOptions>
99
{
100
};
101
102
template<>
103
struct ParamTraits<mozilla::wr::ExternalImageId>
104
  : public PlainOldDataSerializer<mozilla::wr::ExternalImageId>
105
{
106
};
107
108
template<>
109
struct ParamTraits<mozilla::wr::PipelineId>
110
  : public PlainOldDataSerializer<mozilla::wr::PipelineId>
111
{
112
};
113
114
template<>
115
struct ParamTraits<mozilla::wr::ImageFormat>
116
  : public ContiguousEnumSerializer<
117
        mozilla::wr::ImageFormat,
118
        mozilla::wr::ImageFormat::R8,
119
        mozilla::wr::ImageFormat::Sentinel>
120
{
121
};
122
123
template<>
124
struct ParamTraits<mozilla::wr::LayoutSize>
125
  : public PlainOldDataSerializer<mozilla::wr::LayoutSize>
126
{
127
};
128
129
template<>
130
struct ParamTraits<mozilla::wr::LayoutRect>
131
  : public PlainOldDataSerializer<mozilla::wr::LayoutRect>
132
{
133
};
134
135
template<>
136
struct ParamTraits<mozilla::wr::LayoutPoint>
137
  : public PlainOldDataSerializer<mozilla::wr::LayoutPoint>
138
{
139
};
140
141
template<>
142
struct ParamTraits<mozilla::wr::WrImageMask>
143
  : public PlainOldDataSerializer<mozilla::wr::WrImageMask>
144
{
145
};
146
147
template<>
148
struct ParamTraits<mozilla::wr::ImageRendering>
149
  : public ContiguousEnumSerializer<
150
        mozilla::wr::ImageRendering,
151
        mozilla::wr::ImageRendering::Auto,
152
        mozilla::wr::ImageRendering::Sentinel>
153
{
154
};
155
156
template<>
157
struct ParamTraits<mozilla::wr::MixBlendMode>
158
  : public ContiguousEnumSerializer<
159
        mozilla::wr::MixBlendMode,
160
        mozilla::wr::MixBlendMode::Normal,
161
        mozilla::wr::MixBlendMode::Sentinel>
162
{
163
};
164
165
template<>
166
struct ParamTraits<mozilla::wr::BuiltDisplayListDescriptor>
167
  : public PlainOldDataSerializer<mozilla::wr::BuiltDisplayListDescriptor>
168
{
169
};
170
171
template<>
172
struct ParamTraits<mozilla::wr::WebRenderError>
173
  : public ContiguousEnumSerializer<
174
        mozilla::wr::WebRenderError,
175
        mozilla::wr::WebRenderError::INITIALIZE,
176
        mozilla::wr::WebRenderError::Sentinel>
177
{
178
};
179
180
template<>
181
struct ParamTraits<mozilla::wr::MemoryReport>
182
  : public PlainOldDataSerializer<mozilla::wr::MemoryReport>
183
{
184
};
185
186
} // namespace IPC
187
188
#endif // GFX_WEBRENDERMESSAGEUTILS_H