Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PSpeechSynthesisParent.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/dom/PSpeechSynthesisParent.h"
8
9
#include "mozilla/dom/PContentParent.h"
10
#include "mozilla/dom/PSpeechSynthesisRequestParent.h"
11
12
#include "nsIFile.h"
13
#include "GeckoProfiler.h"
14
15
namespace mozilla {
16
namespace dom {
17
18
19
auto PSpeechSynthesisParent::Recv__delete__() -> mozilla::ipc::IPCResult
20
0
{
21
0
    return IPC_OK();
22
0
}
23
24
auto PSpeechSynthesisParent::RecvPSpeechSynthesisRequestConstructor(
25
        PSpeechSynthesisRequestParent* actor,
26
        const nsString& aText,
27
        const nsString& aUri,
28
        const nsString& aLang,
29
        const float& aVolume,
30
        const float& aRate,
31
        const float& aPitch,
32
        const bool& aIsChrome) -> mozilla::ipc::IPCResult
33
0
{
34
0
    return IPC_OK();
35
0
}
36
37
auto PSpeechSynthesisParent::ActorDestroy(ActorDestroyReason aWhy) -> void
38
0
{
39
0
}
40
41
MOZ_IMPLICIT PSpeechSynthesisParent::PSpeechSynthesisParent() :
42
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
43
    mLivenessState(mozilla::ipc::LivenessState::Dead)
44
0
{
45
0
    MOZ_COUNT_CTOR(PSpeechSynthesisParent);
46
0
}
47
48
PSpeechSynthesisParent::~PSpeechSynthesisParent()
49
0
{
50
0
    MOZ_COUNT_DTOR(PSpeechSynthesisParent);
51
0
}
52
53
auto PSpeechSynthesisParent::Manager() const -> PContentParent*
54
0
{
55
0
    return static_cast<PContentParent*>(IProtocol::Manager());
56
0
}
57
58
auto PSpeechSynthesisParent::ManagedPSpeechSynthesisRequestParent(nsTArray<PSpeechSynthesisRequestParent*>& aArr) const -> void
59
0
{
60
0
    (mManagedPSpeechSynthesisRequestParent).ToArray(aArr);
61
0
}
62
63
auto PSpeechSynthesisParent::ManagedPSpeechSynthesisRequestParent() const -> const ManagedContainer<PSpeechSynthesisRequestParent>&
64
0
{
65
0
    return mManagedPSpeechSynthesisRequestParent;
66
0
}
67
68
auto PSpeechSynthesisParent::SendVoiceAdded(const RemoteVoice& aVoice) -> bool
69
0
{
70
0
    IPC::Message* msg__ = PSpeechSynthesis::Msg_VoiceAdded(Id());
71
0
72
0
    WriteIPDLParam(msg__, this, aVoice);
73
0
    // Sentinel = 'aVoice'
74
0
    (msg__)->WriteSentinel(3137890747);
75
0
76
0
77
0
78
0
79
0
    if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisParent")) {
80
0
        mozilla::ipc::LogMessageForProtocol("PSpeechSynthesisParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
81
0
    }
82
0
    AUTO_PROFILER_LABEL("PSpeechSynthesis::Msg_VoiceAdded", OTHER);
83
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
84
0
        mozilla::ipc::LogicError("Transition error");
85
0
    }
86
0
87
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
88
0
    return sendok__;
89
0
}
90
91
auto PSpeechSynthesisParent::SendVoiceRemoved(const nsString& aUri) -> bool
92
0
{
93
0
    IPC::Message* msg__ = PSpeechSynthesis::Msg_VoiceRemoved(Id());
94
0
95
0
    WriteIPDLParam(msg__, this, aUri);
96
0
    // Sentinel = 'aUri'
97
0
    (msg__)->WriteSentinel(2043506205);
98
0
99
0
100
0
101
0
102
0
    if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisParent")) {
103
0
        mozilla::ipc::LogMessageForProtocol("PSpeechSynthesisParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
104
0
    }
105
0
    AUTO_PROFILER_LABEL("PSpeechSynthesis::Msg_VoiceRemoved", OTHER);
106
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
107
0
        mozilla::ipc::LogicError("Transition error");
108
0
    }
109
0
110
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
111
0
    return sendok__;
112
0
}
113
114
auto PSpeechSynthesisParent::SendSetDefaultVoice(
115
        const nsString& aUri,
116
        const bool& aIsDefault) -> bool
