Bug 1864817 - initialize STYLE_THREAD_POOL in Sevo_initialize. r=emilio,jesup

Differential Revision: https://phabricator.services.mozilla.com/D201022
This commit is contained in:
sunil mayya 2024-02-22 10:43:49 +00:00
parent 41e04657c2
commit 022e5ba65d
6 changed files with 13 additions and 7 deletions

1
Cargo.lock generated
View file

@ -2094,6 +2094,7 @@ dependencies = [
"cstr", "cstr",
"dom", "dom",
"gecko-profiler", "gecko-profiler",
"lazy_static",
"libc", "libc",
"log", "log",
"malloc_size_of", "malloc_size_of",

View file

@ -755,7 +755,7 @@ bool gfxPlatformFontList::InitOtherFamilyNames(
// (This is used so we can reliably run reftests that depend on localized // (This is used so we can reliably run reftests that depend on localized
// font-family names being available.) // font-family names being available.)
if (aDeferOtherFamilyNamesLoading && if (aDeferOtherFamilyNamesLoading &&
StaticPrefs::gfx_font_loader_delay_AtStartup() > 0) { StaticPrefs::gfx_font_loader_delay() > 0) {
if (!mPendingOtherFamilyNameTask) { if (!mPendingOtherFamilyNameTask) {
RefPtr<mozilla::CancelableRunnable> task = RefPtr<mozilla::CancelableRunnable> task =
new InitOtherFamilyNamesRunnable(); new InitOtherFamilyNamesRunnable();
@ -2648,7 +2648,7 @@ bool gfxPlatformFontList::LoadFontInfo() {
// Limit the time spent reading fonts in one pass, unless the font-loader // Limit the time spent reading fonts in one pass, unless the font-loader
// delay was set to zero, in which case we run to completion even if it // delay was set to zero, in which case we run to completion even if it
// causes some jank. // causes some jank.
if (StaticPrefs::gfx_font_loader_delay_AtStartup() > 0) { if (StaticPrefs::gfx_font_loader_delay() > 0) {
TimeDuration elapsed = TimeStamp::Now() - start; TimeDuration elapsed = TimeStamp::Now() - start;
if (elapsed.ToMilliseconds() > FONT_LOADER_MAX_TIMESLICE && if (elapsed.ToMilliseconds() > FONT_LOADER_MAX_TIMESLICE &&
i + 1 != endIndex) { i + 1 != endIndex) {
@ -2751,7 +2751,7 @@ void gfxPlatformFontList::GetPrefsAndStartLoader() {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) { if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return; return;
} }
uint32_t delay = std::max(1u, StaticPrefs::gfx_font_loader_delay_AtStartup()); uint32_t delay = std::max(1u, StaticPrefs::gfx_font_loader_delay());
if (NS_IsMainThread()) { if (NS_IsMainThread()) {
StartLoader(delay); StartLoader(delay);
} else { } else {

View file

@ -6063,13 +6063,13 @@
mirror: once mirror: once
- name: gfx.font_loader.delay - name: gfx.font_loader.delay
type: uint32_t type: RelaxedAtomicUint32
#if defined(XP_WIN) #if defined(XP_WIN)
value: 60000 value: 60000
#else #else
value: 8000 value: 8000
#endif #endif
mirror: once mirror: always
# Disable antialiasing of Ahem, for use in tests. # Disable antialiasing of Ahem, for use in tests.
- name: gfx.font_rendering.ahem_antialias_none - name: gfx.font_rendering.ahem_antialias_none
@ -8781,9 +8781,9 @@
# numbers override as specified. # numbers override as specified.
# Note that 1 still creates a thread-pool of one thread! # Note that 1 still creates a thread-pool of one thread!
- name: layout.css.stylo-threads - name: layout.css.stylo-threads
type: int32_t type: RelaxedAtomicInt32
value: -1 value: -1
mirror: once mirror: always
rust: true rust: true
# Stylo work unit size. This is the amount of nodes we'll process in a single # Stylo work unit size. This is the amount of nodes we'll process in a single

View file

@ -31,3 +31,4 @@ style = {path = "../../components/style", features = ["gecko"]}
style_traits = {path = "../../components/style_traits"} style_traits = {path = "../../components/style_traits"}
thin-vec = { version = "0.2.1", features = ["gecko-ffi"] } thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
to_shmem = {path = "../../components/to_shmem"} to_shmem = {path = "../../components/to_shmem"}
lazy_static = "1.0"

View file

@ -204,6 +204,9 @@ pub unsafe extern "C" fn Servo_Initialize(
// Pretend that we're a Servo Layout thread, to make some assertions happy. // Pretend that we're a Servo Layout thread, to make some assertions happy.
thread_state::initialize(thread_state::ThreadState::LAYOUT); thread_state::initialize(thread_state::ThreadState::LAYOUT);
debug_assert!(is_main_thread());
lazy_static::initialize(&STYLE_THREAD_POOL);
// Perform some debug-only runtime assertions. // Perform some debug-only runtime assertions.
origin_flags::assert_flags_match(); origin_flags::assert_flags_match();
traversal_flags::assert_traversal_flags_match(); traversal_flags::assert_traversal_flags_match();

View file

@ -23,6 +23,7 @@ extern crate style;
extern crate style_traits; extern crate style_traits;
extern crate thin_vec; extern crate thin_vec;
extern crate to_shmem; extern crate to_shmem;
extern crate lazy_static;
mod error_reporter; mod error_reporter;
#[allow(non_snake_case)] #[allow(non_snake_case)]