Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync changes from mozilla-central gfx/wr #3850

Merged
merged 4 commits into from Feb 5, 2020
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Some generated files are not rendered by default. Learn more.

@@ -15,10 +15,6 @@ set -o xtrace

CARGOFLAGS=${CARGOFLAGS:-"--verbose"} # default to --verbose if not set

pushd webrender_api
cargo test ${CARGOFLAGS} --features "ipc"
popd

pushd webrender
cargo build ${CARGOFLAGS} --no-default-features
cargo build ${CARGOFLAGS} --no-default-features --features capture
@@ -22,10 +22,6 @@ set -o xtrace
CARGOFLAGS=${CARGOFLAGS:-"--verbose"} # default to --verbose if not set
CARGOTESTFLAGS=${CARGOTESTFLAGS:-""}

pushd webrender_api
cargo check ${CARGOFLAGS} --features "ipc"
popd

pushd webrender
cargo check ${CARGOFLAGS} --no-default-features
cargo check ${CARGOFLAGS} --no-default-features --features capture
@@ -160,6 +160,7 @@ impl api::BlobImageHandler for CheckerboardRenderer {
_requests: &[api::BlobImageParams],
) {}

fn enable_multithreading(&mut self, _: bool) {}
fn delete_font(&mut self, _font: api::FontKey) {}
fn delete_font_instance(&mut self, _instance: api::FontInstanceKey) {}
fn clear_namespace(&mut self, _namespace: api::IdNamespace) {}
@@ -8,7 +8,6 @@ check-alphabetical-order = false
packages = [
"core-graphics",
"core-text",
"crossbeam-utils",
"gl_generator",
"lazy_static",
"percent-encoding",
@@ -108,6 +108,10 @@ impl GlyphRasterizer {
self.request_glyphs_from_backend(font, new_glyphs);
}

pub fn enable_multithreading(&mut self, enable: bool) {
self.enable_multithreading = enable;
}

pub(in super) fn request_glyphs_from_backend(&mut self, font: FontInstance, glyphs: Vec<GlyphKey>) {
let font_contexts = Arc::clone(&self.font_contexts);
let glyph_tx = self.glyph_tx.clone();
@@ -154,7 +158,7 @@ impl GlyphRasterizer {

// if the number of glyphs is small, do it inline to avoid the threading overhead;
// send the result into glyph_tx so downstream code can't tell the difference.
if glyphs.len() < 8 {
if !self.enable_multithreading || glyphs.len() < 8 {
let jobs = glyphs.iter()
.map(|key: &GlyphKey| process_glyph(key, &font_contexts, &font))
.collect();
@@ -880,6 +884,9 @@ pub struct GlyphRasterizer {

#[allow(dead_code)]
next_gpu_glyph_cache_key: GpuGlyphCacheKey,

// Whether to parallelize glyph rasterization with rayon.
enable_multithreading: bool,
}

impl GlyphRasterizer {
@@ -912,6 +919,7 @@ impl GlyphRasterizer {
fonts_to_remove: Vec::new(),
font_instances_to_remove: Vec::new(),
next_gpu_glyph_cache_key: GpuGlyphCacheKey(0),
enable_multithreading: true,
})
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.