117
0
{
118
0
    IPC::Message* msg__ = PSpeechSynthesis::Msg_SetDefaultVoice(Id());
119
0
120
0
    WriteIPDLParam(msg__, this, aUri);
121
0
    // Sentinel = 'aUri'
122
0
    (msg__)->WriteSentinel(2043506205);
123
0
    WriteIPDLParam(msg__, this, aIsDefault);
124
0
    // Sentinel = 'aIsDefault'
125
0
    (msg__)->WriteSentinel(1203240634);
126
0
127
0
128
0
129
0
130
0
    if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisParent")) {
131
0
        mozilla::ipc::LogMessageForProtocol("PSpeechSynthesisParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
132
0
    }
133
0
    AUTO_PROFILER_LABEL("PSpeechSynthesis::Msg_SetDefaultVoice", OTHER);
134
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
135
0
        mozilla::ipc::LogicError("Transition error");
136
0
    }
137
0
138
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
139
0
    return sendok__;
140
0
}
141
142
auto PSpeechSynthesisParent::SendIsSpeakingChanged(const bool& aIsSpeaking) -> bool
143
0
{
144
0
    IPC::Message* msg__ = PSpeechSynthesis::Msg_IsSpeakingChanged(Id());
145
0
146
0
    WriteIPDLParam(msg__, this, aIsSpeaking);
147
0
    // Sentinel = 'aIsSpeaking'
148
0
    (msg__)->WriteSentinel(1494791872);
149
0
150
0
151
0
152
0
153
0
    if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisParent")) {
154
0
        mozilla::ipc::LogMessageForProtocol("PSpeechSynthesisParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
155
0
    }
156
0
    AUTO_PROFILER_LABEL("PSpeechSynthesis::Msg_IsSpeakingChanged", OTHER);
157
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
158
0
        mozilla::ipc::LogicError("Transition error");
159
0
    }
160
0
161
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
162
0
    return sendok__;
163
0
}
164
165
auto PSpeechSynthesisParent::SendNotifyVoicesChanged() -> bool
166
0
{
167
0
    IPC::Message* msg__ = PSpeechSynthesis::Msg_NotifyVoicesChanged(Id());
168
0
169
0
170
0
171
0
172
0
173
0
    if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisParent")) {
174
0
        mozilla::ipc::LogMessageForProtocol("PSpeechSynthesisParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
175
0
    }
176
0
    AUTO_PROFILER_LABEL("PSpeechSynthesis::Msg_NotifyVoicesChanged", OTHER);
177
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
178
0
        mozilla::ipc::LogicError("Transition error");
179
0
    }
180
0
181
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
182
0
    return sendok__;
183
0
}
184
185
auto PSpeechSynthesisParent::SendInitialVoicesAndState(
186
        const nsTArray<RemoteVoice>& aVoices,
187
        const nsTArray<nsString>& aDefaults,
188
        const bool& aIsSpeaking) -> bool
189
0
{
190
0
    IPC::Message* msg__ = PSpeechSynthesis::Msg_InitialVoicesAndState(Id());
191
0
192
0
    WriteIPDLParam(msg__, this, aVoices);
193
0
    // Sentinel = 'aVoices'
194
0
    (msg__)->WriteSentinel(1351181827);
195
0
    WriteIPDLParam(msg__, this, aDefaults);
196
0
    // Sentinel = 'aDefaults'
197
0
    (msg__)->WriteSentinel(2428457646);
198
0
    WriteIPDLParam(msg__, this, aIsSpeaking);
199
0
    // Sentinel = 'aIsSpeaking'
200
0
    (msg__)->WriteSentinel(1494791872);
201
0
202
0
203
0
204
0
205
0
    if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisParent")) {
206
0
        mozilla::ipc::LogMessageForProtocol("PSpeechSynthesisParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
207
0
    }
208
0
    AUTO_PROFILER_LABEL("PSpeechSynthesis::Msg_InitialVoicesAndState", OTHER);
209
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
210
0
        mozilla::ipc::LogicError("Transition error");
211
0
    }
