Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/clients/manager/ClientSourceChild.cpp
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
#include "ClientSourceChild.h"
8
9
#include "ClientSource.h"
10
#include "ClientSourceOpChild.h"
11
#include "mozilla/dom/ClientIPCTypes.h"
12
#include "mozilla/Unused.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
using mozilla::ipc::IPCResult;
18
19
void
20
ClientSourceChild::ActorDestroy(ActorDestroyReason aReason)
21
0
{
22
0
  if (mSource) {
23
0
    mSource->RevokeActor(this);
24
0
25
0
    // Revoking the actor link should automatically cause the owner
26
0
    // to call RevokeOwner() as well.
27
0
    MOZ_DIAGNOSTIC_ASSERT(!mSource);
28
0
  }
29
0
}
30
31
PClientSourceOpChild*
32
ClientSourceChild::AllocPClientSourceOpChild(const ClientOpConstructorArgs& aArgs)
33
0
{
34
0
  return new ClientSourceOpChild();
35
0
}
36
37
bool
38
ClientSourceChild::DeallocPClientSourceOpChild(PClientSourceOpChild* aActor)
39
0
{
40
0
  delete aActor;
41
0
  return true;
42
0
}
43
44
IPCResult
45
ClientSourceChild::RecvPClientSourceOpConstructor(PClientSourceOpChild* aActor,
46
                                                  const ClientOpConstructorArgs& aArgs)
47
0
{
48
0
  auto actor = static_cast<ClientSourceOpChild*>(aActor);
49
0
  actor->Init(aArgs);
50
0
  return IPC_OK();
51
0
}
52
53
ClientSourceChild::ClientSourceChild(const ClientSourceConstructorArgs& aArgs)
54
  : mSource(nullptr)
55
  , mTeardownStarted(false)
56
0
{
57
0
}
58
59
void
60
ClientSourceChild::SetOwner(ClientThing<ClientSourceChild>* aThing)
61
0
{
62
0
  MOZ_DIAGNOSTIC_ASSERT(aThing);
63
0
  MOZ_DIAGNOSTIC_ASSERT(!mSource);
64
0
  mSource = static_cast<ClientSource*>(aThing);
65
0
}
66
67
void
68
ClientSourceChild::RevokeOwner(ClientThing<ClientSourceChild>* aThing)
69
0
{
70
0
  MOZ_DIAGNOSTIC_ASSERT(mSource);
71
0
  MOZ_DIAGNOSTIC_ASSERT(mSource == static_cast<ClientSource*>(aThing));
72
0
  mSource = nullptr;
73
0
}
74
75
ClientSource*
76
ClientSourceChild::GetSource() const
77
0
{
78
0
  return mSource;
79
0
}
80
81
void
82
ClientSourceChild::MaybeStartTeardown()
83
0
{
84
0
  if (mTeardownStarted) {
85
0
    return;
86
0
  }
87
0
  mTeardownStarted = true;
88
0
  Unused << SendTeardown();
89
0
}
90
91
} // namespace dom
92
} // namespace mozilla