Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: LayoutTests/resources/js-test.js

Issue 220203005: Oilpan: introduce sticky forcedForTesting flag to ensure that a precise (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/resources/js-test.js
diff --git a/LayoutTests/resources/js-test.js b/LayoutTests/resources/js-test.js
index 791b728108f45d6ac91bd9866ee353671718505a..47387d0ce562c32034d2118fbd7e58516b24cc53 100644
--- a/LayoutTests/resources/js-test.js
+++ b/LayoutTests/resources/js-test.js
@@ -649,6 +649,26 @@ function shouldHaveHadError(message)
testFailed("expectError() not called before shouldHaveHadError()");
}
+// With Oilpan tests that rely on garbage collection need to go through
+// the event loop in order to get precise garbage collections. Oilpan
+// uses conservative stack scanning when not at the event loop and that
+// can artificially keep objects alive. Therfore, test that need to check
wibling-chromium 2014/04/01 13:26:09 NIT: Therfore -> Therefore test -> tests
Mads Ager (chromium) 2014/04/01 13:45:38 Done.
+// that something is dead need to use this asynchronous collectGarbage
+// function.
+function collectGarbage(callback) {
+ GCController.collect();
wibling-chromium 2014/04/01 13:26:09 Consider adding a comment explaining why we do sev
Mads Ager (chromium) 2014/04/01 13:45:38 Yes, done.
+ setTimeout(function() {
+ GCController.collect();
+ setTimeout(function() {
+ GCController.collect();
+ setTimeout(function() {
+ GCController.collect();
+ setTimeout(callback, 0);
+ }, 0);
+ }, 0);
+ }, 0);
+}
+
function gc() {
if (typeof GCController !== "undefined")
GCController.collectAll();

Powered by Google App Engine
This is Rietveld 408576698