Bug 1377131 - Try to trigger collector slices at times which disturb page js less (at least with iframes loaded after the top level page has been loaded), r=mccr8,bz

When triggering an iframe load or starting to parse a document for an iframe, the main thread may often have some time before the new page has been created. Try to trigger CC/GC slice at such point in order to avoid collector later when page is already executing its JS
This commit is contained in:
Olli Pettay
2017-09-06 18:18:11 +01:00
parent 6ea74569cf
commit 8cae9c47d0
8 changed files with 124 additions and 45 deletions

View File

@@ -222,6 +222,7 @@
#include "mozilla/dom/PerformanceNavigation.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/Encoding.h"
#include "nsJSEnvironment.h"
#include "IUrlClassifierUITelemetry.h"
#ifdef MOZ_TOOLKIT_SEARCH
@@ -11704,6 +11705,11 @@ nsDocShell::DoChannelLoad(nsIChannel* aChannel,
rv = aURILoader->OpenURI(aChannel, openFlags, this);
NS_ENSURE_SUCCESS(rv, rv);
// We're about to load a new page and it may take time before necko
// gives back any data, so main thread might have a chance to process a
// collector slice
nsJSContext::MaybeRunNextCollectorSlice(this, JS::gcreason::DOCSHELL);
return NS_OK;
}