Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PProcessHangMonitorChild.cpp
Line
Count
Source (jump to first uncovered line)
1
//
2
// Automatically generated by ipdlc.
3
// Edit at your own risk
4
//
5
6
7
#include "mozilla/PProcessHangMonitorChild.h"
8
9
10
#include "nsIFile.h"
11
#include "GeckoProfiler.h"
12
13
namespace mozilla {
14
15
16
auto PProcessHangMonitorChild::ActorDestroy(ActorDestroyReason aWhy) -> void
17
0
{
18
0
}
19
20
auto PProcessHangMonitorChild::ProcessingError(
21
        Result aCode,
22
        const char* aReason) -> void
23
0
{
24
0
}
25
26
auto PProcessHangMonitorChild::ShouldContinueFromReplyTimeout() -> bool
27
0
{
28
0
    return true;
29
0
}
30
31
auto PProcessHangMonitorChild::EnteredCxxStack() -> void
32
0
{
33
0
}
34
35
auto PProcessHangMonitorChild::ExitedCxxStack() -> void
36
0
{
37
0
}
38
39
auto PProcessHangMonitorChild::EnteredCall() -> void
40
0
{
41
0
}
42
43
auto PProcessHangMonitorChild::ExitedCall() -> void
44
0
{
45
0
}
46
47
MOZ_IMPLICIT PProcessHangMonitorChild::PProcessHangMonitorChild() :
48
    mozilla::ipc::IToplevelProtocol("PProcessHangMonitorChild", PProcessHangMonitorMsgStart, mozilla::ipc::ChildSide),
49
    mLivenessState(mozilla::ipc::LivenessState::Start)
50
0
{
51
0
    MOZ_COUNT_CTOR(PProcessHangMonitorChild);
52
0
}
53
54
PProcessHangMonitorChild::~PProcessHangMonitorChild()
55
0
{
56
0
    MOZ_COUNT_DTOR(PProcessHangMonitorChild);
57
0
}
58
59
auto PProcessHangMonitorChild::SendHangEvidence(const HangData& data) -> bool
60
0
{
61
0
    IPC::Message* msg__ = PProcessHangMonitor::Msg_HangEvidence(MSG_ROUTING_CONTROL);
62
0
63
0
    WriteIPDLParam(msg__, this, data);
64
0
    // Sentinel = 'data'
65
0
    (msg__)->WriteSentinel(843352540);
66
0
67
0
68
0
69
0
70
0
    if (mozilla::ipc::LoggingEnabledFor("PProcessHangMonitorChild")) {
71
0
        mozilla::ipc::LogMessageForProtocol("PProcessHangMonitorChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
72
0
    }
73
0
    AUTO_PROFILER_LABEL("PProcessHangMonitor::Msg_HangEvidence", OTHER);
74
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
75
0
        mozilla::ipc::LogicError("Transition error");
76
0
    }
77
0
78
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
79
0
    return sendok__;
80
0
}
81
82
auto PProcessHangMonitorChild::SendClearHang() -> bool
83
0
{
84
0
    IPC::Message* msg__ = PProcessHangMonitor::Msg_ClearHang(MSG_ROUTING_CONTROL);
85
0
86
0
87
0
88
0
89
0
90
0
    if (mozilla::ipc::LoggingEnabledFor("PProcessHangMonitorChild")) {
91
0
        mozilla::ipc::LogMessageForProtocol("PProcessHangMonitorChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
92
0
    }
93
0
    AUTO_PROFILER_LABEL("PProcessHangMonitor::Msg_ClearHang", OTHER);
94
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
95
0
        mozilla::ipc::LogicError("Transition error");
96
0
    }
97
0
98
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
99
0
    return sendok__;
100
0
}
101
102
auto PProcessHangMonitorChild::RemoveManagee(
103
        int32_t aProtocolId,
104
        IProtocol* aListener) -> void
105
0
{
106
0
    FatalError("unreached");
107
0
    return;
108
0
}
109
110
auto PProcessHangMonitorChild::OnMessageReceived(const Message& msg__) -> PProcessHangMonitorChild::Result
111
0
{
112
0
    switch ((msg__).type()) {
113
0
    case PProcessHangMonitor::Msg_TerminateScript__ID:
114
0
        {
115
0
            if (mozilla::ipc::LoggingEnabledFor("PProcessHangMonitorChild")) {
116
0
                mozilla::ipc::LogMessageForProtocol("PProcessHangMonitorChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
117
0
            }
118
0
            AUTO_PROFILER_LABEL("PProcessHangMonitor::Msg_TerminateScript", OTHER);
119
0
120
0
            PickleIterator iter__(msg__);
121
0
            bool aTerminateGlobal;
122
0
123
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aTerminateGlobal)))))) {
124
0
                FatalError("Error deserializing 'bool'");
125
0
                return MsgValueError;
126
0
            }