212
0
213
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
214
0
    return sendok__;
215
0
}
216
217
auto PSpeechSynthesisParent::RemoveManagee(
218
        int32_t aProtocolId,
219
        IProtocol* aListener) -> void
220
0
{
221
0
    switch (aProtocolId) {
222
0
    case PSpeechSynthesisRequestMsgStart:
223
0
        {
224
0
            PSpeechSynthesisRequestParent* actor = static_cast<PSpeechSynthesisRequestParent*>(aListener);
225
0
            auto& container = mManagedPSpeechSynthesisRequestParent;
226
0
            MOZ_RELEASE_ASSERT((container).Contains(actor), "actor not managed by this!");
227
0
228
0
            (container).RemoveEntry(actor);
229
0
            DeallocPSpeechSynthesisRequestParent(actor);
230
0
            return;
231
0
        }
232
0
    default:
233
0
        {
234
0
            FatalError("unreached");
235
0
            return;
236
0
        }
237
0
    }
238
0
}
239
240
auto PSpeechSynthesisParent::OnMessageReceived(const Message& msg__) -> PSpeechSynthesisParent::Result
241
0
{
242
0
    switch ((msg__).type()) {
243
0
    case PSpeechSynthesis::Msg___delete____ID:
244
0
        {
245
0
            if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisParent")) {
246
0
                mozilla::ipc::LogMessageForProtocol("PSpeechSynthesisParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
247
0
            }
248
0
            AUTO_PROFILER_LABEL("PSpeechSynthesis::Msg___delete__", OTHER);
249
0
250
0
            PickleIterator iter__(msg__);
251
0
            PSpeechSynthesisParent* actor;
252
0
253
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(actor)))))) {
254
0
                FatalError("Error deserializing 'PSpeechSynthesisParent'");
255
0
                return MsgValueError;
256
0
            }
257
0
            if ((!((*((&(actor))))))) {
258
0
                FatalError("Error deserializing 'PSpeechSynthesisParent'");
259
0
                return MsgValueError;
260
0
            }
261
0
            // Sentinel = 'actor'
262
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
263
0
                mozilla::ipc::SentinelReadError("Error deserializing 'PSpeechSynthesisParent'");
264
0
                return MsgValueError;
265
0
            }
266
0
            (msg__).EndRead(iter__, (msg__).type());
267
0
            if ((!(StateTransition(true, (&(mLivenessState)))))) {
268
0
                FatalError("Transition error");
269
0
                return MsgValueError;
270
0
            }
271
0
            if ((!(Recv__delete__()))) {
272
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
273
0
                // Error handled in mozilla::ipc::IPCResult
274
0
                return MsgProcessingError;
275
0
            }
276
0
277
0
278
0
            IProtocol* mgr = (actor)->Manager();
279
0
            (actor)->DestroySubtree(Deletion);
280
0
            (actor)->DeallocSubtree();
281
0
            (mgr)->RemoveManagee(PSpeechSynthesisMsgStart, actor);
282
0
283
0
            return MsgProcessed;
284
0
        }
285
0
    case PSpeechSynthesis::Msg_PSpeechSynthesisRequestConstructor__ID:
286
0
        {
287
0
            if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisParent")) {
288
0
                mozilla::ipc::LogMessageForProtocol("PSpeechSynthesisParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
289
0
            }
290
0
            AUTO_PROFILER_LABEL("PSpeechSynthesis::Msg_PSpeechSynthesisRequestConstructor", OTHER);
291
0
292
0
            PickleIterator iter__(msg__);
293
0
            ActorHandle handle__;
294
0
            PSpeechSynthesisRequestParent* actor;
295
0
            nsString aText;
296
0
            nsString aUri;
297
0
            nsString aLang;
298
0
            float aVolume;
299
0
            float aRate;
300
0
            float aPitch;
301
0
            bool aIsChrome;
302
0
303
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(handle__)))))) {
304
0
                FatalError("Error deserializing 'ActorHandle'");
305
0
                return MsgValueError;
306
0
            }
