Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/network/ConnectionMainThread.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 <limits>
8
#include "mozilla/Hal.h"
9
#include "ConnectionMainThread.h"
10
11
namespace mozilla {
12
namespace dom {
13
namespace network {
14
15
ConnectionMainThread::ConnectionMainThread(nsPIDOMWindowInner* aWindow)
16
  : Connection(aWindow)
17
0
{
18
0
  hal::RegisterNetworkObserver(this);
19
0
20
0
  hal::NetworkInformation networkInfo;
21
0
  hal::GetCurrentNetworkInformation(&networkInfo);
22
0
23
0
  UpdateFromNetworkInfo(networkInfo, false);
24
0
}
25
26
ConnectionMainThread::~ConnectionMainThread()
27
0
{
28
0
  Shutdown();
29
0
}
30
31
void
32
ConnectionMainThread::ShutdownInternal()
33
0
{
34
0
  hal::UnregisterNetworkObserver(this);
35
0
}
36
37
void
38
ConnectionMainThread::UpdateFromNetworkInfo(const hal::NetworkInformation& aNetworkInfo,
39
                                            bool aNotify)
40
0
{
41
0
  Update(static_cast<ConnectionType>(aNetworkInfo.type()),
42
0
         aNetworkInfo.isWifi(), aNetworkInfo.dhcpGateway(), aNotify);
43
0
}
44
45
void
46
ConnectionMainThread::Notify(const hal::NetworkInformation& aNetworkInfo)
47
0
{
48
0
  UpdateFromNetworkInfo(aNetworkInfo, true);
49
0
}
50
51
} // namespace network
52
} // namespace dom
53
} // namespace mozilla