127
0
            // Sentinel = 'aTerminateGlobal'
128
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1388894779)))) {
129
0
                mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
130
0
                return MsgValueError;
131
0
            }
132
0
            (msg__).EndRead(iter__, (msg__).type());
133
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
134
0
                FatalError("Transition error");
135
0
                return MsgValueError;
136
0
            }
137
0
            if ((!(RecvTerminateScript(aTerminateGlobal)))) {
138
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
139
0
                // Error handled in mozilla::ipc::IPCResult
140
0
                return MsgProcessingError;
141
0
            }
142
0
143
0
            return MsgProcessed;
144
0
        }
145
0
    case PProcessHangMonitor::Msg_BeginStartingDebugger__ID:
146
0
        {
147
0
            if (mozilla::ipc::LoggingEnabledFor("PProcessHangMonitorChild")) {
148
0
                mozilla::ipc::LogMessageForProtocol("PProcessHangMonitorChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
149
0
            }
150
0
            AUTO_PROFILER_LABEL("PProcessHangMonitor::Msg_BeginStartingDebugger", OTHER);
151
0
152
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
153
0
                FatalError("Transition error");
154
0
                return MsgValueError;
155
0
            }
156
0
            if ((!(RecvBeginStartingDebugger()))) {
157
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
158
0
                // Error handled in mozilla::ipc::IPCResult
159
0
                return MsgProcessingError;
160
0
            }
161
0
162
0
            return MsgProcessed;
163
0
        }
164
0
    case PProcessHangMonitor::Msg_EndStartingDebugger__ID:
165
0
        {
166
0
            if (mozilla::ipc::LoggingEnabledFor("PProcessHangMonitorChild")) {
167
0
                mozilla::ipc::LogMessageForProtocol("PProcessHangMonitorChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
168
0
            }
169
0
            AUTO_PROFILER_LABEL("PProcessHangMonitor::Msg_EndStartingDebugger", OTHER);
170
0
171
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
172
0
                FatalError("Transition error");
173
0
                return MsgValueError;
174
0
            }
175
0
            if ((!(RecvEndStartingDebugger()))) {
176
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
177
0
                // Error handled in mozilla::ipc::IPCResult
178
0
                return MsgProcessingError;
179
0
            }
180
0
181
0
            return MsgProcessed;
182
0
        }
183
0
    case PProcessHangMonitor::Msg_PaintWhileInterruptingJS__ID:
184
0
        {
185
0
            if (mozilla::ipc::LoggingEnabledFor("PProcessHangMonitorChild")) {
186
0
                mozilla::ipc::LogMessageForProtocol("PProcessHangMonitorChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
187
0
            }
188
0
            AUTO_PROFILER_LABEL("PProcessHangMonitor::Msg_PaintWhileInterruptingJS", OTHER);
189
0
190
0
            PickleIterator iter__(msg__);
191
0
            TabId tabId;
192
0
            bool forceRepaint;
193
0
            LayersObserverEpoch aEpoch;
194
0
195
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(tabId)))))) {
196
0
                FatalError("Error deserializing 'TabId'");
197
0
                return MsgValueError;
198
0
            }
199
0
            // Sentinel = 'tabId'
200
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3419081923)))) {
201
0
                mozilla::ipc::SentinelReadError("Error deserializing 'TabId'");
202
0
                return MsgValueError;
203
0
            }
204
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(forceRepaint)))))) {
205
0
                FatalError("Error deserializing 'bool'");
206
0
                return MsgValueError;
207
0
            }
208
0
            // Sentinel = 'forceRepaint'
209
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1474735206)))) {
210
0
                mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
211
0
                return MsgValueError;
212
0
            }
213
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aEpoch)))))) {
214
0
                FatalError("Error deserializing 'LayersObserverEpoch'");
215
0
                return MsgValueError;
216
0
            }
217
0
            // Sentinel = 'aEpoch'
