Skip to content

Commit

Permalink
Bug 1679314 - part1 : remove unused methods. r=smaug
Browse files Browse the repository at this point in the history
No one is using `NewWakeLockOnBehalfOfProcess()` so we can remove it and its related methods.

Differential Revision: https://phabricator.services.mozilla.com/D99726
  • Loading branch information
alastor0325 committed Dec 15, 2020
1 parent cbdc1d2 commit caec133
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 53 deletions.
8 changes: 0 additions & 8 deletions dom/power/PowerManagerService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 0 additions & 15 deletions dom/power/PowerManagerService.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
23 changes: 0 additions & 23 deletions dom/power/WakeLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 0 additions & 7 deletions dom/power/WakeLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class ErrorResult;

namespace dom {

class ContentParent;

class WakeLock final : public nsIDOMEventListener,
public nsIObserver,
public nsSupportsWeakReference,
Expand All @@ -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;
Expand Down

0 comments on commit caec133

Please sign in to comment.