307
0
            // Sentinel = 'actor'
308
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 875202478)))) {
309
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
310
0
                return MsgValueError;
311
0
            }
312
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aText)))))) {
313
0
                FatalError("Error deserializing 'nsString'");
314
0
                return MsgValueError;
315
0
            }
316
0
            // Sentinel = 'aText'
317
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 711388569)))) {
318
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
319
0
                return MsgValueError;
320
0
            }
321
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aUri)))))) {
322
0
                FatalError("Error deserializing 'nsString'");
323
0
                return MsgValueError;
324
0
            }
325
0
            // Sentinel = 'aUri'
326
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2043506205)))) {
327
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
328
0
                return MsgValueError;
329
0
            }
330
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aLang)))))) {
331
0
                FatalError("Error deserializing 'nsString'");
332
0
                return MsgValueError;
333
0
            }
334
0
            // Sentinel = 'aLang'
335
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2802955996)))) {
336
0
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
337
0
                return MsgValueError;
338
0
            }
339
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aVolume)))))) {
340
0
                FatalError("Error deserializing 'float'");
341
0
                return MsgValueError;
342
0
            }
343
0
            // Sentinel = 'aVolume'
344
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3908369896)))) {
345
0
                mozilla::ipc::SentinelReadError("Error deserializing 'float'");
346
0
                return MsgValueError;
347
0
            }
348
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aRate)))))) {
349
0
                FatalError("Error deserializing 'float'");
350
0
                return MsgValueError;
351
0
            }
352
0
            // Sentinel = 'aRate'
353
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3944748486)))) {
354
0
                mozilla::ipc::SentinelReadError("Error deserializing 'float'");
355
0
                return MsgValueError;
356
0
            }
357
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aPitch)))))) {
358
0
                FatalError("Error deserializing 'float'");
359
0
                return MsgValueError;
360
0
            }
361
0
            // Sentinel = 'aPitch'
362
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1564848579)))) {
363
0
                mozilla::ipc::SentinelReadError("Error deserializing 'float'");
364
0
                return MsgValueError;
365
0
            }
366
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aIsChrome)))))) {
367
0
                FatalError("Error deserializing 'bool'");
368
0
                return MsgValueError;
369
0
            }
370
0
            // Sentinel = 'aIsChrome'
371
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2206250586)))) {
372
0
                mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
373
0
                return MsgValueError;
374
0
            }
375
0
            (msg__).EndRead(iter__, (msg__).type());
376
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
377
0
                FatalError("Transition error");
378
0
                return MsgValueError;
379
0
            }
380
0
            actor = AllocPSpeechSynthesisRequestParent(aText, aUri, aLang, aVolume, aRate, aPitch, aIsChrome);
381
0
            if ((!(actor))) {
382
0
                NS_WARNING("Error constructing actor PSpeechSynthesisRequestParent");
383
0
                return MsgValueError;
384
0
            }
385
0
            (actor)->SetManagerAndRegister(this, (handle__).mId);
386
0
            (mManagedPSpeechSynthesisRequestParent).PutEntry(actor);
387
0
            (actor)->mLivenessState = mozilla::ipc::LivenessState::Start;
388
0
389
0
            if ((!(RecvPSpeechSynthesisRequestConstructor(actor, aText, aUri, aLang, aVolume, aRate, aPitch, aIsChrome)))) {
390
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
391
0
                // Error handled in mozilla::ipc::IPCResult
392
0
                return MsgProcessingError;
393
0
            }
394
0
395
0
            return MsgProcessed;
396
0
        }
397
0
    default:
398
0
        {
399
0
            return MsgNotKnown;
400
0
        }
401
0
    }
402
0
}
403
404
auto PSpeechSynthesisParent::OnMessageReceived(
405
        const Message& msg__,
406
        Message*& reply__) -> PSpeechSynthesisParent::Result
