Bug 1679314 - part1 : remove unused methods. r=smaug

No one is using `NewWakeLockOnBehalfOfProcess()` so we can remove it and its related methods.

Differential Revision: https://phabricator.services.mozilla.com/D99726
This commit is contained in:
alwu 2020-12-15 13:43:20 +00:00
Родитель cbdc1d2bfa
Коммит caec133554
4 изменённых файлов: 0 добавлений и 53 удалений

Просмотреть файл

@ -135,14 +135,6 @@ PowerManagerService::NewWakeLock(const nsAString& aTopic,
return NS_OK;
}
already_AddRefed<WakeLock> PowerManagerService::NewWakeLockOnBehalfOfProcess(
const nsAString& aTopic, ContentParent* aContentParent) {
RefPtr<WakeLock> wakelock = new WakeLock();
nsresult rv = wakelock->Init(aTopic, aContentParent);
NS_ENSURE_SUCCESS(rv, nullptr);
return wakelock.forget();
}
} // namespace mozilla::dom::power
NS_DEFINE_NAMED_CID(NS_POWERMANAGERSERVICE_CID);

Просмотреть файл

@ -38,21 +38,6 @@ class PowerManagerService : public nsIPowerManagerService,
// Implement WakeLockObserver
void Notify(const hal::WakeLockInformation& aWakeLockInfo) override;
/**
* Acquire a wake lock on behalf of a given process (aContentParent).
*
* This method stands in contrast to nsIPowerManagerService::NewWakeLock,
* which acquires a wake lock on behalf of the /current/ process.
*
* NewWakeLockOnBehalfOfProcess is different from NewWakeLock in that
*
* - The wake lock unlocks itself if the /given/ process dies, and
* - The /given/ process shows up in WakeLockInfo::lockingProcesses.
*
*/
already_AddRefed<WakeLock> NewWakeLockOnBehalfOfProcess(
const nsAString& aTopic, ContentParent* aContentParent);
already_AddRefed<WakeLock> NewWakeLock(const nsAString& aTopic,
nsPIDOMWindowInner* aWindow,
mozilla::ErrorResult& aRv);

Просмотреть файл

@ -67,29 +67,6 @@ nsresult WakeLock::Init(const nsAString& aTopic, nsPIDOMWindowInner* aWindow) {
return NS_OK;
}
nsresult WakeLock::Init(const nsAString& aTopic,
ContentParent* aContentParent) {
// Don't Init() a WakeLock twice.
MOZ_ASSERT(mTopic.IsEmpty());
MOZ_ASSERT(aContentParent);
if (aTopic.IsEmpty()) {
return NS_ERROR_INVALID_ARG;
}
mTopic.Assign(aTopic);
mContentParentID = aContentParent->ChildID();
mHidden = false;
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (obs) {
obs->AddObserver(this, "ipc:content-shutdown", /* ownsWeak */ true);
}
DoLock();
return NS_OK;
}
NS_IMETHODIMP
WakeLock::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* data) {

Просмотреть файл

@ -22,8 +22,6 @@ class ErrorResult;
namespace dom {
class ContentParent;
class WakeLock final : public nsIDOMEventListener,
public nsIObserver,
public nsSupportsWeakReference,
@ -47,11 +45,6 @@ class WakeLock final : public nsIDOMEventListener,
// invisible.
nsresult Init(const nsAString& aTopic, nsPIDOMWindowInner* aWindow);
// Initialize this wake lock on behalf of the given process. If the process
// dies, the lock is released. A wake lock initialized via this method is
// always considered visible.
nsresult Init(const nsAString& aTopic, ContentParent* aContentParent);
// WebIDL methods
nsPIDOMWindowInner* GetParentObject() const;