Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PRemoteSpellcheckEngineChild.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/PRemoteSpellcheckEngineChild.h"
8
9
#include "mozilla/dom/PContentChild.h"
10
11
#include "nsIFile.h"
12
#include "GeckoProfiler.h"
13
14
namespace mozilla {
15
16
17
auto PRemoteSpellcheckEngineChild::ActorDestroy(ActorDestroyReason aWhy) -> void
18
0
{
19
0
}
20
21
MOZ_IMPLICIT PRemoteSpellcheckEngineChild::PRemoteSpellcheckEngineChild() :
22
    mozilla::ipc::IProtocol(mozilla::ipc::ChildSide),
23
    mLivenessState(mozilla::ipc::LivenessState::Dead)
24
0
{
25
0
    MOZ_COUNT_CTOR(PRemoteSpellcheckEngineChild);
26
0
}
27
28
PRemoteSpellcheckEngineChild::~PRemoteSpellcheckEngineChild()
29
0
{
30
0
    MOZ_COUNT_DTOR(PRemoteSpellcheckEngineChild);
31
0
}
32
33
auto PRemoteSpellcheckEngineChild::Manager() const -> PContentChild*
34
0
{
35
0
    return static_cast<PContentChild*>(IProtocol::Manager());
36
0
}
37
38
auto PRemoteSpellcheckEngineChild::Send__delete__(PRemoteSpellcheckEngineChild* actor) -> bool
39
0
{
40
0
    if ((!(actor))) {
41
0
        return false;
42
0
    }
43
0
44
0
    IPC::Message* msg__ = PRemoteSpellcheckEngine::Msg___delete__((actor)->Id());
45
0
46
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
47
0
    WriteIPDLParam(msg__, actor, actor);
48
0
    // Sentinel = 'actor'
49
0
    (msg__)->WriteSentinel(875202478);
50
0
51
0
52
0
53
0
    if (mozilla::ipc::LoggingEnabledFor("PRemoteSpellcheckEngineChild")) {
54
0
        mozilla::ipc::LogMessageForProtocol("PRemoteSpellcheckEngineChild", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
55
0
    }
56
0
    AUTO_PROFILER_LABEL("PRemoteSpellcheckEngine::Msg___delete__", OTHER);
57
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
58
0
        mozilla::ipc::LogicError("Transition error");
59
0
    }
60
0
61
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
62
0
63
0
    IProtocol* mgr = (actor)->Manager();
64
0
    (actor)->DestroySubtree(Deletion);
65
0
    (actor)->DeallocSubtree();
66
0
    (mgr)->RemoveManagee(PRemoteSpellcheckEngineMsgStart, actor);
67
0
    return sendok__;
68
0
}
69
70
auto PRemoteSpellcheckEngineChild::SendCheck(
71
        const nsString& aWord,
72
        bool* aIsMisspelled) -> bool
73
0
{
74
0
    IPC::Message* msg__ = PRemoteSpellcheckEngine::Msg_Check(Id());
75
0
76
0
    WriteIPDLParam(msg__, this, aWord);
77
0
    // Sentinel = 'aWord'
78
0
    (msg__)->WriteSentinel(741220960);
79
0
80
0
81
0
82
0
    Message reply__;
83
0
84
0
    if (mozilla::ipc::LoggingEnabledFor("PRemoteSpellcheckEngineChild")) {
85
0
        mozilla::ipc::LogMessageForProtocol("PRemoteSpellcheckEngineChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
86
0
    }
87
0
    AUTO_PROFILER_LABEL("PRemoteSpellcheckEngine::Msg_Check", OTHER);
88
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
89
0
        mozilla::ipc::LogicError("Transition error");
90
0
    }
91
0
92
0
    bool sendok__;
93
0
    {
94
0
        AUTO_PROFILER_TRACING("IPC", "PRemoteSpellcheckEngine::Msg_Check");
95
0
        sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__)));
96
0
    }
97
0
    if ((!(sendok__))) {
98
0
        return false;
99
0
    }
100
0
101
0
    if (mozilla::ipc::LoggingEnabledFor("PRemoteSpellcheckEngineChild")) {
102
0
        mozilla::ipc::LogMessageForProtocol("PRemoteSpellcheckEngineChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
103
0
    }
104
0
105
0
    PickleIterator iter__(reply__);
106
0
107
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aIsMisspelled)))) {
108
0
        FatalError("Error deserializing 'bool'");
109
0
        return false;
110
0
    }
111
0
    // Sentinel = 'aIsMisspelled'
112
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3664203874)))) {
113
0
        mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
114
0
        return false;
115
0
    }
