Backed out changeset b7dc5de07187 (bug 1753700) for causing android mochitest failures on test_ext_tabs_getCurrent.html. CLOSED TREE

This commit is contained in:
Cosmin Sabou 2022-04-02 01:28:06 +03:00
Родитель 82b6f1bd95
Коммит ff0de58ac3
8 изменённых файлов: 5 добавлений и 108 удалений

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

@ -25,12 +25,6 @@ interface nsIRemoteTab : nsISupports
*/
readonly attribute boolean hasLayers;
/**
* When set to true, this priority hint indicates that the content
* processes of this tab should be set to a higher process priority.
*/
attribute boolean priorityHint;
/**
* Adjusts the tab's active state in the process priority manager,
* allowing its process to be given a lower priority.

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

@ -119,11 +119,8 @@ BrowserHost::SetRenderLayers(bool aRenderLayers) {
if (!mRoot) {
return NS_OK;
}
bool priorityHint;
GetPriorityHint(&priorityHint);
ProcessPriorityManager::BrowserPriorityChanged(
GetBrowsingContext()->Canonical(), priorityHint || aRenderLayers);
GetBrowsingContext()->Canonical(), aRenderLayers);
mRoot->SetRenderLayers(aRenderLayers);
return NS_OK;
}
@ -139,30 +136,6 @@ BrowserHost::GetHasLayers(bool* aHasLayers) {
return NS_OK;
}
/* attribute boolean priorityHint; */
NS_IMETHODIMP
BrowserHost::SetPriorityHint(bool aPriorityHint) {
if (!mRoot) {
return NS_OK;
}
bool renderLayers;
GetRenderLayers(&renderLayers);
ProcessPriorityManager::BrowserPriorityChanged(
GetBrowsingContext()->Canonical(), aPriorityHint || renderLayers);
mRoot->SetPriorityHint(aPriorityHint);
return NS_OK;
}
NS_IMETHODIMP
BrowserHost::GetPriorityHint(bool* aPriorityHint) {
if (!mRoot) {
*aPriorityHint = false;
return NS_OK;
}
*aPriorityHint = mRoot->GetPriorityHint();
return NS_OK;
}
/* void resolutionChanged (); */
NS_IMETHODIMP
BrowserHost::NotifyResolutionChanged(void) {

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

@ -231,7 +231,6 @@ BrowserParent::BrowserParent(ContentParent* aManager, const TabId& aTabId,
mRemoteTargetSetsCursor(false),
mIsPreservingLayers(false),
mRenderLayers(true),
mPriorityHint(false),
mHasLayers(false),
mHasPresented(false),
mIsReadyToHandleInputEvents(false),
@ -3478,12 +3477,6 @@ void BrowserParent::SetRenderLayersInternal(bool aEnabled) {
}
}
bool BrowserParent::GetPriorityHint() { return mPriorityHint; }
void BrowserParent::SetPriorityHint(bool aPriorityHint) {
mPriorityHint = aPriorityHint;
}
void BrowserParent::PreserveLayers(bool aPreserveLayers) {
if (mIsPreservingLayers == aPreserveLayers) {
return;

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

@ -706,8 +706,6 @@ class BrowserParent final : public PBrowserParent,
bool GetHasLayers();
bool GetRenderLayers();
void SetRenderLayers(bool aRenderLayers);
bool GetPriorityHint();
void SetPriorityHint(bool aPriorityHint);
void PreserveLayers(bool aPreserveLayers);
void NotifyResolutionChanged();
@ -965,9 +963,6 @@ class BrowserParent final : public PBrowserParent,
// and have uploaded - for that, use mHasLayers.
bool mRenderLayers : 1;
// True if process should be set to a higher priority.
bool mPriorityHint : 1;
// True if the compositor has reported that the BrowserChild has uploaded
// layers.
bool mHasLayers : 1;

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

@ -336,7 +336,7 @@ class ParticularProcessPriorityManager final : public WakeLockObserver,
nsCOMPtr<nsITimer> mResetPriorityTimer;
// This hashtable contains the list of high priority TabIds for this process.
// This hashtable contains the list of active TabId for this process.
nsTHashSet<uint64_t> mHighPriorityBrowserParents;
};

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

@ -73,7 +73,7 @@ class ProcessPriorityManager final {
/**
* Updates the contents of mHighPriorityBrowserParents to keep track of
* the list of TabIds for this process that are high priority.
* the list of TabIds for this process that are active.
*/
static void BrowserPriorityChanged(dom::CanonicalBrowsingContext* aBC,
bool aPriority);

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

@ -286,9 +286,8 @@ async function assertPriorityChangeOnBackground({
/**
* Test that if a normal tab goes into the background,
* it has its process priority lowered to PROCESS_PRIORITY_BACKGROUND.
* Additionally, test priorityHint flag sets the process priority
* appropriately to PROCESS_PRIORITY_BACKGROUND and PROCESS_PRIORITY_FOREGROUND.
* it has its process priority lowered to
* PROCESS_PRIORITY_BACKGROUND.
*/
add_task(async function test_normal_background_tab() {
let originalTab = gBrowser.selectedTab;
@ -308,62 +307,6 @@ add_task(async function test_normal_background_tab() {
toTab: tab,
fromTabExpectedPriority: PROCESS_PRIORITY_BACKGROUND,
});
let origtabID = browsingContextChildID(
originalTab.linkedBrowser.browsingContext
);
Assert.equal(
originalTab.linkedBrowser.frameLoader.remoteTab.priorityHint,
false,
"PriorityHint of the original tab should be false on default"
);
// Test when priorityHint is true, the original tab priority
// becomes PROCESS_PRIORITY_FOREGROUND.
originalTab.linkedBrowser.frameLoader.remoteTab.priorityHint = true;
Assert.equal(
gTabPriorityWatcher.currentPriority(origtabID),
PROCESS_PRIORITY_FOREGROUND,
"Setting priorityHint to true should set the original tab to foreground priority"
);
// Test when priorityHint is false, the original tab priority
// becomes PROCESS_PRIORITY_BACKGROUND.
originalTab.linkedBrowser.frameLoader.remoteTab.priorityHint = false;
await new Promise(resolve =>
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
setTimeout(resolve, WAIT_FOR_CHANGE_TIME_MS)
);
Assert.equal(
gTabPriorityWatcher.currentPriority(origtabID),
PROCESS_PRIORITY_BACKGROUND,
"Setting priorityHint to false should set the original tab to background priority"
);
let tabID = browsingContextChildID(tab.linkedBrowser.browsingContext);
Assert.equal(
tab.linkedBrowser.frameLoader.remoteTab.priorityHint,
false,
"PriorityHint of the active tab should be false on default"
);
// Test when priorityHint is true, the process priority of the
// active tab remains PROCESS_PRIORITY_FOREGROUND.
tab.linkedBrowser.frameLoader.remoteTab.priorityHint = true;
Assert.equal(
gTabPriorityWatcher.currentPriority(tabID),
PROCESS_PRIORITY_FOREGROUND,
"Setting priorityHint to true should maintain the new tab priority as foreground"
);
// Test when priorityHint is false, the process priority of the
// active tab remains PROCESS_PRIORITY_FOREGROUND.
tab.linkedBrowser.frameLoader.remoteTab.priorityHint = false;
Assert.equal(
gTabPriorityWatcher.currentPriority(tabID),
PROCESS_PRIORITY_FOREGROUND,
"Setting priorityHint to false should maintain the new tab priority as foreground"
);
}
);
});

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

@ -544,7 +544,6 @@ class MobileWindowTracker extends EventEmitter {
setTabActive(aWindow, aActive) {
const { browser, tab, docShell } = aWindow;
tab.active = aActive;
browser.frameLoader.remoteTab.priorityHint = aActive;
if (aActive) {
this._topWindow = Cu.getWeakReference(aWindow);