407
0
{
408
0
    return MsgNotKnown;
409
0
}
410
411
auto PSpeechSynthesisParent::OnCallReceived(
412
        const Message& msg__,
413
        Message*& reply__) -> PSpeechSynthesisParent::Result
414
0
{
415
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
416
0
    return MsgNotKnown;
417
0
}
418
419
auto PSpeechSynthesisParent::GetProtocolTypeId() -> int32_t
420
0
{
421
0
    return PSpeechSynthesisMsgStart;
422
0
}
423
424
auto PSpeechSynthesisParent::DestroySubtree(ActorDestroyReason why) -> void
425
0
{
426
0
    // Unregister from our manager.
427
0
    Unregister(Id());
428
0
429
0
    ActorDestroyReason subtreewhy = (((why) == (Deletion)) || ((why) == (FailedConstructor)) ? AncestorDeletion : why);
430
0
431
0
    {
432
0
        // Recursively shutting down PSpeechSynthesisRequest kids
433
0
        nsTArray<PSpeechSynthesisRequestParent*> kids;
434
0
        // Accumulate kids into a stable structure to iterate over
435
0
        ManagedPSpeechSynthesisRequestParent(kids);
436
0
        for (auto& kid : kids) {
437
0
            // Guarding against a child removing a sibling from the list during the iteration.
438
0
            if ((mManagedPSpeechSynthesisRequestParent).Contains(kid)) {
439
0
                (kid)->DestroySubtree(subtreewhy);
440
0
            }
441
0
        }
442
0
    }
443
0
444
0
    // Reject owning pending responses.
445
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
446
0
447
0
    // Finally, destroy "us".
448
0
    ActorDestroy(why);
449
0
}
450
451
auto PSpeechSynthesisParent::DeallocSubtree() -> void
452
0
{
453
0
    {
454
0
        // Recursively deleting PSpeechSynthesisRequest kids
455
0
        for (auto iter = (mManagedPSpeechSynthesisRequestParent).Iter(); (!((iter).Done())); (iter).Next()) {
456
0
            (((iter).Get())->GetKey())->DeallocSubtree();
457
0
        }
458
0
459
0
        for (auto iter = (mManagedPSpeechSynthesisRequestParent).Iter(); (!((iter).Done())); (iter).Next()) {
460
0
            DeallocPSpeechSynthesisRequestParent(((iter).Get())->GetKey());
461
0
        }
462
0
        (mManagedPSpeechSynthesisRequestParent).Clear();
463
0
    }
464
0
}
465
466
467
468
} // namespace dom
469
} // namespace mozilla
470
namespace mozilla {
471
namespace ipc {
472
auto IPDLParamTraits<mozilla::dom::PSpeechSynthesisParent>::Write(
473
        IPC::Message* aMsg,
474
        mozilla::ipc::IProtocol* aActor,
475
        const paramType& aVar) -> void
476
0
{
477
0
    int32_t id;
478
0
    if ((!(aVar))) {
479
0
        id = 0;
480
0
    }
481
0
    else {
482
0
        id = (aVar)->Id();
483
0
        if ((1) == (id)) {
484
0
            (aActor)->FatalError("actor has been |delete|d");
485
0
        }
486
0
    }
487
0
    WriteIPDLParam(aMsg, aActor, id);
488
0
}
489
490
auto IPDLParamTraits<mozilla::dom::PSpeechSynthesisParent>::Read(
491
        const IPC::Message* aMsg,
492
        PickleIterator* aIter,
493
        mozilla::ipc::IProtocol* aActor,
494
        paramType* aVar) -> bool
495
0
{
496
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PSpeechSynthesis", PSpeechSynthesisMsgStart);
497
0
    if ((actor).isNothing()) {
498
0
        return false;
499
0
    }
500
0
501
0
    (*(aVar)) = static_cast<mozilla::dom::PSpeechSynthesisParent*>((actor).value());
502
0
    return true;
503
0
}
504
505
} // namespace ipc
506
} // namespace mozilla