This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 822325: Implement an LRU pool for background app processes. The L…
…RU app will get the smallest oom_adj and get killed last. r=khuey
- Loading branch information
Showing
11 changed files
with
441 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
dom/browser-element/mochitest/priority/test_BackgroundLRU.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<!-- | ||
Test that calling setVisible('false') on two iframes causes the former one's priority with background LRU to | ||
change. | ||
--> | ||
<head> | ||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> | ||
<script type="application/javascript" src="../browserElementTestHelpers.js"></script> | ||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> | ||
</head> | ||
<body> | ||
|
||
<script type="application/javascript;version=1.7"> | ||
"use strict"; | ||
|
||
SimpleTest.waitForExplicitFinish(); | ||
browserElementTestHelpers.setEnabledPref(true); | ||
browserElementTestHelpers.addPermission(); | ||
browserElementTestHelpers.enableProcessPriorityManager(); | ||
SpecialPowers.addPermission("embed-apps", true, document); | ||
|
||
function runTest() { | ||
var iframe1 = document.createElement('iframe'); | ||
iframe1.setAttribute('mozbrowser', true); | ||
iframe1.src = 'file_MultipleFrames.html'; | ||
|
||
var iframe2 = null; | ||
var childID = null; | ||
|
||
expectProcessCreated().then(function(chid) { | ||
childID = chid; | ||
return expectPriorityChange(childID, 'FOREGROUND'); | ||
}).then(function() { | ||
return expectMozbrowserEvent(iframe1, 'openwindow'); | ||
}).then(function() { | ||
var p = expectPriorityChange(childID, 'BACKGROUND'); | ||
iframe1.setVisible(false); | ||
return p; | ||
}).then(function() { | ||
iframe2 = document.createElement('iframe'); | ||
iframe2.setAttribute('mozbrowser', true); | ||
iframe2.setAttribute('mozapp', 'http://example.org/manifest.webapp'); | ||
iframe2.src = browserElementTestHelpers.emptyPage1; | ||
|
||
document.body.appendChild(iframe2); | ||
|
||
// At this point, we should have iframe1 in background already. | ||
// We wait until another one is set to background, too. | ||
// Once there are two in background, the first one (LRU order) | ||
// should have 'backgroundLRU' equals 1 | ||
var p = expectPriorityWithBackgroundLRUSet(childID, '1'); | ||
iframe2.setVisible(false); | ||
document.body.removeChild(iframe2); | ||
|
||
return p; | ||
|
||
}).then(SimpleTest.finish); | ||
|
||
document.body.appendChild(iframe1); | ||
} | ||
|
||
addEventListener('testready', runTest); | ||
|
||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.