116
0
    (reply__).EndRead(iter__, (reply__).type());
117
0
118
0
    return true;
119
0
}
120
121
auto PRemoteSpellcheckEngineChild::SendCheckAndSuggest(
122
        const nsString& aWord,
123
        bool* aIsMisspelled,
124
        nsTArray<nsString>* aSuggestions) -> bool
125
0
{
126
0
    IPC::Message* msg__ = PRemoteSpellcheckEngine::Msg_CheckAndSuggest(Id());
127
0
128
0
    WriteIPDLParam(msg__, this, aWord);
129
0
    // Sentinel = 'aWord'
130
0
    (msg__)->WriteSentinel(741220960);
131
0
132
0
133
0
134
0
    Message reply__;
135
0
136
0
    if (mozilla::ipc::LoggingEnabledFor("PRemoteSpellcheckEngineChild")) {
137
0
        mozilla::ipc::LogMessageForProtocol("PRemoteSpellcheckEngineChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
138
0
    }
139
0
    AUTO_PROFILER_LABEL("PRemoteSpellcheckEngine::Msg_CheckAndSuggest", OTHER);
140
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
141
0
        mozilla::ipc::LogicError("Transition error");
142
0
    }
143
0
144
0
    bool sendok__;
145
0
    {
146
0
        AUTO_PROFILER_TRACING("IPC", "PRemoteSpellcheckEngine::Msg_CheckAndSuggest");
147
0
        sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__)));
148
0
    }
149
0
    if ((!(sendok__))) {
150
0
        return false;
151
0
    }
152
0
153
0
    if (mozilla::ipc::LoggingEnabledFor("PRemoteSpellcheckEngineChild")) {
154
0
        mozilla::ipc::LogMessageForProtocol("PRemoteSpellcheckEngineChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
155
0
    }
156
0
157
0
    PickleIterator iter__(reply__);
158
0
159
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aIsMisspelled)))) {
160
0
        FatalError("Error deserializing 'bool'");
161
0
        return false;
162
0
    }
163
0
    // Sentinel = 'aIsMisspelled'
164
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3664203874)))) {
165
0
        mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
166
0
        return false;
167
0
    }
168
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, aSuggestions)))) {
169
0
        FatalError("Error deserializing 'nsTArray'");
170
0
        return false;
171
0
    }
172
0
    // Sentinel = 'aSuggestions'
173
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 2353668628)))) {
174
0
        mozilla::ipc::SentinelReadError("Error deserializing 'nsTArray'");
175
0
        return false;
176
0
    }
177
0
    (reply__).EndRead(iter__, (reply__).type());
178
0
179
0
    return true;
180
0
}
181
182
auto PRemoteSpellcheckEngineChild::SendSetDictionary(
183
        const nsString& aDictionary,
184
        bool* success) -> bool