218
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2333012390)))) {
219
0
                mozilla::ipc::SentinelReadError("Error deserializing 'LayersObserverEpoch'");
220
0
                return MsgValueError;
221
0
            }
222
0
            (msg__).EndRead(iter__, (msg__).type());
223
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
224
0
                FatalError("Transition error");
225
0
                return MsgValueError;
226
0
            }
227
0
            if ((!(RecvPaintWhileInterruptingJS(tabId, forceRepaint, aEpoch)))) {
228
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
229
0
                // Error handled in mozilla::ipc::IPCResult
230
0
                return MsgProcessingError;
231
0
            }
232
0
233
0
            return MsgProcessed;
234
0
        }
235
0
    default:
236
0
        {
237
0
            return MsgNotKnown;
238
0
        }
239
0
    case SHMEM_CREATED_MESSAGE_TYPE:
240
0
        {
241
0
            FatalError("this protocol tree does not use shmem");
242
0
            return MsgNotKnown;
243
0
        }
244
0
    case SHMEM_DESTROYED_MESSAGE_TYPE:
245
0
        {
246
0
            FatalError("this protocol tree does not use shmem");
247
0
            return MsgNotKnown;
248
0
        }
249
0
    }
250
0
}
251
252
auto PProcessHangMonitorChild::OnMessageReceived(
253
        const Message& msg__,
254
        Message*& reply__) -> PProcessHangMonitorChild::Result
255
0
{
256
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
257
0
    return MsgNotKnown;
258
0
}
259
260
auto PProcessHangMonitorChild::OnCallReceived(
261
        const Message& msg__,
262
        Message*& reply__) -> PProcessHangMonitorChild::Result
263
0
{
264
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
265
0
    return MsgNotKnown;
266
0
}
267
268
auto PProcessHangMonitorChild::GetProtocolTypeId() -> int32_t
269
0
{
270
0
    return PProcessHangMonitorMsgStart;
271
0
}
272
273
auto PProcessHangMonitorChild::OnChannelClose() -> void
274
0
{
275
0
    DestroySubtree(NormalShutdown);
276
0
    DeallocSubtree();
277
0
    DeallocShmems();
278
0
    DeallocPProcessHangMonitorChild();
279
0
}
280
281
auto PProcessHangMonitorChild::OnChannelError() -> void
282
0
{
283
0
    DestroySubtree(AbnormalShutdown);
284
0
    DeallocSubtree();
285
0
    DeallocShmems();
286
0
    DeallocPProcessHangMonitorChild();
287
0
}
288
289
auto PProcessHangMonitorChild::DestroySubtree(ActorDestroyReason why) -> void
290
0
{
291
0
    // Reject owning pending responses.
292
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
293
0
294
0
    // Finally, destroy "us".
295
0
    ActorDestroy(why);
296
0
}
297
298
auto PProcessHangMonitorChild::DeallocSubtree() -> void
299
0
{
300
0
}
301
302
auto PProcessHangMonitorChild::DeallocPProcessHangMonitorChild() -> void
303
0
{
304
0
}
305
306
307
308
} // namespace mozilla
309
namespace mozilla {
310
namespace ipc {
311
auto IPDLParamTraits<mozilla::PProcessHangMonitorChild>::Write(
312
        IPC::Message* aMsg,
313
        mozilla::ipc::IProtocol* aActor,
314
        const paramType& aVar) -> void
315
0
{
316
0
    int32_t id;
317
0
    if ((!(aVar))) {
318
0
        id = 0;
319
0
    }
320
0
    else {
321
0
        id = (aVar)->Id();
322
0
        if ((1) == (id)) {
323
0
            (aActor)->FatalError("actor has been |delete|d");
324
0
        }
325
0
    }
326
0
    WriteIPDLParam(aMsg, aActor, id);
327
0
}
328
329
auto IPDLParamTraits<mozilla::PProcessHangMonitorChild>::Read(
330
        const IPC::Message* aMsg,
331
        PickleIterator* aIter,
332
        mozilla::ipc::IProtocol* aActor,
333
        paramType* aVar) -> bool
334
0
{
335
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PProcessHangMonitor", PProcessHangMonitorMsgStart);
336
0
    if ((actor).isNothing()) {
337
0
        return false;
338
0
    }
339
0
340
0
    (*(aVar)) = static_cast<mozilla::PProcessHangMonitorChild*>((actor).value());
341
0
    return true;
342
0
}
343
344
} // namespace ipc
345
} // namespace mozilla