Move stylo thread pool mutex to servo layout thread crates (#34480)

* Eliminate stylo thread pool mutex

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Reinstate Mutex in the Servo codebase

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Revert back to main Stylo branch

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
This commit is contained in:
Nico Burns 2024-12-05 17:10:27 +13:00 committed by GitHub
parent e4ec84fad1
commit 97f486ad26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 15 deletions

View file

@ -81,7 +81,7 @@ use style::context::{
use style::dom::{OpaqueNode, ShowSubtree, ShowSubtreeDataAndPrimaryValues, TElement, TNode};
use style::driver;
use style::error_reporting::RustLogReporter;
use style::global_style_data::{GLOBAL_STYLE_DATA, STYLE_THREAD_POOL};
use style::global_style_data::GLOBAL_STYLE_DATA;
use style::invalidation::element::restyle_hints::RestyleHint;
use style::logical_geometry::LogicalPoint;
use style::media_queries::{Device, MediaList, MediaType};
@ -109,6 +109,14 @@ use webrender_api::units::DevicePixel;
use webrender_api::{units, ColorF, HitTestFlags};
use webrender_traits::CrossProcessCompositorApi;
// This mutex is necessary due to syncronisation issues between two different types of thread-local storage
// which manifest themselves when the layout thread tries to layout iframes in parallel with the main page
//
// See: https://github.com/servo/servo/pull/29792
// And: https://gist.github.com/mukilan/ed57eb61b83237a05fbf6360ec5e33b0
static STYLE_THREAD_POOL: Mutex<&style::global_style_data::STYLE_THREAD_POOL> =
Mutex::new(&style::global_style_data::STYLE_THREAD_POOL);
/// Information needed by layout.
pub struct LayoutThread {
/// The ID of the pipeline that we belong to.