зеркало из https://github.com/mozilla/gecko-dev.git
b=514334; add option to disable canvas cache in reftests (intermittent crash when running reftests on low memory devices); r=roc
This commit is contained in:
Родитель
7c4a9a0ff3
Коммит
867d3b3296
|
@ -80,14 +80,14 @@ RefTestCmdLineHandler.prototype =
|
|||
|
||||
/* nsICommandLineHandler */
|
||||
handle : function handler_handle(cmdLine) {
|
||||
var args = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(nsISupportsString);
|
||||
var args = { };
|
||||
args.wrappedJSObject = args;
|
||||
try {
|
||||
var uristr = cmdLine.handleFlagWithParam("reftest", false);
|
||||
if (uristr == null)
|
||||
return;
|
||||
try {
|
||||
args.data = cmdLine.resolveURI(uristr).spec;
|
||||
args.uri = cmdLine.resolveURI(uristr).spec;
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
|
@ -97,6 +97,13 @@ RefTestCmdLineHandler.prototype =
|
|||
cmdLine.handleFlag("reftest", true);
|
||||
}
|
||||
|
||||
try {
|
||||
var nocache = cmdLine.handleFlag("reftestnocache", false);
|
||||
args.nocache = nocache;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
|
||||
/* Ignore the platform's online/offline status while running reftests. */
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService2);
|
||||
|
|
|
@ -121,6 +121,9 @@ const EXPECTED_DEATH = 3; // test must be skipped to avoid e.g. crash/hang
|
|||
var HTTP_SERVER_PORT = 4444;
|
||||
const HTTP_SERVER_PORTS_TO_TRY = 50;
|
||||
|
||||
// whether we should skip caching canvases
|
||||
var gNoCanvasCache = false;
|
||||
|
||||
var gRecycledCanvases = new Array();
|
||||
|
||||
function AllocateCanvas()
|
||||
|
@ -133,12 +136,15 @@ function AllocateCanvas()
|
|||
var canvas = document.createElementNS(XHTML_NS, "canvas");
|
||||
canvas.setAttribute("width", windowElem.getAttribute("width"));
|
||||
canvas.setAttribute("height", windowElem.getAttribute("height"));
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function ReleaseCanvas(canvas)
|
||||
{
|
||||
gRecycledCanvases.push(canvas);
|
||||
// store a maximum of 2 canvases, if we're not caching
|
||||
if (!gNoCanvasCache || gRecycledCanvases.length < 2)
|
||||
gRecycledCanvases.push(canvas);
|
||||
}
|
||||
|
||||
function OnRefTestLoad()
|
||||
|
@ -207,7 +213,12 @@ function StartTests()
|
|||
{
|
||||
try {
|
||||
// Need to read the manifest once we have the final HTTP_SERVER_PORT.
|
||||
ReadTopManifest(window.arguments[0]);
|
||||
args = window.arguments[0].wrappedJSObject;
|
||||
|
||||
if ("nocache" in args && args["nocache"])
|
||||
gNoCanvasCache = true;
|
||||
|
||||
ReadTopManifest(args.uri);
|
||||
BuildUseCounts();
|
||||
gTotalTests = gURLs.length;
|
||||
|
||||
|
@ -790,7 +801,8 @@ function UpdateCanvasCache(url, canvas)
|
|||
var spec = url.spec;
|
||||
|
||||
--gURIUseCounts[spec];
|
||||
if (gURIUseCounts[spec] == 0) {
|
||||
|
||||
if (gNoCanvasCache || gURIUseCounts[spec] == 0) {
|
||||
ReleaseCanvas(canvas);
|
||||
delete gURICanvases[spec];
|
||||
} else if (gURIUseCounts[spec] > 0) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче