Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/netwerk/ipc/NeckoTargetHolder.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 sw=2 ts=8 et tw=80 : */
3
4
/* This Source Code Form is subject to the terms of the Mozilla Public
5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
6
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8
#include "NeckoTargetHolder.h"
9
10
#include "nsContentUtils.h"
11
#include "nsILoadInfo.h"
12
13
namespace mozilla {
14
namespace net {
15
16
already_AddRefed<nsIEventTarget>
17
NeckoTargetHolder::GetNeckoTarget()
18
0
{
19
0
  nsCOMPtr<nsIEventTarget> target = mNeckoTarget;
20
0
21
0
  if (!target) {
22
0
    target = GetMainThreadEventTarget();
23
0
  }
24
0
  return target.forget();
25
0
}
26
27
nsresult
28
NeckoTargetHolder::Dispatch(already_AddRefed<nsIRunnable>&& aRunnable,
29
                            uint32_t aDispatchFlags)
30
0
{
31
0
  if (mNeckoTarget) {
32
0
    return mNeckoTarget->Dispatch(std::move(aRunnable), aDispatchFlags);
33
0
  }
34
0
35
0
  nsCOMPtr<nsIEventTarget> mainThreadTarget = GetMainThreadEventTarget();
36
0
  MOZ_ASSERT(mainThreadTarget);
37
0
38
0
  return mainThreadTarget->Dispatch(std::move(aRunnable), aDispatchFlags);
39
0
}
40
41
} // namespace net
42
} // namespace mozilla