Files
palemoon27/dom/requestsync/RequestSyncWifiService.cpp
roytam1 10f5941b9c import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1246051 - have MediaQueue<T>::Peek/PeekFront return a RefPtr<> to avoid dangling pointers per comment 0. r=gerald. (00f334efb1)
- Bug 1264199: P1. Perform audio conversion in the MSDM taskqueue and ahead of use. r=kinetik (001936e3ea)
- Bug 1267983 - include MediaQueue.h; r=jwwang (036107d765)
- Bug 1264199: P0. Fix nsDequeue/MediaQueue methods constness. r=jwwang (9aa33dfcb5)
- Bug 1264199: P0.1. Export SaferMultDiv method. r=gerald (0b7a35ae4d)
- Bug 1264199: P2. Ensure the AudioStream only ever receive the same content format. r=kinetik (a180d09279)
- Bug 1264199: P3. Attempt to minimize audio quality loss and unnecessary processing. r=kinetik (29d57b5a33)
- Bug 1264199: P4. Add mono to stereo upmix to AudioConverter. r=rillian (49c029bd86)
- Bug 1264199: P5. Perform all downmixing operations in DecodedAudioDataSink. r=kinetik (05a479f095)
- Bug 1264199: P6. Drain resampler when changing format or reaching the end. r=kinetik (8639102a94)
- Bug 1264199: P8. Handle potential resampling errors. r=kinetik (1267e4e73d)
- Bug 1264199: P9. Include pending frames in HasUnplayedFrames calculation. r=jwwang (ce7097fc90)
2024-08-28 23:32:14 +08:00

68 lines
1.7 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RequestSyncWifiService.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "nsIObserverService.h"
namespace mozilla {
namespace dom {
using namespace hal;
NS_IMPL_ISUPPORTS0(RequestSyncWifiService)
namespace {
StaticRefPtr<RequestSyncWifiService> sService;
} // namespace
/* static */ void
RequestSyncWifiService::Init()
{
RefPtr<RequestSyncWifiService> service = GetInstance();
if (!service) {
NS_WARNING("Failed to initialize RequestSyncWifiService.");
}
}
/* static */ already_AddRefed<RequestSyncWifiService>
RequestSyncWifiService::GetInstance()
{
if (!sService) {
sService = new RequestSyncWifiService();
hal::RegisterNetworkObserver(sService);
ClearOnShutdown(&sService);
}
RefPtr<RequestSyncWifiService> service = sService.get();
return service.forget();
}
void
RequestSyncWifiService::Notify(const hal::NetworkInformation& aNetworkInfo)
{
bool isWifi = aNetworkInfo.isWifi();
if (isWifi == mIsWifi) {
return;
}
mIsWifi = isWifi;
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(nullptr, "wifi-state-changed",
mIsWifi ? MOZ_UTF16("enabled") :
MOZ_UTF16("disabled"));
}
}
} // namespace dom
} // namespace mozilla