зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1570797
, Add a pref to control the time when certain tasks are deprioritized during page load, r=farre
Differential Revision: https://phabricator.services.mozilla.com/D40330 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
12e7d2f648
Коммит
cb7e7c1dd1
|
@ -34,6 +34,7 @@
|
|||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/StaticPrefs_full_screen_api.h"
|
||||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "mozilla/StaticPrefs_page_load.h"
|
||||
#include "mozilla/StaticPrefs_plugins.h"
|
||||
#include "mozilla/StaticPrefs_privacy.h"
|
||||
#include "mozilla/StaticPrefs_security.h"
|
||||
|
@ -15851,7 +15852,8 @@ bool Document::HasRecentlyStartedForegroundLoads() {
|
|||
nsPIDOMWindowInner* win = doc->GetInnerWindow();
|
||||
if (win) {
|
||||
Performance* perf = win->GetPerformance();
|
||||
if (perf && perf->Now() < 5000) {
|
||||
if (perf &&
|
||||
perf->Now() < StaticPrefs::page_load_deprioritization_period()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
#include "mozilla/dom/DocGroup.h"
|
||||
#include "mozilla/dom/TabGroup.h"
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/StaticPrefs_page_load.h"
|
||||
#include "PaintWorkletImpl.h"
|
||||
|
||||
// Interfaces Needed
|
||||
|
@ -2575,8 +2576,9 @@ void nsGlobalWindowInner::AddDeprioritizedLoadRunner(nsIRunnable* aRunner) {
|
|||
MOZ_ASSERT(GetWindowForDeprioritizedLoadRunner() == this);
|
||||
RefPtr<DeprioritizedLoadRunner> runner = new DeprioritizedLoadRunner(aRunner);
|
||||
mDeprioritizedLoadRunner.insertBack(runner);
|
||||
NS_DispatchToCurrentThreadQueue(runner.forget(), 5000,
|
||||
EventQueuePriority::Idle);
|
||||
NS_DispatchToCurrentThreadQueue(
|
||||
runner.forget(), StaticPrefs::page_load_deprioritization_period(),
|
||||
EventQueuePriority::Idle);
|
||||
}
|
||||
|
||||
// nsISpeechSynthesisGetter
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "mozilla/StaticPrefs_apz.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "mozilla/StaticPrefs_page_load.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
|
@ -601,7 +602,9 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
|
|||
dom::Performance* perf = win->GetPerformance();
|
||||
// Limit slower refresh rate to 5 seconds between the
|
||||
// first contentful paint and page load.
|
||||
if (perf && perf->Now() < 5000) {
|
||||
if (perf &&
|
||||
perf->Now() <
|
||||
StaticPrefs::page_load_deprioritization_period()) {
|
||||
if (mProcessedVsync) {
|
||||
mProcessedVsync = false;
|
||||
// Handle this case similarly to the code above, but just
|
||||
|
|
|
@ -5526,6 +5526,18 @@
|
|||
value: false
|
||||
mirror: always
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "page_load."
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Time in milliseconds during which certain tasks are deprioritized during
|
||||
# page load.
|
||||
- name: page_load.deprioritization_period
|
||||
type: uint32_t
|
||||
value: 5000
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "plain_text."
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
|
@ -56,6 +56,7 @@ pref_groups = [
|
|||
'mousewheel',
|
||||
'network',
|
||||
'nglayout',
|
||||
'page_load',
|
||||
'plain_text',
|
||||
'plugins',
|
||||
'preferences',
|
||||
|
|
Загрузка…
Ссылка в новой задаче