185
0
{
186
0
    IPC::Message* msg__ = PRemoteSpellcheckEngine::Msg_SetDictionary(Id());
187
0
188
0
    WriteIPDLParam(msg__, this, aDictionary);
189
0
    // Sentinel = 'aDictionary'
190
0
    (msg__)->WriteSentinel(1521730514);
191
0
192
0
193
0
194
0
    Message reply__;
195
0
196
0
    if (mozilla::ipc::LoggingEnabledFor("PRemoteSpellcheckEngineChild")) {
197
0
        mozilla::ipc::LogMessageForProtocol("PRemoteSpellcheckEngineChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
198
0
    }
199
0
    AUTO_PROFILER_LABEL("PRemoteSpellcheckEngine::Msg_SetDictionary", OTHER);
200
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
201
0
        mozilla::ipc::LogicError("Transition error");
202
0
    }
203
0
204
0
    bool sendok__;
205
0
    {
206
0
        AUTO_PROFILER_TRACING("IPC", "PRemoteSpellcheckEngine::Msg_SetDictionary");
207
0
        sendok__ = (GetIPCChannel())->Send(msg__, (&(reply__)));
208
0
    }
209
0
    if ((!(sendok__))) {
210
0
        return false;
211
0
    }
212
0
213
0
    if (mozilla::ipc::LoggingEnabledFor("PRemoteSpellcheckEngineChild")) {
214
0
        mozilla::ipc::LogMessageForProtocol("PRemoteSpellcheckEngineChild", OtherPid(), "Received reply ", ((&(reply__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
215
0
    }
216
0
217
0
    PickleIterator iter__(reply__);
218
0
219
0
    if ((!(ReadIPDLParam((&(reply__)), (&(iter__)), this, success)))) {
220
0
        FatalError("Error deserializing 'bool'");
221
0
        return false;
222
0
    }
223
0
    // Sentinel = 'success'
224
0
    if ((!(((&(reply__)))->ReadSentinel((&(iter__)), 3877396070)))) {
225
0
        mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
226
0
        return false;
227
0
    }
228
0
    (reply__).EndRead(iter__, (reply__).type());
229
0
230
0
    return true;
231
0
}
232
233
auto PRemoteSpellcheckEngineChild::SendSetDictionaryFromList(
234
        const nsTArray<nsString>& aList,
235
        mozilla::ipc::ResolveCallback<Tuple<bool, nsString>>&& aResolve,
236
        mozilla::ipc::RejectCallback&& aReject) -> void
237
0
{
238
0
    IPC::Message* msg__ = PRemoteSpellcheckEngine::Msg_SetDictionaryFromList(Id());
239
0
240
0
    WriteIPDLParam(msg__, this, aList);
241
0
    // Sentinel = 'aList'
242
0
    (msg__)->WriteSentinel(4100027884);
243
0
244
0
245
0
246
0
247
0
    if (mozilla::ipc::LoggingEnabledFor("PRemoteSpellcheckEngineChild")) {
248
0
        mozilla::ipc::LogMessageForProtocol("PRemoteSpellcheckEngineChild", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
249
0
    }
250
0
    AUTO_PROFILER_LABEL("PRemoteSpellcheckEngine::Msg_SetDictionaryFromList", OTHER);
251
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
252
0
        mozilla::ipc::LogicError("Transition error");
253
0
    }
254
0
255
0
    (GetIPCChannel())->Send(msg__, this, std::move(aResolve), std::move(aReject));
256
0
    return;
257
0
}
258
259
auto PRemoteSpellcheckEngineChild::SendSetDictionaryFromList(const nsTArray<nsString>& aList) -> RefPtr<SetDictionaryFromListPromise>
260
0
{
261
0
262
0
    RefPtr<MozPromise<Tuple<bool, nsString>, ResponseRejectReason, false>::Private> promise__ = new MozPromise<Tuple<bool, nsString>, ResponseRejectReason, false>::Private(__func__);
263
0
264
0
    SendSetDictionaryFromList(aList, [promise__](Tuple<bool, nsString>&& aValue) {
265
0
        (promise__)->Resolve(std::move(aValue), __func__);
266
0
    }, [promise__](ResponseRejectReason aReason) {
267
0
        (promise__)->Reject(aReason, __func__);
268
0
    });
269
0
    return promise__;
270
0
}
271
272
auto PRemoteSpellcheckEngineChild::RemoveManagee(
273
        int32_t aProtocolId,
274
        IProtocol* aListener) -> void
275
0
{
276
0
    FatalError("unreached");
277
0
    return;
278
0
}
279
280
auto PRemoteSpellcheckEngineChild::OnMessageReceived(const Message& msg__) -> PRemoteSpellcheckEngineChild::Result
281
0
{
282
0
    switch ((msg__).type()) {
283
0
    case PRemoteSpellcheckEngine::Reply___delete____ID:
284
0
        {
285
0
            return MsgProcessed;
286
0
        }
287
0
    case PRemoteSpellcheckEngine::Reply_SetDictionaryFromList__ID:
288
0
        {
289
0
            if (mozilla::ipc::LoggingEnabledFor("PRemoteSpellcheckEngineChild")) {
290
0
                mozilla::ipc::LogMessageForProtocol("PRemoteSpellcheckEngineChild", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
291
0
            }
292
0
            AUTO_PROFILER_LABEL("PRemoteSpellcheckEngine::Msg_SetDictionaryFromList", OTHER);
293
0
294
0
            PickleIterator iter__(msg__);
295
0
            bool resolve__;
296
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(resolve__)))))) {
297
0
                FatalError("Error deserializing 'resolve__'");
298
0
                return MsgValueError;
299
0
            }
300
0
            // Sentinel = 'resolve__'
301
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 3997392463)))) {
302
0
                mozilla::ipc::SentinelReadError("Error deserializing 'resolve__'");
303
0
                return MsgValueError;
304
0
            }
305
0
306
0
            UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback = (GetIPCChannel())->PopCallback(msg__);
307
0
            MessageChannel::CallbackHolder<Tuple<bool, nsString>>* callback = static_cast<MessageChannel::CallbackHolder<Tuple<bool, nsString>>*>((untypedCallback).get());
308
0
            if ((!(callback))) {
309
0
                FatalError("Error unknown callback");
310
0
                return MsgProcessingError;
311
0
            }
