Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/cache/ActorChild.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 "mozilla/dom/cache/ActorChild.h"
8
9
#include "mozilla/dom/cache/CacheWorkerHolder.h"
10
#include "nsThreadUtils.h"
11
12
namespace mozilla {
13
namespace dom {
14
namespace cache {
15
16
void
17
ActorChild::SetWorkerHolder(CacheWorkerHolder* aWorkerHolder)
18
0
{
19
0
  // Some of the Cache actors can have multiple DOM objects associated with
20
0
  // them.  In this case the workerHolder will be added multiple times.  This is
21
0
  // permitted, but the workerHolder should be the same each time.
22
0
  if (mWorkerHolder) {
23
0
    MOZ_DIAGNOSTIC_ASSERT(mWorkerHolder == aWorkerHolder);
24
0
    return;
25
0
  }
26
0
27
0
  mWorkerHolder = aWorkerHolder;
28
0
  if (mWorkerHolder) {
29
0
    mWorkerHolder->AddActor(this);
30
0
  }
31
0
}
32
33
void
34
ActorChild::RemoveWorkerHolder()
35
0
{
36
0
  MOZ_ASSERT_IF(!NS_IsMainThread(), mWorkerHolder);
37
0
  if (mWorkerHolder) {
38
0
    mWorkerHolder->RemoveActor(this);
39
0
    mWorkerHolder = nullptr;
40
0
  }
41
0
}
42
43
CacheWorkerHolder*
44
ActorChild::GetWorkerHolder() const
45
0
{
46
0
  return mWorkerHolder;
47
0
}
48
49
bool
50
ActorChild::WorkerHolderNotified() const
51
0
{
52
0
  return mWorkerHolder && mWorkerHolder->Notified();
53
0
}
54
55
ActorChild::ActorChild()
56
0
{
57
0
}
58
59
ActorChild::~ActorChild()
60
0
{
61
0
  MOZ_DIAGNOSTIC_ASSERT(!mWorkerHolder);
62
0
}
63
64
} // namespace cache
65
} // namespace dom
66
} // namespace mozilla