Bug 1804295 - Remove the current use of favorPerformanceHint, r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D163964
This commit is contained in:
Olli Pettay 2022-12-27 13:12:21 +00:00
Родитель 70a17dc834
Коммит 2e25a827e0
3 изменённых файлов: 0 добавлений и 64 удалений

Просмотреть файл

@ -96,7 +96,6 @@
#include "mozilla/net/UrlClassifierFeatureFactory.h"
#include "ReferrerInfo.h"
#include "nsIAppShell.h"
#include "nsIAuthPrompt.h"
#include "nsIAuthPrompt2.h"
#include "nsICachingChannel.h"
@ -265,17 +264,6 @@ using mozilla::ipc::Endpoint;
// Threshold value in ms for META refresh based redirects
#define REFRESH_REDIRECT_TIMER 15000
// Hint for native dispatch of events on how long to delay after
// all documents have loaded in milliseconds before favoring normal
// native event dispatch priorites over performance
// Can be overridden with docshell.event_starvation_delay_hint pref.
#define NS_EVENT_STARVATION_DELAY_HINT 2000
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
// Number of documents currently loading
static int32_t gNumberOfDocumentsLoading = 0;
static mozilla::LazyLogModule gCharsetMenuLog("CharsetMenu");
#define LOGCHARSETMENU(args) \
@ -297,16 +285,6 @@ extern mozilla::LazyLogModule gSHIPBFCacheLog;
const char kAppstringsBundleURL[] =
"chrome://global/locale/appstrings.properties";
static void FavorPerformanceHint(bool aPerfOverStarvation) {
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
if (appShell) {
appShell->FavorPerformanceHint(
aPerfOverStarvation,
Preferences::GetUint("docshell.event_starvation_delay_hint",
NS_EVENT_STARVATION_DELAY_HINT));
}
}
static bool IsTopLevelDoc(BrowsingContext* aBrowsingContext,
nsILoadInfo* aLoadInfo) {
MOZ_ASSERT(aBrowsingContext);
@ -6470,14 +6448,6 @@ nsresult 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
@ -7615,12 +7585,6 @@ nsresult 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 (document) {
RefPtr<nsDocShell> parent = GetInProcessParentDocshell();
if (parent) {
@ -8112,16 +8076,6 @@ nsresult nsDocShell::CreateContentViewer(const nsACString& 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 (errorOnLocationChangeNeeded) {
FireOnLocationChange(this, failedChannel, failedURI,
LOCATION_CHANGE_ERROR_PAGE);

Просмотреть файл

@ -172,7 +172,6 @@ nsresult nsContentSink::Init(Document* aDoc, nsIURI* aURI,
if (StaticPrefs::content_sink_enable_perf_mode() != 0) {
mDynamicLowerValue = StaticPrefs::content_sink_enable_perf_mode() == 1;
FavorPerformanceHint(!mDynamicLowerValue, 0);
}
return NS_OK;
@ -731,14 +730,6 @@ nsresult nsContentSink::DidProcessATokenImpl() {
//----------------------------------------------------------------------
void nsContentSink::FavorPerformanceHint(bool perfOverStarvation,
uint32_t starvationDelay) {
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
if (appShell)
appShell->FavorPerformanceHint(perfOverStarvation, starvationDelay);
}
void nsContentSink::BeginUpdate(Document* aDocument) {
// Remember nested updates from updates that we started.
if (mInNotification > 0 && mUpdatesInNotification < 2) {
@ -811,12 +802,6 @@ void nsContentSink::DropParserAndPerfHint(void) {
RefPtr<nsParserBase> kungFuDeathGrip = std::move(mParser);
mozilla::Unused << kungFuDeathGrip;
if (mDynamicLowerValue) {
// Reset the performance hint which was set to FALSE
// when mDynamicLowerValue was set.
FavorPerformanceHint(true, 0);
}
// Call UnblockOnload only if mRunsToComletion is false and if
// we have already started loading because it's possible that this function
// is called (i.e. the parser is terminated) before we start loading due to
@ -857,7 +842,6 @@ nsresult nsContentSink::WillParseImpl(void) {
StaticPrefs::content_sink_interactive_time());
if (mDynamicLowerValue != newDynLower) {
FavorPerformanceHint(!newDynLower, 0);
mDynamicLowerValue = newDynLower;
}
}

Просмотреть файл

@ -170,8 +170,6 @@ class nsContentSink : public nsICSSLoaderObserver,
Document* GetDocument() { return mDocument; }
protected:
void FavorPerformanceHint(bool perfOverStarvation, uint32_t starvationDelay);
inline int32_t GetNotificationInterval() {
if (mDynamicLowerValue) {
return 1000;