312
0
            if (resolve__) {
313
0
                bool aSuccess;
314
0
                nsString aDictionary;
315
0
316
0
                if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aSuccess)))))) {
317
0
                    FatalError("Error deserializing 'bool'");
318
0
                    return MsgValueError;
319
0
                }
320
0
                // Sentinel = 'aSuccess'
321
0
                if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 2132928722)))) {
322
0
                    mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
323
0
                    return MsgValueError;
324
0
                }
325
0
                if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(aDictionary)))))) {
326
0
                    FatalError("Error deserializing 'nsString'");
327
0
                    return MsgValueError;
328
0
                }
329
0
                // Sentinel = 'aDictionary'
330
0
                if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1521730514)))) {
331
0
                    mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
332
0
                    return MsgValueError;
333
0
                }
334
0
                (msg__).EndRead(iter__, (msg__).type());
335
0
                (callback)->Resolve(MakeTuple(std::move(aSuccess), std::move(aDictionary)));
336
0
            }
337
0
            else {
338
0
                ResponseRejectReason reason__;
339
0
                if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(reason__)))))) {
340
0
                    FatalError("Error deserializing 'reason__'");
341
0
                    return MsgValueError;
342
0
                }
343
0
                // Sentinel = 'reason__'
344
0
                if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 913452670)))) {
345
0
                    mozilla::ipc::SentinelReadError("Error deserializing 'reason__'");
346
0
                    return MsgValueError;
347
0
                }
348
0
                (msg__).EndRead(iter__, (msg__).type());
349
0
                (callback)->Reject(reason__);
350
0
            }
351
0
            return MsgProcessed;
352
0
        }
353
0
    default:
354
0
        {
355
0
            return MsgNotKnown;
356
0
        }
357
0
    }
358
0
}
359
360
auto PRemoteSpellcheckEngineChild::OnMessageReceived(
361
        const Message& msg__,
362
        Message*& reply__) -> PRemoteSpellcheckEngineChild::Result
363
0
{
364
0
    return MsgNotKnown;
365
0
}
366
367
auto PRemoteSpellcheckEngineChild::OnCallReceived(
368
        const Message& msg__,
369
        Message*& reply__) -> PRemoteSpellcheckEngineChild::Result
370
0
{
371
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
372
0
    return MsgNotKnown;
373
0
}
374
375
auto PRemoteSpellcheckEngineChild::GetProtocolTypeId() -> int32_t
376
0
{
377
0
    return PRemoteSpellcheckEngineMsgStart;
378
0
}
379
380
auto PRemoteSpellcheckEngineChild::DestroySubtree(ActorDestroyReason why) -> void
381
0
{
382
0
    // Unregister from our manager.
383
0
    Unregister(Id());
384
0
385
0
    // Reject owning pending responses.
386
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
387
0
388
0
    // Finally, destroy "us".
389
0
    ActorDestroy(why);
390
0
}
391
392
auto PRemoteSpellcheckEngineChild::DeallocSubtree() -> void
393
0
{
394
0
}
395
396
397
398
} // namespace mozilla
399
namespace mozilla {
400
namespace ipc {
401
auto IPDLParamTraits<mozilla::PRemoteSpellcheckEngineChild>::Write(
402
        IPC::Message* aMsg,
403
        mozilla::ipc::IProtocol* aActor,
404
        const paramType& aVar) -> void
405
0
{
406
0
    int32_t id;
407
0
    if ((!(aVar))) {
408
0
        id = 0;
409
0
    }
410
0
    else {
411
0
        id = (aVar)->Id();
412
0
        if ((1) == (id)) {
413
0
            (aActor)->FatalError("actor has been |delete|d");
414
0
        }
415
0
    }
416
0
    WriteIPDLParam(aMsg, aActor, id);
417
0
}
418
419
auto IPDLParamTraits<mozilla::PRemoteSpellcheckEngineChild>::Read(
420
        const IPC::Message* aMsg,
421
        PickleIterator* aIter,
422
        mozilla::ipc::IProtocol* aActor,
423
        paramType* aVar) -> bool
424
0
{
425
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PRemoteSpellcheckEngine", PRemoteSpellcheckEngineMsgStart);
426
0
    if ((actor).isNothing()) {
427
0
        return false;
428
0
    }
429
0
430
0
    (*(aVar)) = static_cast<mozilla::PRemoteSpellcheckEngineChild*>((actor).value());
431
0
    return true;
432
0
}
433
434
} // namespace ipc
435
} // namespace mozilla