Backout Bug 930793 - Remove favor performance mode (we have still racy b2g tests), a=backout

This commit is contained in:
Olli Pettay
2014-01-30 21:35:44 -08:00
parent 56faa73ffa
commit 01fa7e9f98
20 changed files with 127 additions and 69 deletions

View File

@@ -211,6 +211,9 @@ static bool gAddedPreferencesVarCache = false;
bool nsDocShell::sUseErrorPages = false;
// Number of documents currently loading
static int32_t gNumberOfDocumentsLoading = 0;
// Global count of existing docshells.
static int32_t gDocShellCount = 0;
@@ -241,6 +244,17 @@ static PRLogModuleInfo* gDocShellLeakLog;
const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties";
const char kAppstringsBundleURL[] = "chrome://global/locale/appstrings.properties";
static void
FavorPerformanceHint(bool perfOverStarvation)
{
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
if (appShell) {
appShell->FavorPerformanceHint(perfOverStarvation,
Preferences::GetUint("docshell.event_starvation_delay_hint",
NS_EVENT_STARVATION_DELAY_HINT));
}
}
//*****************************************************************************
// <a ping> support
//*****************************************************************************
@@ -6852,6 +6866,14 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
mIsExecutingOnLoadHandler = false;
mEODForCurrentDocument = true;
// If all documents have completed their loading
// favor native event dispatch priorities
// over performance
if (--gNumberOfDocumentsLoading == 0) {
// Hint to use normal native event dispatch priorities
FavorPerformanceHint(false);
}
}
/* Check if the httpChannel has any cache-control related response headers,
* like no-store, no-cache. If so, update SHEntry so that
@@ -7855,6 +7877,12 @@ nsDocShell::RestoreFromHistory()
mSavingOldViewer = false;
mEODForCurrentDocument = false;
// Tell the event loop to favor plevents over user events, see comments
// in CreateContentViewer.
if (++gNumberOfDocumentsLoading == 1)
FavorPerformanceHint(true);
if (oldMUDV && newMUDV) {
newMUDV->SetMinFontSize(minFontSize);
newMUDV->SetTextZoom(textZoom);
@@ -8251,6 +8279,16 @@ nsDocShell::CreateContentViewer(const char *aContentType,
}
}
// Give hint to native plevent dispatch mechanism. If a document
// is loading the native plevent dispatch mechanism should favor
// performance over normal native event dispatch priorities.
if (++gNumberOfDocumentsLoading == 1) {
// Hint to favor performance for the plevent notification mechanism.
// We want the pages to load as fast as possible even if its means
// native messages might be starved.
FavorPerformanceHint(true);
}
if (onLocationChangeNeeded) {
FireOnLocationChange(this, request, mCurrentURI, 0);
}