Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/ipc/ipdl/PBroadcastChannelParent.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/PBroadcastChannelParent.h"
8
#include "ipc/IPCMessageUtils.h"
9
10
#include "mozilla/ipc/PBackgroundParent.h"
11
#include "mozilla/ipc/PChildToParentStreamParent.h"
12
#include "mozilla/ipc/PFileDescriptorSetParent.h"
13
#include "mozilla/ipc/PIPCBlobInputStreamParent.h"
14
#include "mozilla/ipc/PParentToChildStreamParent.h"
15
16
#include "nsIFile.h"
17
#include "GeckoProfiler.h"
18
19
namespace mozilla {
20
namespace dom {
21
22
23
auto PBroadcastChannelParent::ActorDestroy(ActorDestroyReason aWhy) -> void
24
0
{
25
0
}
26
27
MOZ_IMPLICIT PBroadcastChannelParent::PBroadcastChannelParent() :
28
    mozilla::ipc::IProtocol(mozilla::ipc::ParentSide),
29
    mLivenessState(mozilla::ipc::LivenessState::Dead)
30
0
{
31
0
    MOZ_COUNT_CTOR(PBroadcastChannelParent);
32
0
}
33
34
PBroadcastChannelParent::~PBroadcastChannelParent()
35
0
{
36
0
    MOZ_COUNT_DTOR(PBroadcastChannelParent);
37
0
}
38
39
auto PBroadcastChannelParent::Manager() const -> PBackgroundParent*
40
0
{
41
0
    return static_cast<PBackgroundParent*>(IProtocol::Manager());
42
0
}
43
44
auto PBroadcastChannelParent::SendNotify(const ClonedMessageData& message) -> bool
45
0
{
46
0
    IPC::Message* msg__ = PBroadcastChannel::Msg_Notify(Id());
47
0
48
0
    WriteIPDLParam(msg__, this, message);
49
0
    // Sentinel = 'message'
50
0
    (msg__)->WriteSentinel(1366108954);
51
0
52
0
53
0
54
0
55
0
    if (mozilla::ipc::LoggingEnabledFor("PBroadcastChannelParent")) {
56
0
        mozilla::ipc::LogMessageForProtocol("PBroadcastChannelParent", OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
57
0
    }
58
0
    AUTO_PROFILER_LABEL("PBroadcastChannel::Msg_Notify", OTHER);
59
0
    if ((!(StateTransition(false, (&(mLivenessState)))))) {
60
0
        mozilla::ipc::LogicError("Transition error");
61
0
    }
62
0
63
0
    bool sendok__ = (GetIPCChannel())->Send(msg__);
64
0
    return sendok__;
65
0
}
66
67
auto PBroadcastChannelParent::Send__delete__(PBroadcastChannelParent* actor) -> bool
68
0
{
69
0
    if ((!(actor))) {
70
0
        return false;
71
0
    }
72
0
73
0
    IPC::Message* msg__ = PBroadcastChannel::Msg___delete__((actor)->Id());
74
0
75
0
    MOZ_RELEASE_ASSERT(actor, "NULL actor value passed to non-nullable param");
76
0
    WriteIPDLParam(msg__, actor, actor);
77
0
    // Sentinel = 'actor'
78
0
    (msg__)->WriteSentinel(875202478);
79
0
80
0
81
0
82
0
    if (mozilla::ipc::LoggingEnabledFor("PBroadcastChannelParent")) {
83
0
        mozilla::ipc::LogMessageForProtocol("PBroadcastChannelParent", (actor)->OtherPid(), "Sending ", (msg__)->type(), mozilla::ipc::MessageDirection::eSending);
84
0
    }
85
0
    AUTO_PROFILER_LABEL("PBroadcastChannel::Msg___delete__", OTHER);
86
0
    if ((!(StateTransition(true, (&((actor)->mLivenessState)))))) {
87
0
        mozilla::ipc::LogicError("Transition error");
88
0
    }
89
0
90
0
    bool sendok__ = ((actor)->GetIPCChannel())->Send(msg__);
91
0
92
0
    IProtocol* mgr = (actor)->Manager();
93
0
    (actor)->DestroySubtree(Deletion);
94
0
    (actor)->DeallocSubtree();
95
0
    (mgr)->RemoveManagee(PBroadcastChannelMsgStart, actor);
96
0
    return sendok__;
97
0
}
98
99
auto PBroadcastChannelParent::RemoveManagee(
100
        int32_t aProtocolId,
101
        IProtocol* aListener) -> void
102
0
{
103
0
    FatalError("unreached");
104
0
    return;
105
0
}
106
107
auto PBroadcastChannelParent::OnMessageReceived(const Message& msg__) -> PBroadcastChannelParent::Result
108
0
{
109
0
    switch ((msg__).type()) {
110
0
    case PBroadcastChannel::Msg_PostMessage__ID:
111
0
        {
112
0
            if (mozilla::ipc::LoggingEnabledFor("PBroadcastChannelParent")) {
113
0
                mozilla::ipc::LogMessageForProtocol("PBroadcastChannelParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
114
0
            }
115
0
            AUTO_PROFILER_LABEL("PBroadcastChannel::Msg_PostMessage", OTHER);
116
0
117
0
            PickleIterator iter__(msg__);
118
0
            ClonedMessageData message;
119
0
120
0
            if ((!(ReadIPDLParam((&(msg__)), (&(iter__)), this, (&(message)))))) {
121
0
                FatalError("Error deserializing 'ClonedMessageData'");
122
0
                return MsgValueError;
123
0
            }
124
0
            // Sentinel = 'message'
125
0
            if ((!(((&(msg__)))->ReadSentinel((&(iter__)), 1366108954)))) {
126
0
                mozilla::ipc::SentinelReadError("Error deserializing 'ClonedMessageData'");
127
0
                return MsgValueError;
128
0
            }
129
0
            (msg__).EndRead(iter__, (msg__).type());
130
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
131
0
                FatalError("Transition error");
132
0
                return MsgValueError;
133
0
            }
134
0
            if ((!(RecvPostMessage(message)))) {
135
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
136
0
                // Error handled in mozilla::ipc::IPCResult
137
0
                return MsgProcessingError;
138
0
            }
139
0
140
0
            return MsgProcessed;
141
0
        }
142
0
    case PBroadcastChannel::Msg_Close__ID:
143
0
        {
144
0
            if (mozilla::ipc::LoggingEnabledFor("PBroadcastChannelParent")) {
145
0
                mozilla::ipc::LogMessageForProtocol("PBroadcastChannelParent", OtherPid(), "Received ", ((&(msg__)))->type(), mozilla::ipc::MessageDirection::eReceiving);
146
0
            }
147
0
            AUTO_PROFILER_LABEL("PBroadcastChannel::Msg_Close", OTHER);
148
0
149
0
            if ((!(StateTransition(false, (&(mLivenessState)))))) {
150
0
                FatalError("Transition error");
151
0
                return MsgValueError;
152
0
            }
153
0
            if ((!(RecvClose()))) {
154
0
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
155
0
                // Error handled in mozilla::ipc::IPCResult
156
0
                return MsgProcessingError;
157
0
            }
158
0
159
0
            return MsgProcessed;
160
0
        }
161
0
    case PBroadcastChannel::Reply___delete____ID:
162
0
        {
163
0
            return MsgProcessed;
164
0
        }
165
0
    default:
166
0
        {
167
0
            return MsgNotKnown;
168
0
        }
169
0
    }
170
0
}
171
172
auto PBroadcastChannelParent::OnMessageReceived(
173
        const Message& msg__,
174
        Message*& reply__) -> PBroadcastChannelParent::Result
175
0
{
176
0
    return MsgNotKnown;
177
0
}
178
179
auto PBroadcastChannelParent::OnCallReceived(
180
        const Message& msg__,
181
        Message*& reply__) -> PBroadcastChannelParent::Result
182
0
{
183
0
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
184
0
    return MsgNotKnown;
185
0
}
186
187
auto PBroadcastChannelParent::GetProtocolTypeId() -> int32_t
188
0
{
189
0
    return PBroadcastChannelMsgStart;
190
0
}
191
192
auto PBroadcastChannelParent::DestroySubtree(ActorDestroyReason why) -> void
193
0
{
194
0
    // Unregister from our manager.
195
0
    Unregister(Id());
196
0
197
0
    // Reject owning pending responses.
198
0
    (GetIPCChannel())->RejectPendingResponsesForActor(this);
199
0
200
0
    // Finally, destroy "us".
201
0
    ActorDestroy(why);
202
0
}
203
204
auto PBroadcastChannelParent::DeallocSubtree() -> void
205
0
{
206
0
}
207
208
209
210
} // namespace dom
211
} // namespace mozilla
212
namespace mozilla {
213
namespace ipc {
214
auto IPDLParamTraits<mozilla::dom::PBroadcastChannelParent>::Write(
215
        IPC::Message* aMsg,
216
        mozilla::ipc::IProtocol* aActor,
217
        const paramType& aVar) -> void
218
0
{
219
0
    int32_t id;
220
0
    if ((!(aVar))) {
221
0
        id = 0;
222
0
    }
223
0
    else {
224
0
        id = (aVar)->Id();
225
0
        if ((1) == (id)) {
226
0
            (aActor)->FatalError("actor has been |delete|d");
227
0
        }
228
0
    }
229
0
    WriteIPDLParam(aMsg, aActor, id);
230
0
}
231
232
auto IPDLParamTraits<mozilla::dom::PBroadcastChannelParent>::Read(
233
        const IPC::Message* aMsg,
234
        PickleIterator* aIter,
235
        mozilla::ipc::IProtocol* aActor,
236
        paramType* aVar) -> bool
237
0
{
238
0
    mozilla::Maybe<mozilla::ipc::IProtocol*> actor = (aActor)->ReadActor(aMsg, aIter, true, "PBroadcastChannel", PBroadcastChannelMsgStart);
239
0
    if ((actor).isNothing()) {
240
0
        return false;
241
0
    }
242
0
243
0
    (*(aVar)) = static_cast<mozilla::dom::PBroadcastChannelParent*>((actor).value());
244
0
    return true;
245
0
}
246
247
} // namespace ipc
248
} // namespace mozilla