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

Unified Diff: LayoutTests/resources/leak-check.js

Issue 262093006: Oilpan: Make the Node hierarchy RefCountedGarbageCollected instead of TreeShared. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another build fix. Created 6 years, 7 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/leak-check.js
diff --git a/LayoutTests/resources/leak-check.js b/LayoutTests/resources/leak-check.js
index 5e4f708dd1fb3761426aab8952cb024800c49262..6c39679488df381260c298e2e60386ba840c2b45 100644
--- a/LayoutTests/resources/leak-check.js
+++ b/LayoutTests/resources/leak-check.js
@@ -1,16 +1,17 @@
// include resources/js-test.js before this file.
-function getCounterValues() {
+function getCounterValues(callback) {
testRunner.resetTestHelperControllers();
- gc();
+ asyncGC(function() {
+ var ret = {'numberOfLiveDocuments': window.internals.numberOfLiveDocuments()};
- var ret = {'numberOfLiveDocuments': window.internals.numberOfLiveDocuments()};
+ var refCountedInstances = JSON.parse(window.internals.dumpRefCountedInstanceCounts());
+ for (typename in refCountedInstances)
+ ret['numberOfInstances-'+typename] = refCountedInstances[typename];
- var refCountedInstances = JSON.parse(window.internals.dumpRefCountedInstanceCounts());
- for (typename in refCountedInstances)
- ret['numberOfInstances-'+typename] = refCountedInstances[typename];
+ callback(ret);
+ });
- return ret;
}
function compareValues(countersBefore, countersAfter, tolerance) {
@@ -49,22 +50,23 @@ function doLeakTest(src, tolerance) {
loadSourceIntoIframe('about:blank', function() {
// blank document loaded...
- var countersBefore = getCounterValues();
-
- loadSourceIntoIframe(src, function() {
- // target document loaded...
-
- loadSourceIntoIframe('about:blank', function() {
- // target document unloaded...
-
- // Measure counter values on next timer event. This is needed
- // to correctly handle deref cycles for some ActiveDOMObjects
- // such as XMLHttpRequest.
- setTimeout(function() {
- var countersAfter = getCounterValues();
- compareValues(countersBefore, countersAfter, tolerance);
- finishJSTest();
- }, 0);
+ getCounterValues(function(countersBefore) {
+ loadSourceIntoIframe(src, function() {
+ // target document loaded...
+
+ loadSourceIntoIframe('about:blank', function() {
+ // target document unloaded...
+
+ // Measure counter values on next timer event. This is needed
+ // to correctly handle deref cycles for some ActiveDOMObjects
+ // such as XMLHttpRequest.
+ setTimeout(function() {
+ getCounterValues(function(countersAfter) {
+ compareValues(countersBefore, countersAfter, tolerance);
+ finishJSTest();
+ });
+ }, 0);
+ });
});
});
});

Powered by Google App Engine
This is Rietveld 408576698