mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 734423 - refactor the gc() helper used by WebGL conformance tests - no review, will upstream - NPOTB
This commit is contained in:
parent
b646a4cffc
commit
408619d76d
@ -342,32 +342,11 @@ function runOutputTests() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function attemptToForceGC()
|
|
||||||
{
|
|
||||||
var holderArray = [];
|
|
||||||
var tempArray;
|
|
||||||
window.tempArray = holderArray;
|
|
||||||
for (var i = 0; i < 12; ++i) {
|
|
||||||
tempArray = [];
|
|
||||||
for (var j = 0; j < 1024 * 1024; ++j) {
|
|
||||||
tempArray.push(0);
|
|
||||||
}
|
|
||||||
holderArray.push(tempArray);
|
|
||||||
}
|
|
||||||
window.tempArray = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function runUniqueObjectTest()
|
function runUniqueObjectTest()
|
||||||
{
|
{
|
||||||
debug("Testing that getExtension() returns the same object each time");
|
debug("Testing that getExtension() returns the same object each time");
|
||||||
gl.getExtension("OES_standard_derivatives").myProperty = 2;
|
gl.getExtension("OES_standard_derivatives").myProperty = 2;
|
||||||
if (window.GCController) {
|
gc();
|
||||||
window.GCController.collect();
|
|
||||||
} else if (window.opera && window.opera.collect) {
|
|
||||||
window.opera.collect();
|
|
||||||
} else {
|
|
||||||
attemptToForceGC();
|
|
||||||
}
|
|
||||||
shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2');
|
shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,32 +183,11 @@ function runRenderTargetTest(testProgram)
|
|||||||
checkRenderingResults();
|
checkRenderingResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
function attemptToForceGC()
|
|
||||||
{
|
|
||||||
var holderArray = [];
|
|
||||||
var tempArray;
|
|
||||||
window.tempArray = holderArray;
|
|
||||||
for (var i = 0; i < 12; ++i) {
|
|
||||||
tempArray = [];
|
|
||||||
for (var j = 0; j < 1024 * 1024; ++j) {
|
|
||||||
tempArray.push(0);
|
|
||||||
}
|
|
||||||
holderArray.push(tempArray);
|
|
||||||
}
|
|
||||||
window.tempArray = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function runUniqueObjectTest()
|
function runUniqueObjectTest()
|
||||||
{
|
{
|
||||||
debug("Testing that getExtension() returns the same object each time");
|
debug("Testing that getExtension() returns the same object each time");
|
||||||
gl.getExtension("OES_texture_float").myProperty = 2;
|
gl.getExtension("OES_texture_float").myProperty = 2;
|
||||||
if (window.GCController) {
|
gc();
|
||||||
window.GCController.collect();
|
|
||||||
} else if (window.opera && window.opera.collect) {
|
|
||||||
window.opera.collect();
|
|
||||||
} else {
|
|
||||||
attemptToForceGC();
|
|
||||||
}
|
|
||||||
shouldBe('gl.getExtension("OES_texture_float").myProperty', '2');
|
shouldBe('gl.getExtension("OES_texture_float").myProperty', '2');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
155
content/canvas/test/webgl/gc.patch
Normal file
155
content/canvas/test/webgl/gc.patch
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
# HG changeset patch
|
||||||
|
# Parent f9585cefcf568dbc2a6ce81f16a2048365af7ed2
|
||||||
|
|
||||||
|
diff --git a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
|
||||||
|
--- a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
|
||||||
|
+++ b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
|
||||||
|
@@ -337,42 +337,21 @@ function runOutputTests() {
|
||||||
|
setupBuffers(1.0, 0.5, 0.5, 0.0);
|
||||||
|
wtu.drawQuad(gl);
|
||||||
|
expectResult([3, 3, 5, 255],
|
||||||
|
"Draw 4 (variation in x & y) returned the correct data",
|
||||||
|
"Draw 4 (variation in x & y) returned incorrect data");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-function attemptToForceGC()
|
||||||
|
-{
|
||||||
|
- var holderArray = [];
|
||||||
|
- var tempArray;
|
||||||
|
- window.tempArray = holderArray;
|
||||||
|
- for (var i = 0; i < 12; ++i) {
|
||||||
|
- tempArray = [];
|
||||||
|
- for (var j = 0; j < 1024 * 1024; ++j) {
|
||||||
|
- tempArray.push(0);
|
||||||
|
- }
|
||||||
|
- holderArray.push(tempArray);
|
||||||
|
- }
|
||||||
|
- window.tempArray = null;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
function runUniqueObjectTest()
|
||||||
|
{
|
||||||
|
debug("Testing that getExtension() returns the same object each time");
|
||||||
|
gl.getExtension("OES_standard_derivatives").myProperty = 2;
|
||||||
|
- if (window.GCController) {
|
||||||
|
- window.GCController.collect();
|
||||||
|
- } else if (window.opera && window.opera.collect) {
|
||||||
|
- window.opera.collect();
|
||||||
|
- } else {
|
||||||
|
- attemptToForceGC();
|
||||||
|
- }
|
||||||
|
+ gc();
|
||||||
|
shouldBe('gl.getExtension("OES_standard_derivatives").myProperty', '2');
|
||||||
|
}
|
||||||
|
|
||||||
|
function runReferenceCycleTest()
|
||||||
|
{
|
||||||
|
// create some reference cycles. The goal is to see if they cause leaks. The point is that
|
||||||
|
// some browser test runners have instrumentation to detect leaked refcounted objects.
|
||||||
|
|
||||||
|
diff --git a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
|
||||||
|
--- a/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
|
||||||
|
+++ b/content/canvas/test/webgl/conformance/extensions/oes-texture-float.html
|
||||||
|
@@ -178,42 +178,21 @@ function runRenderTargetTest(testProgram
|
||||||
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
||||||
|
gl.useProgram(testProgram);
|
||||||
|
gl.uniform1i(gl.getUniformLocation(testProgram, "tex"), 0);
|
||||||
|
wtu.drawQuad(gl);
|
||||||
|
glErrorShouldBe(gl, gl.NO_ERROR, "rendering from floating-point texture should succeed");
|
||||||
|
checkRenderingResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
-function attemptToForceGC()
|
||||||
|
-{
|
||||||
|
- var holderArray = [];
|
||||||
|
- var tempArray;
|
||||||
|
- window.tempArray = holderArray;
|
||||||
|
- for (var i = 0; i < 12; ++i) {
|
||||||
|
- tempArray = [];
|
||||||
|
- for (var j = 0; j < 1024 * 1024; ++j) {
|
||||||
|
- tempArray.push(0);
|
||||||
|
- }
|
||||||
|
- holderArray.push(tempArray);
|
||||||
|
- }
|
||||||
|
- window.tempArray = null;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
function runUniqueObjectTest()
|
||||||
|
{
|
||||||
|
debug("Testing that getExtension() returns the same object each time");
|
||||||
|
gl.getExtension("OES_texture_float").myProperty = 2;
|
||||||
|
- if (window.GCController) {
|
||||||
|
- window.GCController.collect();
|
||||||
|
- } else if (window.opera && window.opera.collect) {
|
||||||
|
- window.opera.collect();
|
||||||
|
- } else {
|
||||||
|
- attemptToForceGC();
|
||||||
|
- }
|
||||||
|
+ gc();
|
||||||
|
shouldBe('gl.getExtension("OES_texture_float").myProperty', '2');
|
||||||
|
}
|
||||||
|
|
||||||
|
function runReferenceCycleTest()
|
||||||
|
{
|
||||||
|
// create some reference cycles. The goal is to see if they cause leaks. The point is that
|
||||||
|
// some browser test runners have instrumentation to detect leaked refcounted objects.
|
||||||
|
|
||||||
|
diff --git a/content/canvas/test/webgl/resources/js-test-pre.js b/content/canvas/test/webgl/resources/js-test-pre.js
|
||||||
|
--- a/content/canvas/test/webgl/resources/js-test-pre.js
|
||||||
|
+++ b/content/canvas/test/webgl/resources/js-test-pre.js
|
||||||
|
@@ -435,29 +435,42 @@ function assertMsg(assertion, msg) {
|
||||||
|
if (assertion) {
|
||||||
|
testPassed(msg);
|
||||||
|
} else {
|
||||||
|
testFailed(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function gc() {
|
||||||
|
- if (typeof GCController !== "undefined")
|
||||||
|
- GCController.collect();
|
||||||
|
- else {
|
||||||
|
- function gcRec(n) {
|
||||||
|
- if (n < 1)
|
||||||
|
- return {};
|
||||||
|
- var temp = {i: "ab" + i + (i / 100000)};
|
||||||
|
- temp += "foo";
|
||||||
|
- gcRec(n-1);
|
||||||
|
- }
|
||||||
|
- for (var i = 0; i < 1000; i++)
|
||||||
|
- gcRec(10)
|
||||||
|
+ if (window.GCController) {
|
||||||
|
+ window.GCController.collect();
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ if (window.opera && window.opera.collect) {
|
||||||
|
+ window.opera.collect();
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ try {
|
||||||
|
+ window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
|
+ .getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||||
|
+ .garbageCollect();
|
||||||
|
+ return;
|
||||||
|
+ } catch(e) {}
|
||||||
|
+
|
||||||
|
+ function gcRec(n) {
|
||||||
|
+ if (n < 1)
|
||||||
|
+ return {};
|
||||||
|
+ var temp = {i: "ab" + i + (i / 100000)};
|
||||||
|
+ temp += "foo";
|
||||||
|
+ gcRec(n-1);
|
||||||
|
+ }
|
||||||
|
+ for (var i = 0; i < 1000; i++)
|
||||||
|
+ gcRec(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
function finishTest() {
|
||||||
|
successfullyParsed = true;
|
||||||
|
var epilogue = document.createElement("script");
|
||||||
|
epilogue.onload = function() {
|
||||||
|
if (window.nonKhronosFrameworkNotifyDone) {
|
||||||
|
window.nonKhronosFrameworkNotifyDone();
|
@ -440,9 +440,23 @@ function assertMsg(assertion, msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gc() {
|
function gc() {
|
||||||
if (typeof GCController !== "undefined")
|
if (window.GCController) {
|
||||||
GCController.collect();
|
window.GCController.collect();
|
||||||
else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.opera && window.opera.collect) {
|
||||||
|
window.opera.collect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||||
|
.garbageCollect();
|
||||||
|
return;
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
function gcRec(n) {
|
function gcRec(n) {
|
||||||
if (n < 1)
|
if (n < 1)
|
||||||
return {};
|
return {};
|
||||||
@ -451,8 +465,7 @@ function gc() {
|
|||||||
gcRec(n-1);
|
gcRec(n-1);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < 1000; i++)
|
for (var i = 0; i < 1000; i++)
|
||||||
gcRec(10)
|
gcRec(10);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function finishTest() {
|
function finishTest() {
|
||||||
|
Loading…
Reference in New Issue
Block a user