mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-07 13:24:12 +00:00
Bug 1403586 - Don't disble budget throttling due to gUM. r=smaug,padenot
This commit is contained in:
parent
c359e02509
commit
2e8f0b10d0
@ -1235,7 +1235,6 @@ TimeoutManager::BudgetThrottlingEnabled(bool aIsBackground) const
|
||||
{
|
||||
// A window can be throttled using budget if
|
||||
// * It isn't active
|
||||
// * If it isn't using user media
|
||||
// * If it isn't using WebRTC
|
||||
// * If it hasn't got open WebSockets
|
||||
// * If it hasn't got active IndexedDB databases
|
||||
@ -1257,11 +1256,6 @@ TimeoutManager::BudgetThrottlingEnabled(bool aIsBackground) const
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if we have active GetUserMedia
|
||||
if (mWindow.AsInner()->HasActiveUserMedia()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if we have active PeerConnection
|
||||
if (mWindow.AsInner()->HasActivePeerConnections()) {
|
||||
return false;
|
||||
|
@ -1012,8 +1012,7 @@ nsPIDOMWindow<T>::nsPIDOMWindow(nsPIDOMWindowOuter *aOuterWindow)
|
||||
mLargeAllocStatus(LargeAllocStatus::NONE),
|
||||
mHasTriedToCacheTopInnerWindow(false),
|
||||
mNumOfIndexedDBDatabases(0),
|
||||
mNumOfOpenWebSockets(0),
|
||||
mNumOfActiveUserMedia(0)
|
||||
mNumOfOpenWebSockets(0)
|
||||
{
|
||||
if (aOuterWindow) {
|
||||
mTimeoutManager =
|
||||
@ -4387,7 +4386,6 @@ nsGlobalWindow::UpdateTopInnerWindow()
|
||||
}
|
||||
|
||||
mTopInnerWindow->UpdateWebSocketCount(-(int32_t)mNumOfOpenWebSockets);
|
||||
mTopInnerWindow->UpdateUserMediaCount(-(int32_t)mNumOfActiveUserMedia);
|
||||
}
|
||||
|
||||
void
|
||||
@ -4548,32 +4546,6 @@ nsPIDOMWindowInner::HasOpenWebSockets() const
|
||||
(mTopInnerWindow && mTopInnerWindow->mNumOfOpenWebSockets);
|
||||
}
|
||||
|
||||
void
|
||||
nsPIDOMWindowInner::UpdateUserMediaCount(int32_t aDelta)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (aDelta == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mTopInnerWindow && !IsTopInnerWindow()) {
|
||||
mTopInnerWindow->UpdateUserMediaCount(aDelta);
|
||||
}
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
aDelta > 0 || ((aDelta + mNumOfActiveUserMedia) < mNumOfActiveUserMedia));
|
||||
|
||||
mNumOfActiveUserMedia += aDelta;
|
||||
}
|
||||
|
||||
bool
|
||||
nsPIDOMWindowInner::HasActiveUserMedia() const
|
||||
{
|
||||
return (mTopInnerWindow ? mTopInnerWindow->mNumOfActiveUserMedia
|
||||
: mNumOfActiveUserMedia) > 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsPIDOMWindowOuter::MaybeActiveMediaComponents()
|
||||
{
|
||||
|
@ -751,9 +751,6 @@ protected:
|
||||
|
||||
// The number of open WebSockets. Inner window only.
|
||||
uint32_t mNumOfOpenWebSockets;
|
||||
|
||||
// The number of active user media. Inner window only.
|
||||
uint32_t mNumOfActiveUserMedia;
|
||||
};
|
||||
|
||||
#define NS_PIDOMWINDOWINNER_IID \
|
||||
@ -942,12 +939,6 @@ public:
|
||||
// timeout-throttling.
|
||||
bool HasOpenWebSockets() const;
|
||||
|
||||
// Increase/Decrease the number of active user media.
|
||||
void UpdateUserMediaCount(int32_t aDelta);
|
||||
|
||||
// Return true if there are any currently ongoing user media.
|
||||
bool HasActiveUserMedia() const;
|
||||
|
||||
protected:
|
||||
void CreatePerformanceObjectIfNeeded();
|
||||
};
|
||||
|
@ -2935,11 +2935,6 @@ MediaManager::AddWindowID(uint64_t aWindowId,
|
||||
return;
|
||||
}
|
||||
|
||||
auto* window = nsGlobalWindow::GetInnerWindowWithId(aWindowId);
|
||||
if (window) {
|
||||
window->AsInner()->UpdateUserMediaCount(1);
|
||||
}
|
||||
|
||||
GetActiveWindows()->Put(aWindowId, aListener);
|
||||
}
|
||||
|
||||
@ -2955,8 +2950,6 @@ MediaManager::RemoveWindowID(uint64_t aWindowId)
|
||||
return;
|
||||
}
|
||||
|
||||
window->AsInner()->UpdateUserMediaCount(-1);
|
||||
|
||||
nsPIDOMWindowOuter* outer = window->AsInner()->GetOuterWindow();
|
||||
if (!outer) {
|
||||
LOG(("No outer window for inner %" PRIu64, aWindowId));
|
||||
|
Loading…
Reference in New Issue
Block a user