Bug 1459404 - Add permalink of explanation to garbageCollection logic draft
authorRob Wu <rob@robwu.nl>
Tue, 17 Jul 2018 22:01:46 +0200
changeset 819708 54326fb9af596ee9fdcce00169a0e2619875a973
parent 819707 dc04ae29243bd4b2af6de7453dc02c9926aa9981
push id116618
push userbmo:rob@robwu.nl
push dateWed, 18 Jul 2018 11:24:01 +0000
bugs1459404, 610166
milestone63.0a1
Bug 1459404 - Add permalink of explanation to garbageCollection logic At the time of the commit that introduced the original comment in damp.js, the non-permalink pointed to https://searchfox.org/mozilla-central/rev/33c21c060b7f3a52477a73d06ebcb2bf313c4431/xpcom/base/nsMemoryReporterManager.cpp#2574-2585 This commit changes the non-permalink to the following permalink: https://searchfox.org/mozilla-central/rev/33c21c060b7f3a52477a73d06ebcb2bf313c4431/xpcom/base/nsMemoryReporterManager.cpp#2574-2585,2591-2594 This permalink does not only include the original snippet, but also highlights the member and explanation that explains the need for the three iterations of the loop (at https://bugzil.la/610166#c12 ). MozReview-Commit-ID: 14Ypsq4mdIy
testing/talos/talos/tests/devtools/addon/content/damp.js
toolkit/components/extensions/test/xpcshell/test_ext_contexts_gc.js
--- a/testing/talos/talos/tests/devtools/addon/content/damp.js
+++ b/testing/talos/talos/tests/devtools/addon/content/damp.js
@@ -82,17 +82,17 @@ Damp.prototype = {
     dump("Garbage collect\n");
 
     // Minimize memory usage
     // mimic miminizeMemoryUsage, by only flushing JS objects via GC.
     // We don't want to flush all the cache like minimizeMemoryUsage,
     // as it slow down next executions almost like a cold start.
 
     // See minimizeMemoryUsage code to justify the 3 iterations and the setTimeout:
-    // https://searchfox.org/mozilla-central/source/xpcom/base/nsMemoryReporterManager.cpp#2574-2585
+    // https://searchfox.org/mozilla-central/rev/33c21c060b7f3a52477a73d06ebcb2bf313c4431/xpcom/base/nsMemoryReporterManager.cpp#2574-2585,2591-2594
     for (let i = 0; i < 3; i++) {
       // See minimizeMemoryUsage code here to justify the GC+CC+GC:
       // https://searchfox.org/mozilla-central/rev/be78e6ea9b10b1f5b2b3b013f01d86e1062abb2b/dom/base/nsJSEnvironment.cpp#341-349
       Cu.forceGC();
       Cu.forceCC();
       Cu.forceGC();
       await new Promise(done => setTimeout(done, 0));
     }
--- a/toolkit/components/extensions/test/xpcshell/test_ext_contexts_gc.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_contexts_gc.js
@@ -24,16 +24,17 @@ async function reloadTopContext(contentP
     await windowNukeObserved;
     info(`Reloaded top-level document`);
   });
 }
 
 async function assertContextReleased(contentPage, description) {
   await contentPage.spawn(description, async assertionDescription => {
     // Force GC, see https://searchfox.org/mozilla-central/rev/b0275bc977ad7fda615ef34b822bba938f2b16fd/testing/talos/talos/tests/devtools/addon/content/damp.js#84-98
+    // and https://searchfox.org/mozilla-central/rev/33c21c060b7f3a52477a73d06ebcb2bf313c4431/xpcom/base/nsMemoryReporterManager.cpp#2574-2585,2591-2594
     let gcCount = 0;
     while (gcCount < 30 && this.contextWeakRef.get() !== null) {
       ++gcCount;
       Cu.forceGC();
       Cu.forceCC();
       Cu.forceGC();
       await new Promise(resolve => this.content.setTimeout(resolve, 0));
     }