gecko-dev/servo/components/layout_thread/lib.rs

1638 строки
73 KiB
Rust
Исходник Обычный вид История

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
//! The layout thread. Performs layout on the DOM, builds display lists and sends them to be
//! painted.
#![feature(box_syntax)]
#![feature(mpsc_select)]
extern crate app_units;
extern crate euclid;
extern crate fnv;
extern crate gfx;
extern crate gfx_traits;
extern crate heapsize;
extern crate ipc_channel;
#[macro_use]
extern crate layout;
extern crate layout_traits;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate msg;
extern crate net_traits;
extern crate parking_lot;
#[macro_use]
extern crate profile_traits;
extern crate rayon;
extern crate script;
extern crate script_layout_interface;
extern crate script_traits;
extern crate selectors;
extern crate serde_json;
servo: Merge #14592 - Remove the util crate (from asajeffrey:util-goodbye); r=mbrubeck <!-- Please describe your changes on the following line: --> This PR removes the `util` crate. * Replaced the `spawn_named` and `clamp` functions by appropriate uses of `std::thread::Builder::spawn`, `std::cmp::min` and `std::cmp::max`. * Moved `opts`, `prefs` and `resource_files` into a new `config` crate. * Moved `remutex` and `geometry` into their own crates. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because they are refactorings <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 4eb653817f87e5fb47de34356f558eb76ecbca9f --HG-- rename : servo/components/util/Cargo.toml => servo/components/config/Cargo.toml rename : servo/components/util/basedir.rs => servo/components/config/basedir.rs rename : servo/components/util/lib.rs => servo/components/config/lib.rs rename : servo/components/util/opts.rs => servo/components/config/opts.rs rename : servo/components/util/prefs.rs => servo/components/config/prefs.rs rename : servo/components/util/resource_files.rs => servo/components/config/resource_files.rs rename : servo/components/util/geometry.rs => servo/components/geometry/lib.rs rename : servo/components/util/remutex.rs => servo/components/remutex/lib.rs rename : servo/tests/unit/util/lib.rs => servo/tests/unit/servo_config/lib.rs rename : servo/tests/unit/util/opts.rs => servo/tests/unit/servo_config/opts.rs rename : servo/tests/unit/util/prefs.rs => servo/tests/unit/servo_config/prefs.rs rename : servo/tests/unit/util/remutex.rs => servo/tests/unit/servo_remutex/lib.rs
2016-12-15 03:48:42 +03:00
extern crate servo_config;
extern crate servo_geometry;
extern crate servo_url;
extern crate style;
extern crate webrender_traits;
use app_units::Au;
use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::scale_factor::ScaleFactor;
use euclid::size::Size2D;
use fnv::FnvHasher;
servo: Merge #16336 - Used shared clips for overflow:hidden and CSS clip (from mrobinson:overflow-hidden); r=glennw Instead of passing down a complex clipping region to each item, used shared clipping to handle overflow:hidden and CSS clips. In addition to being more efficient, this should also fix quite a few issues related to absolutely positioned elements. One existing reftest is slightly modified to avoid tickling a quirk with the way that WebRender rasterizes masks. We are working out how to best express these combined masks with the API or need to. The change does not affect the original subject of the reftest. Fixes #13109. Fixes #10151. Fixes #7575. Fixes #8074. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #13109, #10151, #7575, #8074. <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: ab7e1e2d36829e20df130f7174c3c7d1dbbd5cc5 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : f0f2687589ff10964ff809060f17d3c7e3e358c8
2017-04-18 00:08:00 +03:00
use gfx::display_list::{OpaqueNode, WebRenderImageInfo};
use gfx::font;
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
use gfx::font_cache_thread::FontCacheThread;
use gfx::font_context;
use gfx_traits::{Epoch, FragmentType, ScrollRootId};
use heapsize::HeapSizeOf;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use layout::animation;
use layout::construct::ConstructionResult;
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
use layout::context::LayoutContext;
use layout::context::heap_size_of_persistent_local_context;
use layout::display_list_builder::ToGfxColor;
use layout::flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils};
use layout::flow_ref::FlowRef;
use layout::incremental::{LayoutDamageComputation, REFLOW_ENTIRE_DOCUMENT};
use layout::layout_debug;
use layout::opaque_node::OpaqueNodeMethods;
use layout::parallel;
use layout::query::{LayoutRPCImpl, LayoutThreadData, process_content_box_request, process_content_boxes_request};
use layout::query::{process_margin_style_query, process_node_overflow_request, process_resolved_style_request};
use layout::query::{process_node_geometry_request, process_node_scroll_area_request};
use layout::query::{process_node_scroll_root_id_request, process_offset_parent_query};
use layout::sequential;
use layout::traversal::{ComputeAbsolutePositions, RecalcStyleAndConstructFlows};
use layout::webrender_helpers::WebRenderDisplayListConverter;
use layout::wrapper::LayoutNodeLayoutData;
use layout::wrapper::drop_style_and_layout_data;
use layout_traits::LayoutThreadFactory;
use msg::constellation_msg::{FrameId, PipelineId};
use net_traits::image_cache::{ImageCache, UsePlaceholder};
use parking_lot::RwLock;
use profile_traits::mem::{self, Report, ReportKind, ReportsChan};
use profile_traits::time::{self, TimerMetadata, profile};
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
use script::layout_wrapper::{ServoLayoutElement, ServoLayoutDocument, ServoLayoutNode};
use script_layout_interface::message::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType, ScriptReflow};
use script_layout_interface::reporter::CSSErrorReporter;
use script_layout_interface::rpc::{LayoutRPC, MarginStyleResponse, NodeOverflowResponse, OffsetParentResponse};
use script_layout_interface::rpc::TextIndexResponse;
use script_layout_interface::wrapper_traits::LayoutNode;
use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
use script_traits::{StackingContextScrollState, UntrustedNodeAddress};
use selectors::Element;
servo: Merge #14592 - Remove the util crate (from asajeffrey:util-goodbye); r=mbrubeck <!-- Please describe your changes on the following line: --> This PR removes the `util` crate. * Replaced the `spawn_named` and `clamp` functions by appropriate uses of `std::thread::Builder::spawn`, `std::cmp::min` and `std::cmp::max`. * Moved `opts`, `prefs` and `resource_files` into a new `config` crate. * Moved `remutex` and `geometry` into their own crates. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because they are refactorings <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 4eb653817f87e5fb47de34356f558eb76ecbca9f --HG-- rename : servo/components/util/Cargo.toml => servo/components/config/Cargo.toml rename : servo/components/util/basedir.rs => servo/components/config/basedir.rs rename : servo/components/util/lib.rs => servo/components/config/lib.rs rename : servo/components/util/opts.rs => servo/components/config/opts.rs rename : servo/components/util/prefs.rs => servo/components/config/prefs.rs rename : servo/components/util/resource_files.rs => servo/components/config/resource_files.rs rename : servo/components/util/geometry.rs => servo/components/geometry/lib.rs rename : servo/components/util/remutex.rs => servo/components/remutex/lib.rs rename : servo/tests/unit/util/lib.rs => servo/tests/unit/servo_config/lib.rs rename : servo/tests/unit/util/opts.rs => servo/tests/unit/servo_config/opts.rs rename : servo/tests/unit/util/prefs.rs => servo/tests/unit/servo_config/prefs.rs rename : servo/tests/unit/util/remutex.rs => servo/tests/unit/servo_remutex/lib.rs
2016-12-15 03:48:42 +03:00
use servo_config::opts;
use servo_config::prefs::PREFS;
use servo_config::resource_files::read_resource_file;
use servo_geometry::max_rect;
use servo_url::ServoUrl;
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::hash::BuildHasherDefault;
use std::marker::PhantomData;
use std::mem as std_mem;
use std::ops::{Deref, DerefMut};
use std::process;
use std::sync::{Arc, Mutex, MutexGuard};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{Receiver, Sender, channel};
servo: Merge #14592 - Remove the util crate (from asajeffrey:util-goodbye); r=mbrubeck <!-- Please describe your changes on the following line: --> This PR removes the `util` crate. * Replaced the `spawn_named` and `clamp` functions by appropriate uses of `std::thread::Builder::spawn`, `std::cmp::min` and `std::cmp::max`. * Moved `opts`, `prefs` and `resource_files` into a new `config` crate. * Moved `remutex` and `geometry` into their own crates. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because they are refactorings <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 4eb653817f87e5fb47de34356f558eb76ecbca9f --HG-- rename : servo/components/util/Cargo.toml => servo/components/config/Cargo.toml rename : servo/components/util/basedir.rs => servo/components/config/basedir.rs rename : servo/components/util/lib.rs => servo/components/config/lib.rs rename : servo/components/util/opts.rs => servo/components/config/opts.rs rename : servo/components/util/prefs.rs => servo/components/config/prefs.rs rename : servo/components/util/resource_files.rs => servo/components/config/resource_files.rs rename : servo/components/util/geometry.rs => servo/components/geometry/lib.rs rename : servo/components/util/remutex.rs => servo/components/remutex/lib.rs rename : servo/tests/unit/util/lib.rs => servo/tests/unit/servo_config/lib.rs rename : servo/tests/unit/util/opts.rs => servo/tests/unit/servo_config/opts.rs rename : servo/tests/unit/util/prefs.rs => servo/tests/unit/servo_config/prefs.rs rename : servo/tests/unit/util/remutex.rs => servo/tests/unit/servo_remutex/lib.rs
2016-12-15 03:48:42 +03:00
use std::thread;
servo: Merge #12515 - Make the style crate more concrete (from servo:concrete-style); r=bholley Background: The changes to Servo code to support Stylo began in the `selectors` crate with making pseudo-elements generic, defined be the user, so that different users (such as Servo and Gecko/Stylo) could have a different set of pseudo-elements supported and parsed. Adding a trait makes sense there since `selectors` is in its own repository and has others users (or at least [one](https://github.com/SimonSapin/kuchiki)). Then we kind of kept going with the same pattern and added a bunch of traits in the `style` crate to make everything generic, allowing Servo and Gecko/Stylo to do things differently. But we’ve also added a `gecko` Cargo feature to do conditional compilation, at first to enable or disable some CSS properties and values in the Mako templates. Since we’re doing conditional compilation anyway, it’s often easier and simpler to do it more (with `#[cfg(feature = "gecko")]` and `#[cfg(feature = "servo")]`) that to keep adding traits and making everything generic. When a type is generic, any method that we want to call on it needs to be part of some trait. ---- The first several commits move some code around, mostly from `geckolib` to `style` (with `#[cfg(feature = "gecko")]`) but otherwise don’t change much. The following commits remove some traits and many type parameters through the `style` crate, replacing them with pairs of conditionally-compiled API-compatible items (types, methods, …). Simplifying code is nice to make it more maintainable, but this is motivated by another change described in https://github.com/servo/servo/pull/12391#issuecomment-232183942. (Porting Servo for that change proved difficult because some code in the `style` crate was becoming generic over `String` vs `Atom`, and this PR will help make that concrete. That change, in turn, is motivated by removing geckolib’s `[replace]` override for string-cache, in order to enable using a single Cargo "workspace" in this repository.) r? @bholley --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require new tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 2d01d41a506bcbc7f26a2284b9f42390d6ef96ab --HG-- rename : servo/ports/geckolib/selector_impl.rs => servo/components/style/gecko_selector_impl.rs rename : servo/ports/geckolib/values.rs => servo/components/style/gecko_values.rs rename : servo/ports/geckolib/properties.mako.rs => servo/components/style/properties/gecko.mako.rs
2016-07-20 10:58:34 +03:00
use style::animation::Animation;
use style::context::{QuirksMode, ReflowGoal, SharedStyleContext};
use style::context::{StyleSystemOptions, ThreadLocalStyleContextCreationInfo};
use style::data::StoredRestyleHint;
use style::dom::{ShowSubtree, ShowSubtreeDataAndPrimaryValues, TElement, TNode};
use style::error_reporting::StdoutErrorReporter;
use style::logical_geometry::LogicalPoint;
use style::media_queries::{Device, MediaList, MediaType};
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION, STORE_OVERFLOW};
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard, StylesheetGuards};
use style::stylesheets::{Origin, Stylesheet, UserAgentStylesheets};
use style::stylist::{ExtraStyleData, Stylist};
use style::thread_state;
use style::timer::Timer;
use style::traversal::{DomTraversal, TraversalDriver, TraversalFlags};
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// Information needed by the layout thread.
pub struct LayoutThread {
/// The ID of the pipeline that we belong to.
id: PipelineId,
/// The URL of the pipeline that we belong to.
url: ServoUrl,
/// Is the current reflow of an iframe, as opposed to a root window?
is_iframe: bool,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// The port on which we receive messages from the script thread.
port: Receiver<Msg>,
/// The port on which we receive messages from the constellation.
pipeline_port: Receiver<LayoutControlMsg>,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// The port on which we receive messages from the font cache thread.
font_cache_receiver: Receiver<()>,
/// The channel on which the font cache can send messages to us.
font_cache_sender: IpcSender<()>,
/// The channel on which messages can be sent to the constellation.
constellation_chan: IpcSender<ConstellationMsg>,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// The channel on which messages can be sent to the script thread.
script_chan: IpcSender<ConstellationControlMsg>,
/// The channel on which messages can be sent to the time profiler.
time_profiler_chan: time::ProfilerChan,
/// The channel on which messages can be sent to the memory profiler.
mem_profiler_chan: mem::ProfilerChan,
/// Reference to the script thread image cache.
image_cache: Arc<ImageCache>,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// Public interface to the font cache thread.
font_cache_thread: FontCacheThread,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// Is this the first reflow in this LayoutThread?
first_reflow: bool,
/// The workers that we use for parallel operation.
parallel_traversal: Option<rayon::ThreadPool>,
/// Flag to indicate whether to use parallel operations
parallel_flag: bool,
/// Starts at zero, and increased by one every time a layout completes.
/// This can be used to easily check for invalid stale data.
generation: u32,
/// A channel on which new animations that have been triggered by style recalculation can be
/// sent.
new_animations_sender: Sender<Animation>,
/// Receives newly-discovered animations.
new_animations_receiver: Receiver<Animation>,
/// The number of Web fonts that have been requested but not yet loaded.
outstanding_web_fonts: Arc<AtomicUsize>,
/// The root of the flow tree.
root_flow: Option<FlowRef>,
/// The document-specific shared lock used for author-origin stylesheets
document_shared_lock: Option<SharedRwLock>,
/// The list of currently-running animations.
running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
/// The list of animations that have expired since the last style recalculation.
expired_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
/// A counter for epoch messages
epoch: Epoch,
/// The size of the viewport. This may be different from the size of the screen due to viewport
/// constraints.
viewport_size: Size2D<Au>,
/// A mutex to allow for fast, read-only RPC of layout's internal data
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// structures, while still letting the LayoutThread modify them.
///
/// All the other elements of this struct are read-only.
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
rw_data: Arc<Mutex<LayoutThreadData>>,
/// The CSS error reporter for all CSS loaded in this layout thread
error_reporter: CSSErrorReporter,
webrender_image_cache: Arc<RwLock<HashMap<(ServoUrl, UsePlaceholder),
WebRenderImageInfo,
BuildHasherDefault<FnvHasher>>>>,
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
/// Webrender interface.
webrender_api: webrender_traits::RenderApi,
/// The timer object to control the timing of the animations. This should
/// only be a test-mode timer during testing for animations.
timer: Timer,
servo: Merge #14592 - Remove the util crate (from asajeffrey:util-goodbye); r=mbrubeck <!-- Please describe your changes on the following line: --> This PR removes the `util` crate. * Replaced the `spawn_named` and `clamp` functions by appropriate uses of `std::thread::Builder::spawn`, `std::cmp::min` and `std::cmp::max`. * Moved `opts`, `prefs` and `resource_files` into a new `config` crate. * Moved `remutex` and `geometry` into their own crates. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because they are refactorings <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 4eb653817f87e5fb47de34356f558eb76ecbca9f --HG-- rename : servo/components/util/Cargo.toml => servo/components/config/Cargo.toml rename : servo/components/util/basedir.rs => servo/components/config/basedir.rs rename : servo/components/util/lib.rs => servo/components/config/lib.rs rename : servo/components/util/opts.rs => servo/components/config/opts.rs rename : servo/components/util/prefs.rs => servo/components/config/prefs.rs rename : servo/components/util/resource_files.rs => servo/components/config/resource_files.rs rename : servo/components/util/geometry.rs => servo/components/geometry/lib.rs rename : servo/components/util/remutex.rs => servo/components/remutex/lib.rs rename : servo/tests/unit/util/lib.rs => servo/tests/unit/servo_config/lib.rs rename : servo/tests/unit/util/opts.rs => servo/tests/unit/servo_config/opts.rs rename : servo/tests/unit/util/prefs.rs => servo/tests/unit/servo_config/prefs.rs rename : servo/tests/unit/util/remutex.rs => servo/tests/unit/servo_remutex/lib.rs
2016-12-15 03:48:42 +03:00
// Number of layout threads. This is copied from `servo_config::opts`, but we'd
// rather limit the dependency on that module here.
layout_threads: usize,
/// Which quirks mode are we rendering the document in?
quirks_mode: Option<QuirksMode>
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
impl LayoutThreadFactory for LayoutThread {
type Message = Msg;
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// Spawns a new layout thread.
fn create(id: PipelineId,
top_level_frame_id: Option<FrameId>,
url: ServoUrl,
is_iframe: bool,
chan: (Sender<Msg>, Receiver<Msg>),
pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
script_chan: IpcSender<ConstellationControlMsg>,
image_cache: Arc<ImageCache>,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan,
content_process_shutdown_chan: Option<IpcSender<()>>,
webrender_api_sender: webrender_traits::RenderApiSender,
layout_threads: usize) {
servo: Merge #14592 - Remove the util crate (from asajeffrey:util-goodbye); r=mbrubeck <!-- Please describe your changes on the following line: --> This PR removes the `util` crate. * Replaced the `spawn_named` and `clamp` functions by appropriate uses of `std::thread::Builder::spawn`, `std::cmp::min` and `std::cmp::max`. * Moved `opts`, `prefs` and `resource_files` into a new `config` crate. * Moved `remutex` and `geometry` into their own crates. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because they are refactorings <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 4eb653817f87e5fb47de34356f558eb76ecbca9f --HG-- rename : servo/components/util/Cargo.toml => servo/components/config/Cargo.toml rename : servo/components/util/basedir.rs => servo/components/config/basedir.rs rename : servo/components/util/lib.rs => servo/components/config/lib.rs rename : servo/components/util/opts.rs => servo/components/config/opts.rs rename : servo/components/util/prefs.rs => servo/components/config/prefs.rs rename : servo/components/util/resource_files.rs => servo/components/config/resource_files.rs rename : servo/components/util/geometry.rs => servo/components/geometry/lib.rs rename : servo/components/util/remutex.rs => servo/components/remutex/lib.rs rename : servo/tests/unit/util/lib.rs => servo/tests/unit/servo_config/lib.rs rename : servo/tests/unit/util/opts.rs => servo/tests/unit/servo_config/opts.rs rename : servo/tests/unit/util/prefs.rs => servo/tests/unit/servo_config/prefs.rs rename : servo/tests/unit/util/remutex.rs => servo/tests/unit/servo_remutex/lib.rs
2016-12-15 03:48:42 +03:00
thread::Builder::new().name(format!("LayoutThread {:?}", id)).spawn(move || {
thread_state::initialize(thread_state::LAYOUT);
if let Some(top_level_frame_id) = top_level_frame_id {
FrameId::install(top_level_frame_id);
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
{ // Ensures layout thread is destroyed before we send shutdown message
let sender = chan.0;
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
let layout = LayoutThread::new(id,
url,
is_iframe,
chan.1,
pipeline_port,
constellation_chan,
script_chan,
image_cache.clone(),
font_cache_thread,
time_profiler_chan,
mem_profiler_chan.clone(),
webrender_api_sender,
layout_threads);
let reporter_name = format!("layout-reporter-{}", id);
mem_profiler_chan.run_with_memory_reporting(|| {
layout.start();
}, reporter_name, sender, Msg::CollectReports);
}
if let Some(content_process_shutdown_chan) = content_process_shutdown_chan {
let _ = content_process_shutdown_chan.send(());
}
servo: Merge #14592 - Remove the util crate (from asajeffrey:util-goodbye); r=mbrubeck <!-- Please describe your changes on the following line: --> This PR removes the `util` crate. * Replaced the `spawn_named` and `clamp` functions by appropriate uses of `std::thread::Builder::spawn`, `std::cmp::min` and `std::cmp::max`. * Moved `opts`, `prefs` and `resource_files` into a new `config` crate. * Moved `remutex` and `geometry` into their own crates. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because they are refactorings <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 4eb653817f87e5fb47de34356f558eb76ecbca9f --HG-- rename : servo/components/util/Cargo.toml => servo/components/config/Cargo.toml rename : servo/components/util/basedir.rs => servo/components/config/basedir.rs rename : servo/components/util/lib.rs => servo/components/config/lib.rs rename : servo/components/util/opts.rs => servo/components/config/opts.rs rename : servo/components/util/prefs.rs => servo/components/config/prefs.rs rename : servo/components/util/resource_files.rs => servo/components/config/resource_files.rs rename : servo/components/util/geometry.rs => servo/components/geometry/lib.rs rename : servo/components/util/remutex.rs => servo/components/remutex/lib.rs rename : servo/tests/unit/util/lib.rs => servo/tests/unit/servo_config/lib.rs rename : servo/tests/unit/util/opts.rs => servo/tests/unit/servo_config/opts.rs rename : servo/tests/unit/util/prefs.rs => servo/tests/unit/servo_config/prefs.rs rename : servo/tests/unit/util/remutex.rs => servo/tests/unit/servo_remutex/lib.rs
2016-12-15 03:48:42 +03:00
}).expect("Thread spawning failed");
}
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// The `LayoutThread` `rw_data` lock must remain locked until the first reflow,
/// as RPC calls don't make sense until then. Use this in combination with
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// `LayoutThread::lock_rw_data` and `LayoutThread::return_rw_data`.
pub enum RWGuard<'a> {
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// If the lock was previously held, from when the thread started.
Held(MutexGuard<'a, LayoutThreadData>),
/// If the lock was just used, and has been returned since there has been
/// a reflow already.
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
Used(MutexGuard<'a, LayoutThreadData>),
}
impl<'a> Deref for RWGuard<'a> {
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
type Target = LayoutThreadData;
fn deref(&self) -> &LayoutThreadData {
match *self {
RWGuard::Held(ref x) => &**x,
RWGuard::Used(ref x) => &**x,
}
}
}
impl<'a> DerefMut for RWGuard<'a> {
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
fn deref_mut(&mut self) -> &mut LayoutThreadData {
match *self {
RWGuard::Held(ref mut x) => &mut **x,
RWGuard::Used(ref mut x) => &mut **x,
}
}
}
struct RwData<'a, 'b: 'a> {
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
rw_data: &'b Arc<Mutex<LayoutThreadData>>,
possibly_locked_rw_data: &'a mut Option<MutexGuard<'b, LayoutThreadData>>,
}
impl<'a, 'b: 'a> RwData<'a, 'b> {
/// If no reflow has happened yet, this will just return the lock in
/// `possibly_locked_rw_data`. Otherwise, it will acquire the `rw_data` lock.
///
/// If you do not wish RPCs to remain blocked, just drop the `RWGuard`
/// returned from this function. If you _do_ wish for them to remain blocked,
/// use `block`.
fn lock(&mut self) -> RWGuard<'b> {
match self.possibly_locked_rw_data.take() {
None => RWGuard::Used(self.rw_data.lock().unwrap()),
Some(x) => RWGuard::Held(x),
}
}
/// If no reflow has ever been triggered, this will keep the lock, locked
/// (and saved in `possibly_locked_rw_data`). If it has been, the lock will
/// be unlocked.
fn block(&mut self, rw_data: RWGuard<'b>) {
match rw_data {
RWGuard::Used(x) => drop(x),
RWGuard::Held(x) => *self.possibly_locked_rw_data = Some(x),
}
}
}
fn add_font_face_rules(stylesheet: &Stylesheet,
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
guard: &SharedRwLockReadGuard,
device: &Device,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
font_cache_thread: &FontCacheThread,
font_cache_sender: &IpcSender<()>,
outstanding_web_fonts_counter: &Arc<AtomicUsize>) {
if opts::get().load_webfonts_synchronously {
let (sender, receiver) = ipc::channel().unwrap();
stylesheet.effective_font_face_rules(&device, guard, |rule| {
if let Some(font_face) = rule.font_face() {
let effective_sources = font_face.effective_sources();
font_cache_thread.add_web_font(font_face.family().clone(),
effective_sources,
sender.clone());
receiver.recv().unwrap();
}
})
} else {
stylesheet.effective_font_face_rules(&device, guard, |rule| {
if let Some(font_face) = rule.font_face() {
let effective_sources = font_face.effective_sources();
outstanding_web_fonts_counter.fetch_add(1, Ordering::SeqCst);
font_cache_thread.add_web_font(font_face.family().clone(),
effective_sources,
(*font_cache_sender).clone());
}
})
}
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
impl LayoutThread {
/// Creates a new `LayoutThread` structure.
fn new(id: PipelineId,
url: ServoUrl,
is_iframe: bool,
port: Receiver<Msg>,
pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
script_chan: IpcSender<ConstellationControlMsg>,
image_cache: Arc<ImageCache>,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
font_cache_thread: FontCacheThread,
servo: Merge #5348 - Rename lots of profiling-related things (from nnethercote:profiler-renaming); r=jdm ``` ------------------------------------------------------------------------ BEFORE AFTER ------------------------------------------------------------------------ util::memory util::mem - heap_size_of - heap_size_of (unchanged) - SizeOf - HeapSizeOf - size_of_excluding_self - heap_size_of_children prof::mem prof::mem - MemoryProfilerChan - ProfilerChan - MemoryReport - Report - MemoryReportsChan - ReportsChan - MemoryReporter - Reporter - MemoryProfilerMsg - ProfilerMsg - {R,UnR}egisterMemoryReporter - {R,UnR}egisterReporter - MemoryProfiler - Prof - ReportsForest - ReportsForest (unchanged) - ReportsTree - ReportsTree (unchanged) - SystemMemoryReporter - SystemReporter prof::time prof::time - TimeProfilerChan - ProfilerChan - TimerMetadata - TimerMetadata (unchanged) - Formatable - Formattable [spelling!] - TimeProfilerMsg - ProfilerMsg - TimeProfilerCategory - ProfilerCategory - TimeProfilerBuckets - ProfilerBuckets - TimeProfiler - Profiler - TimerMetadataFrameType - TimerMetadataFrameType (unchanged) - TimerMetadataReflowType - TimerMetadataReflowType (unchanged) - ProfilerMetadata - ProfilerMetadata (unchanged) ``` In a few places both prof::time and prof::mem are used, and so module-qualification is needed to avoid overlap, e.g. time::Profiler and mem::Profiler. Likewise with std::mem and prof::mem. This is not a big deal. Source-Repo: https://github.com/servo/servo Source-Revision: d784d9c488be4533a3590a154addd366d15a5864
2015-03-26 06:18:48 +03:00
time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan,
webrender_api_sender: webrender_traits::RenderApiSender,
layout_threads: usize)
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
-> LayoutThread {
let device = Device::new(
MediaType::Screen,
opts::get().initial_window_size.to_f32() * ScaleFactor::new(1.0));
let configuration =
rayon::Configuration::new().set_num_threads(layout_threads);
let parallel_traversal = rayon::ThreadPool::new(configuration).ok();
debug!("Possible layout Threads: {}", layout_threads);
servo: Merge #474 - Separate the DOM and layout into separate crates (from pcwalton:separation); r=pcwalton r? @metajack Source-Repo: https://github.com/servo/servo Source-Revision: 473b0941eca8c6498e5065892de49562dce0b78c --HG-- rename : servo/src/components/main/dom/bindings/clientrect.rs => servo/src/components/script/dom/bindings/clientrect.rs rename : servo/src/components/main/dom/bindings/clientrectlist.rs => servo/src/components/script/dom/bindings/clientrectlist.rs rename : servo/src/components/main/dom/bindings/codegen/BindingGen.py => servo/src/components/script/dom/bindings/codegen/BindingGen.py rename : servo/src/components/main/dom/bindings/codegen/BindingUtils.cpp => servo/src/components/script/dom/bindings/codegen/BindingUtils.cpp rename : servo/src/components/main/dom/bindings/codegen/BindingUtils.h => servo/src/components/script/dom/bindings/codegen/BindingUtils.h rename : servo/src/components/main/dom/bindings/codegen/Bindings.conf => servo/src/components/script/dom/bindings/codegen/Bindings.conf rename : servo/src/components/main/dom/bindings/codegen/ClientRect.webidl => servo/src/components/script/dom/bindings/codegen/ClientRect.webidl rename : servo/src/components/main/dom/bindings/codegen/ClientRectList.webidl => servo/src/components/script/dom/bindings/codegen/ClientRectList.webidl rename : servo/src/components/main/dom/bindings/codegen/Codegen.py => servo/src/components/script/dom/bindings/codegen/Codegen.py rename : servo/src/components/main/dom/bindings/codegen/CodegenRust.py => servo/src/components/script/dom/bindings/codegen/CodegenRust.py rename : servo/src/components/main/dom/bindings/codegen/Configuration.py => servo/src/components/script/dom/bindings/codegen/Configuration.py rename : servo/src/components/main/dom/bindings/codegen/DOMJSClass.h => servo/src/components/script/dom/bindings/codegen/DOMJSClass.h rename : servo/src/components/main/dom/bindings/codegen/DOMJSProxyHandler.cpp => servo/src/components/script/dom/bindings/codegen/DOMJSProxyHandler.cpp rename : servo/src/components/main/dom/bindings/codegen/DOMJSProxyHandler.h => servo/src/components/script/dom/bindings/codegen/DOMJSProxyHandler.h rename : servo/src/components/main/dom/bindings/codegen/DOMParser.webidl => servo/src/components/script/dom/bindings/codegen/DOMParser.webidl rename : servo/src/components/main/dom/bindings/codegen/ErrorResult.h => servo/src/components/script/dom/bindings/codegen/ErrorResult.h rename : servo/src/components/main/dom/bindings/codegen/Errors.msg => servo/src/components/script/dom/bindings/codegen/Errors.msg rename : servo/src/components/main/dom/bindings/codegen/Event.webidl => servo/src/components/script/dom/bindings/codegen/Event.webidl rename : servo/src/components/main/dom/bindings/codegen/EventTarget.webidl => servo/src/components/script/dom/bindings/codegen/EventTarget.webidl rename : servo/src/components/main/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py => servo/src/components/script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py rename : servo/src/components/main/dom/bindings/codegen/GlobalGen.py => servo/src/components/script/dom/bindings/codegen/GlobalGen.py rename : servo/src/components/main/dom/bindings/codegen/HTMLCollection.webidl => servo/src/components/script/dom/bindings/codegen/HTMLCollection.webidl rename : servo/src/components/main/dom/bindings/codegen/Makefile.in => servo/src/components/script/dom/bindings/codegen/Makefile.in rename : servo/src/components/main/dom/bindings/codegen/Nullable.h => servo/src/components/script/dom/bindings/codegen/Nullable.h rename : servo/src/components/main/dom/bindings/codegen/PrimitiveConversions.h => servo/src/components/script/dom/bindings/codegen/PrimitiveConversions.h rename : servo/src/components/main/dom/bindings/codegen/RegisterBindings.cpp => servo/src/components/script/dom/bindings/codegen/RegisterBindings.cpp rename : servo/src/components/main/dom/bindings/codegen/RegisterBindings.h => servo/src/components/script/dom/bindings/codegen/RegisterBindings.h rename : servo/src/components/main/dom/bindings/codegen/TypedArray.h => servo/src/components/script/dom/bindings/codegen/TypedArray.h rename : servo/src/components/main/dom/bindings/codegen/crashtests/769464.html => servo/src/components/script/dom/bindings/codegen/crashtests/769464.html rename : servo/src/components/main/dom/bindings/codegen/crashtests/crashtests.list => servo/src/components/script/dom/bindings/codegen/crashtests/crashtests.list rename : servo/src/components/main/dom/bindings/codegen/parser/README => servo/src/components/script/dom/bindings/codegen/parser/README rename : servo/src/components/main/dom/bindings/codegen/parser/UPSTREAM => servo/src/components/script/dom/bindings/codegen/parser/UPSTREAM rename : servo/src/components/main/dom/bindings/codegen/parser/WebIDL.py => servo/src/components/script/dom/bindings/codegen/parser/WebIDL.py rename : servo/src/components/main/dom/bindings/codegen/parser/runtests.py => servo/src/components/script/dom/bindings/codegen/parser/runtests.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_any_null.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_any_null.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_argument_novoid.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_argument_novoid.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_array_of_interface.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_arraybuffer.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_attr.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_attr.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_builtin_filename.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_builtin_filename.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_builtins.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_builtins.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_callback.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_callback.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_callback_interface.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_callback_interface.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_const.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_const.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_constructor.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_constructor.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_deduplicate.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_deduplicate.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_dictionary.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_distinguishability.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_double_null.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_double_null.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_empty_enum.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_empty_enum.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_enum.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_enum.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_error_colno.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_error_colno.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_error_lineno.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_error_lineno.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_extended_attributes.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_extended_attributes.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_forward_decl.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_forward_decl.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_implements.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_implements.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_incomplete_parent.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_parent.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_incomplete_types.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_types.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_interface.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_method.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_method.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_nullable_void.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_void.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_optional_constraints.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_optional_constraints.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_overload.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_overload.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_sanity.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_sanity.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_methods.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_typedef.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_typedef.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_union.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_union.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_union_any.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_union_any.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_union_nullable.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_union_nullable.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_variadic_callback.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_callback.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_variadic_constraints.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_constraints.py rename : servo/src/components/main/dom/bindings/codegen/ply/COPYING => servo/src/components/script/dom/bindings/codegen/ply/COPYING rename : servo/src/components/main/dom/bindings/codegen/ply/README => servo/src/components/script/dom/bindings/codegen/ply/README rename : servo/src/components/main/dom/bindings/codegen/ply/ply/__init__.py => servo/src/components/script/dom/bindings/codegen/ply/ply/__init__.py rename : servo/src/components/main/dom/bindings/codegen/ply/ply/lex.py => servo/src/components/script/dom/bindings/codegen/ply/ply/lex.py rename : servo/src/components/main/dom/bindings/codegen/ply/ply/yacc.py => servo/src/components/script/dom/bindings/codegen/ply/ply/yacc.py rename : servo/src/components/main/dom/bindings/codegen/pythonpath.py => servo/src/components/script/dom/bindings/codegen/pythonpath.py rename : servo/src/components/main/dom/bindings/codegen/stubgenerator/Skeleton.cpp => servo/src/components/script/dom/bindings/codegen/stubgenerator/Skeleton.cpp rename : servo/src/components/main/dom/bindings/codegen/stubgenerator/Skeleton.h => servo/src/components/script/dom/bindings/codegen/stubgenerator/Skeleton.h rename : servo/src/components/main/dom/bindings/codegen/stubgenerator/generate.sh => servo/src/components/script/dom/bindings/codegen/stubgenerator/generate.sh rename : servo/src/components/main/dom/bindings/codegen/test/Makefile.in => servo/src/components/script/dom/bindings/codegen/test/Makefile.in rename : servo/src/components/main/dom/bindings/codegen/test/TestBindingHeader.h => servo/src/components/script/dom/bindings/codegen/test/TestBindingHeader.h rename : servo/src/components/main/dom/bindings/codegen/test/TestCodeGen.webidl => servo/src/components/script/dom/bindings/codegen/test/TestCodeGen.webidl rename : servo/src/components/main/dom/bindings/codegen/test/TestDictionary.webidl => servo/src/components/script/dom/bindings/codegen/test/TestDictionary.webidl rename : servo/src/components/main/dom/bindings/codegen/test/TestTypedef.webidl => servo/src/components/script/dom/bindings/codegen/test/TestTypedef.webidl rename : servo/src/components/main/dom/bindings/codegen/test/file_bug775543.html => servo/src/components/script/dom/bindings/codegen/test/file_bug775543.html rename : servo/src/components/main/dom/bindings/codegen/test/forOf_iframe.html => servo/src/components/script/dom/bindings/codegen/test/forOf_iframe.html rename : servo/src/components/main/dom/bindings/codegen/test/test_InstanceOf.html => servo/src/components/script/dom/bindings/codegen/test/test_InstanceOf.html rename : servo/src/components/main/dom/bindings/codegen/test/test_bug773326.html => servo/src/components/script/dom/bindings/codegen/test/test_bug773326.html rename : servo/src/components/main/dom/bindings/codegen/test/test_bug775543.html => servo/src/components/script/dom/bindings/codegen/test/test_bug775543.html rename : servo/src/components/main/dom/bindings/codegen/test/test_bug788369.html => servo/src/components/script/dom/bindings/codegen/test/test_bug788369.html rename : servo/src/components/main/dom/bindings/codegen/test/test_enums.html => servo/src/components/script/dom/bindings/codegen/test/test_enums.html rename : servo/src/components/main/dom/bindings/codegen/test/test_forOf.html => servo/src/components/script/dom/bindings/codegen/test/test_forOf.html rename : servo/src/components/main/dom/bindings/codegen/test/test_integers.html => servo/src/components/script/dom/bindings/codegen/test/test_integers.html rename : servo/src/components/main/dom/bindings/codegen/test/test_interfaceToString.html => servo/src/components/script/dom/bindings/codegen/test/test_interfaceToString.html rename : servo/src/components/main/dom/bindings/codegen/test/test_lookupGetter.html => servo/src/components/script/dom/bindings/codegen/test/test_lookupGetter.html rename : servo/src/components/main/dom/bindings/codegen/test/test_sequence_wrapping.html => servo/src/components/script/dom/bindings/codegen/test/test_sequence_wrapping.html rename : servo/src/components/main/dom/bindings/codegen/test/test_traceProtos.html => servo/src/components/script/dom/bindings/codegen/test/test_traceProtos.html rename : servo/src/components/main/dom/bindings/conversions.rs => servo/src/components/script/dom/bindings/conversions.rs rename : servo/src/components/main/dom/bindings/document.rs => servo/src/components/script/dom/bindings/document.rs rename : servo/src/components/main/dom/bindings/domparser.rs => servo/src/components/script/dom/bindings/domparser.rs rename : servo/src/components/main/dom/bindings/element.rs => servo/src/components/script/dom/bindings/element.rs rename : servo/src/components/main/dom/bindings/event.rs => servo/src/components/script/dom/bindings/event.rs rename : servo/src/components/main/dom/bindings/eventtarget.rs => servo/src/components/script/dom/bindings/eventtarget.rs rename : servo/src/components/main/dom/bindings/htmlcollection.rs => servo/src/components/script/dom/bindings/htmlcollection.rs rename : servo/src/components/main/dom/bindings/node.rs => servo/src/components/script/dom/bindings/node.rs rename : servo/src/components/main/dom/bindings/proxyhandler.rs => servo/src/components/script/dom/bindings/proxyhandler.rs rename : servo/src/components/main/dom/bindings/text.rs => servo/src/components/script/dom/bindings/text.rs rename : servo/src/components/main/dom/bindings/utils.rs => servo/src/components/script/dom/bindings/utils.rs rename : servo/src/components/main/dom/bindings/window.rs => servo/src/components/script/dom/bindings/window.rs rename : servo/src/components/main/dom/characterdata.rs => servo/src/components/script/dom/characterdata.rs rename : servo/src/components/main/dom/clientrect.rs => servo/src/components/script/dom/clientrect.rs rename : servo/src/components/main/dom/clientrectlist.rs => servo/src/components/script/dom/clientrectlist.rs rename : servo/src/components/main/dom/document.rs => servo/src/components/script/dom/document.rs rename : servo/src/components/main/dom/domparser.rs => servo/src/components/script/dom/domparser.rs rename : servo/src/components/main/dom/element.rs => servo/src/components/script/dom/element.rs rename : servo/src/components/main/dom/event.rs => servo/src/components/script/dom/event.rs rename : servo/src/components/main/dom/eventtarget.rs => servo/src/components/script/dom/eventtarget.rs rename : servo/src/components/main/dom/htmlcollection.rs => servo/src/components/script/dom/htmlcollection.rs rename : servo/src/components/main/dom/node.rs => servo/src/components/script/dom/node.rs rename : servo/src/components/main/dom/window.rs => servo/src/components/script/dom/window.rs rename : servo/src/components/main/html/cssparse.rs => servo/src/components/script/html/cssparse.rs rename : servo/src/components/main/html/hubbub_html_parser.rs => servo/src/components/script/html/hubbub_html_parser.rs rename : servo/src/components/main/scripting/script_task.rs => servo/src/components/script/script_task.rs
2013-05-30 11:06:42 +04:00
// Create the channel on which new animations can be sent.
let (new_animations_sender, new_animations_receiver) = channel();
// Proxy IPC messages from the pipeline to the layout thread.
let pipeline_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(pipeline_port);
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
// Ask the router to proxy IPC messages from the font cache thread to the layout thread.
let (ipc_font_cache_sender, ipc_font_cache_receiver) = ipc::channel().unwrap();
let font_cache_receiver =
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_font_cache_receiver);
let stylist = Arc::new(Stylist::new(device));
let outstanding_web_fonts_counter = Arc::new(AtomicUsize::new(0));
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
let ua_stylesheets = &*UA_STYLESHEETS;
let guard = ua_stylesheets.shared_lock.read();
for stylesheet in &ua_stylesheets.user_or_user_agent_stylesheets {
servo: Merge #8039 - Move Stylesheet loading and ownership from the layout task into HTML elements (from tschneidereit:script-owns-stylesheets); r=jdm Stylesheets for `HTMLLinkElement`s are now loaded by the resource task, triggered by the element in question. Stylesheets are owned by the elements they're associated with, which can be `HTMLStyleElement`, `HTMLLinkElement`, and `HTMLMetaElement` (for `<meta name="viewport">). Additionally, the quirks mode stylesheet (just as the user and user agent stylesheets a couple of commits ago), is implemented as a lazy static, loaded once per process and shared between all documents. This all has various nice consequences: - Stylesheet loading becomes a non-blocking operation. - Stylesheets are removed when the element they're associated with is removed from the document. - It'll be possible to implement the CSSOM APIs that require direct access to the stylesheets (i.e., ~ all of them). - Various subtle correctness issues are fixed. One piece of interesting follow-up work would be to move parsing of external stylesheets to the resource task, too. Right now, it happens in the link element once loading is complete, so blocks the script task. Moving it to the resource task would probably be fairly straight-forward as it doesn't require access to any external state. Depends on #7979 because without that loading stylesheets asynchronously breaks lots of content. Source-Repo: https://github.com/servo/servo Source-Revision: 7ff3a17524e0e703e3ac279441729c185444be24
2015-11-07 22:41:54 +03:00
add_font_face_rules(stylesheet,
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
&guard,
&stylist.device,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
&font_cache_thread,
&ipc_font_cache_sender,
&outstanding_web_fonts_counter);
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
LayoutThread {
id: id,
url: url,
is_iframe: is_iframe,
port: port,
pipeline_port: pipeline_receiver,
script_chan: script_chan.clone(),
constellation_chan: constellation_chan.clone(),
time_profiler_chan: time_profiler_chan,
servo: Merge #5348 - Rename lots of profiling-related things (from nnethercote:profiler-renaming); r=jdm ``` ------------------------------------------------------------------------ BEFORE AFTER ------------------------------------------------------------------------ util::memory util::mem - heap_size_of - heap_size_of (unchanged) - SizeOf - HeapSizeOf - size_of_excluding_self - heap_size_of_children prof::mem prof::mem - MemoryProfilerChan - ProfilerChan - MemoryReport - Report - MemoryReportsChan - ReportsChan - MemoryReporter - Reporter - MemoryProfilerMsg - ProfilerMsg - {R,UnR}egisterMemoryReporter - {R,UnR}egisterReporter - MemoryProfiler - Prof - ReportsForest - ReportsForest (unchanged) - ReportsTree - ReportsTree (unchanged) - SystemMemoryReporter - SystemReporter prof::time prof::time - TimeProfilerChan - ProfilerChan - TimerMetadata - TimerMetadata (unchanged) - Formatable - Formattable [spelling!] - TimeProfilerMsg - ProfilerMsg - TimeProfilerCategory - ProfilerCategory - TimeProfilerBuckets - ProfilerBuckets - TimeProfiler - Profiler - TimerMetadataFrameType - TimerMetadataFrameType (unchanged) - TimerMetadataReflowType - TimerMetadataReflowType (unchanged) - ProfilerMetadata - ProfilerMetadata (unchanged) ``` In a few places both prof::time and prof::mem are used, and so module-qualification is needed to avoid overlap, e.g. time::Profiler and mem::Profiler. Likewise with std::mem and prof::mem. This is not a big deal. Source-Repo: https://github.com/servo/servo Source-Revision: d784d9c488be4533a3590a154addd366d15a5864
2015-03-26 06:18:48 +03:00
mem_profiler_chan: mem_profiler_chan,
image_cache: image_cache.clone(),
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
font_cache_thread: font_cache_thread,
first_reflow: true,
font_cache_receiver: font_cache_receiver,
font_cache_sender: ipc_font_cache_sender,
parallel_traversal: parallel_traversal,
parallel_flag: true,
generation: 0,
new_animations_sender: new_animations_sender,
new_animations_receiver: new_animations_receiver,
outstanding_web_fonts: outstanding_web_fonts_counter,
root_flow: None,
document_shared_lock: None,
running_animations: Arc::new(RwLock::new(HashMap::new())),
expired_animations: Arc::new(RwLock::new(HashMap::new())),
epoch: Epoch(0),
viewport_size: Size2D::new(Au(0), Au(0)),
webrender_api: webrender_api_sender.create_api(),
rw_data: Arc::new(Mutex::new(
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
LayoutThreadData {
constellation_chan: constellation_chan,
display_list: None,
stylist: stylist,
content_box_response: None,
content_boxes_response: Vec::new(),
client_rect_response: Rect::zero(),
hit_test_response: (None, false),
scroll_root_id_response: None,
scroll_area_response: Rect::zero(),
overflow_response: NodeOverflowResponse(None),
resolved_style_response: String::new(),
offset_parent_response: OffsetParentResponse::empty(),
margin_style_response: MarginStyleResponse::empty(),
stacking_context_scroll_offsets: HashMap::new(),
text_index_response: TextIndexResponse(None),
pending_images: vec![],
nodes_from_point_response: vec![],
})),
error_reporter: CSSErrorReporter {
pipelineid: id,
script_chan: Arc::new(Mutex::new(script_chan)),
},
webrender_image_cache:
Arc::new(RwLock::new(HashMap::with_hasher(Default::default()))),
timer:
if PREFS.get("layout.animations.test.enabled")
.as_boolean().unwrap_or(false) {
Timer::test_mode()
} else {
Timer::new()
},
layout_threads: layout_threads,
quirks_mode: None,
servo: Merge #474 - Separate the DOM and layout into separate crates (from pcwalton:separation); r=pcwalton r? @metajack Source-Repo: https://github.com/servo/servo Source-Revision: 473b0941eca8c6498e5065892de49562dce0b78c --HG-- rename : servo/src/components/main/dom/bindings/clientrect.rs => servo/src/components/script/dom/bindings/clientrect.rs rename : servo/src/components/main/dom/bindings/clientrectlist.rs => servo/src/components/script/dom/bindings/clientrectlist.rs rename : servo/src/components/main/dom/bindings/codegen/BindingGen.py => servo/src/components/script/dom/bindings/codegen/BindingGen.py rename : servo/src/components/main/dom/bindings/codegen/BindingUtils.cpp => servo/src/components/script/dom/bindings/codegen/BindingUtils.cpp rename : servo/src/components/main/dom/bindings/codegen/BindingUtils.h => servo/src/components/script/dom/bindings/codegen/BindingUtils.h rename : servo/src/components/main/dom/bindings/codegen/Bindings.conf => servo/src/components/script/dom/bindings/codegen/Bindings.conf rename : servo/src/components/main/dom/bindings/codegen/ClientRect.webidl => servo/src/components/script/dom/bindings/codegen/ClientRect.webidl rename : servo/src/components/main/dom/bindings/codegen/ClientRectList.webidl => servo/src/components/script/dom/bindings/codegen/ClientRectList.webidl rename : servo/src/components/main/dom/bindings/codegen/Codegen.py => servo/src/components/script/dom/bindings/codegen/Codegen.py rename : servo/src/components/main/dom/bindings/codegen/CodegenRust.py => servo/src/components/script/dom/bindings/codegen/CodegenRust.py rename : servo/src/components/main/dom/bindings/codegen/Configuration.py => servo/src/components/script/dom/bindings/codegen/Configuration.py rename : servo/src/components/main/dom/bindings/codegen/DOMJSClass.h => servo/src/components/script/dom/bindings/codegen/DOMJSClass.h rename : servo/src/components/main/dom/bindings/codegen/DOMJSProxyHandler.cpp => servo/src/components/script/dom/bindings/codegen/DOMJSProxyHandler.cpp rename : servo/src/components/main/dom/bindings/codegen/DOMJSProxyHandler.h => servo/src/components/script/dom/bindings/codegen/DOMJSProxyHandler.h rename : servo/src/components/main/dom/bindings/codegen/DOMParser.webidl => servo/src/components/script/dom/bindings/codegen/DOMParser.webidl rename : servo/src/components/main/dom/bindings/codegen/ErrorResult.h => servo/src/components/script/dom/bindings/codegen/ErrorResult.h rename : servo/src/components/main/dom/bindings/codegen/Errors.msg => servo/src/components/script/dom/bindings/codegen/Errors.msg rename : servo/src/components/main/dom/bindings/codegen/Event.webidl => servo/src/components/script/dom/bindings/codegen/Event.webidl rename : servo/src/components/main/dom/bindings/codegen/EventTarget.webidl => servo/src/components/script/dom/bindings/codegen/EventTarget.webidl rename : servo/src/components/main/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py => servo/src/components/script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py rename : servo/src/components/main/dom/bindings/codegen/GlobalGen.py => servo/src/components/script/dom/bindings/codegen/GlobalGen.py rename : servo/src/components/main/dom/bindings/codegen/HTMLCollection.webidl => servo/src/components/script/dom/bindings/codegen/HTMLCollection.webidl rename : servo/src/components/main/dom/bindings/codegen/Makefile.in => servo/src/components/script/dom/bindings/codegen/Makefile.in rename : servo/src/components/main/dom/bindings/codegen/Nullable.h => servo/src/components/script/dom/bindings/codegen/Nullable.h rename : servo/src/components/main/dom/bindings/codegen/PrimitiveConversions.h => servo/src/components/script/dom/bindings/codegen/PrimitiveConversions.h rename : servo/src/components/main/dom/bindings/codegen/RegisterBindings.cpp => servo/src/components/script/dom/bindings/codegen/RegisterBindings.cpp rename : servo/src/components/main/dom/bindings/codegen/RegisterBindings.h => servo/src/components/script/dom/bindings/codegen/RegisterBindings.h rename : servo/src/components/main/dom/bindings/codegen/TypedArray.h => servo/src/components/script/dom/bindings/codegen/TypedArray.h rename : servo/src/components/main/dom/bindings/codegen/crashtests/769464.html => servo/src/components/script/dom/bindings/codegen/crashtests/769464.html rename : servo/src/components/main/dom/bindings/codegen/crashtests/crashtests.list => servo/src/components/script/dom/bindings/codegen/crashtests/crashtests.list rename : servo/src/components/main/dom/bindings/codegen/parser/README => servo/src/components/script/dom/bindings/codegen/parser/README rename : servo/src/components/main/dom/bindings/codegen/parser/UPSTREAM => servo/src/components/script/dom/bindings/codegen/parser/UPSTREAM rename : servo/src/components/main/dom/bindings/codegen/parser/WebIDL.py => servo/src/components/script/dom/bindings/codegen/parser/WebIDL.py rename : servo/src/components/main/dom/bindings/codegen/parser/runtests.py => servo/src/components/script/dom/bindings/codegen/parser/runtests.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_any_null.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_any_null.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_argument_novoid.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_argument_novoid.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_array_of_interface.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_arraybuffer.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_attr.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_attr.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_builtin_filename.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_builtin_filename.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_builtins.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_builtins.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_callback.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_callback.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_callback_interface.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_callback_interface.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_const.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_const.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_constructor.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_constructor.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_deduplicate.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_deduplicate.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_dictionary.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_distinguishability.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_double_null.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_double_null.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_empty_enum.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_empty_enum.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_enum.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_enum.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_error_colno.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_error_colno.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_error_lineno.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_error_lineno.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_extended_attributes.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_extended_attributes.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_forward_decl.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_forward_decl.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_implements.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_implements.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_incomplete_parent.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_parent.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_incomplete_types.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_types.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_interface.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_method.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_method.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_nullable_void.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_void.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_optional_constraints.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_optional_constraints.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_overload.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_overload.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_sanity.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_sanity.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_methods.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_typedef.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_typedef.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_union.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_union.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_union_any.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_union_any.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_union_nullable.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_union_nullable.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_variadic_callback.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_callback.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_variadic_constraints.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_constraints.py rename : servo/src/components/main/dom/bindings/codegen/ply/COPYING => servo/src/components/script/dom/bindings/codegen/ply/COPYING rename : servo/src/components/main/dom/bindings/codegen/ply/README => servo/src/components/script/dom/bindings/codegen/ply/README rename : servo/src/components/main/dom/bindings/codegen/ply/ply/__init__.py => servo/src/components/script/dom/bindings/codegen/ply/ply/__init__.py rename : servo/src/components/main/dom/bindings/codegen/ply/ply/lex.py => servo/src/components/script/dom/bindings/codegen/ply/ply/lex.py rename : servo/src/components/main/dom/bindings/codegen/ply/ply/yacc.py => servo/src/components/script/dom/bindings/codegen/ply/ply/yacc.py rename : servo/src/components/main/dom/bindings/codegen/pythonpath.py => servo/src/components/script/dom/bindings/codegen/pythonpath.py rename : servo/src/components/main/dom/bindings/codegen/stubgenerator/Skeleton.cpp => servo/src/components/script/dom/bindings/codegen/stubgenerator/Skeleton.cpp rename : servo/src/components/main/dom/bindings/codegen/stubgenerator/Skeleton.h => servo/src/components/script/dom/bindings/codegen/stubgenerator/Skeleton.h rename : servo/src/components/main/dom/bindings/codegen/stubgenerator/generate.sh => servo/src/components/script/dom/bindings/codegen/stubgenerator/generate.sh rename : servo/src/components/main/dom/bindings/codegen/test/Makefile.in => servo/src/components/script/dom/bindings/codegen/test/Makefile.in rename : servo/src/components/main/dom/bindings/codegen/test/TestBindingHeader.h => servo/src/components/script/dom/bindings/codegen/test/TestBindingHeader.h rename : servo/src/components/main/dom/bindings/codegen/test/TestCodeGen.webidl => servo/src/components/script/dom/bindings/codegen/test/TestCodeGen.webidl rename : servo/src/components/main/dom/bindings/codegen/test/TestDictionary.webidl => servo/src/components/script/dom/bindings/codegen/test/TestDictionary.webidl rename : servo/src/components/main/dom/bindings/codegen/test/TestTypedef.webidl => servo/src/components/script/dom/bindings/codegen/test/TestTypedef.webidl rename : servo/src/components/main/dom/bindings/codegen/test/file_bug775543.html => servo/src/components/script/dom/bindings/codegen/test/file_bug775543.html rename : servo/src/components/main/dom/bindings/codegen/test/forOf_iframe.html => servo/src/components/script/dom/bindings/codegen/test/forOf_iframe.html rename : servo/src/components/main/dom/bindings/codegen/test/test_InstanceOf.html => servo/src/components/script/dom/bindings/codegen/test/test_InstanceOf.html rename : servo/src/components/main/dom/bindings/codegen/test/test_bug773326.html => servo/src/components/script/dom/bindings/codegen/test/test_bug773326.html rename : servo/src/components/main/dom/bindings/codegen/test/test_bug775543.html => servo/src/components/script/dom/bindings/codegen/test/test_bug775543.html rename : servo/src/components/main/dom/bindings/codegen/test/test_bug788369.html => servo/src/components/script/dom/bindings/codegen/test/test_bug788369.html rename : servo/src/components/main/dom/bindings/codegen/test/test_enums.html => servo/src/components/script/dom/bindings/codegen/test/test_enums.html rename : servo/src/components/main/dom/bindings/codegen/test/test_forOf.html => servo/src/components/script/dom/bindings/codegen/test/test_forOf.html rename : servo/src/components/main/dom/bindings/codegen/test/test_integers.html => servo/src/components/script/dom/bindings/codegen/test/test_integers.html rename : servo/src/components/main/dom/bindings/codegen/test/test_interfaceToString.html => servo/src/components/script/dom/bindings/codegen/test/test_interfaceToString.html rename : servo/src/components/main/dom/bindings/codegen/test/test_lookupGetter.html => servo/src/components/script/dom/bindings/codegen/test/test_lookupGetter.html rename : servo/src/components/main/dom/bindings/codegen/test/test_sequence_wrapping.html => servo/src/components/script/dom/bindings/codegen/test/test_sequence_wrapping.html rename : servo/src/components/main/dom/bindings/codegen/test/test_traceProtos.html => servo/src/components/script/dom/bindings/codegen/test/test_traceProtos.html rename : servo/src/components/main/dom/bindings/conversions.rs => servo/src/components/script/dom/bindings/conversions.rs rename : servo/src/components/main/dom/bindings/document.rs => servo/src/components/script/dom/bindings/document.rs rename : servo/src/components/main/dom/bindings/domparser.rs => servo/src/components/script/dom/bindings/domparser.rs rename : servo/src/components/main/dom/bindings/element.rs => servo/src/components/script/dom/bindings/element.rs rename : servo/src/components/main/dom/bindings/event.rs => servo/src/components/script/dom/bindings/event.rs rename : servo/src/components/main/dom/bindings/eventtarget.rs => servo/src/components/script/dom/bindings/eventtarget.rs rename : servo/src/components/main/dom/bindings/htmlcollection.rs => servo/src/components/script/dom/bindings/htmlcollection.rs rename : servo/src/components/main/dom/bindings/node.rs => servo/src/components/script/dom/bindings/node.rs rename : servo/src/components/main/dom/bindings/proxyhandler.rs => servo/src/components/script/dom/bindings/proxyhandler.rs rename : servo/src/components/main/dom/bindings/text.rs => servo/src/components/script/dom/bindings/text.rs rename : servo/src/components/main/dom/bindings/utils.rs => servo/src/components/script/dom/bindings/utils.rs rename : servo/src/components/main/dom/bindings/window.rs => servo/src/components/script/dom/bindings/window.rs rename : servo/src/components/main/dom/characterdata.rs => servo/src/components/script/dom/characterdata.rs rename : servo/src/components/main/dom/clientrect.rs => servo/src/components/script/dom/clientrect.rs rename : servo/src/components/main/dom/clientrectlist.rs => servo/src/components/script/dom/clientrectlist.rs rename : servo/src/components/main/dom/document.rs => servo/src/components/script/dom/document.rs rename : servo/src/components/main/dom/domparser.rs => servo/src/components/script/dom/domparser.rs rename : servo/src/components/main/dom/element.rs => servo/src/components/script/dom/element.rs rename : servo/src/components/main/dom/event.rs => servo/src/components/script/dom/event.rs rename : servo/src/components/main/dom/eventtarget.rs => servo/src/components/script/dom/eventtarget.rs rename : servo/src/components/main/dom/htmlcollection.rs => servo/src/components/script/dom/htmlcollection.rs rename : servo/src/components/main/dom/node.rs => servo/src/components/script/dom/node.rs rename : servo/src/components/main/dom/window.rs => servo/src/components/script/dom/window.rs rename : servo/src/components/main/html/cssparse.rs => servo/src/components/script/html/cssparse.rs rename : servo/src/components/main/html/hubbub_html_parser.rs => servo/src/components/script/html/hubbub_html_parser.rs rename : servo/src/components/main/scripting/script_task.rs => servo/src/components/script/script_task.rs
2013-05-30 11:06:42 +04:00
}
}
/// Starts listening on the port.
fn start(mut self) {
let rw_data = self.rw_data.clone();
let mut possibly_locked_rw_data = Some(rw_data.lock().unwrap());
let mut rw_data = RwData {
rw_data: &rw_data,
possibly_locked_rw_data: &mut possibly_locked_rw_data,
};
while self.handle_request(&mut rw_data) {
servo: Merge #474 - Separate the DOM and layout into separate crates (from pcwalton:separation); r=pcwalton r? @metajack Source-Repo: https://github.com/servo/servo Source-Revision: 473b0941eca8c6498e5065892de49562dce0b78c --HG-- rename : servo/src/components/main/dom/bindings/clientrect.rs => servo/src/components/script/dom/bindings/clientrect.rs rename : servo/src/components/main/dom/bindings/clientrectlist.rs => servo/src/components/script/dom/bindings/clientrectlist.rs rename : servo/src/components/main/dom/bindings/codegen/BindingGen.py => servo/src/components/script/dom/bindings/codegen/BindingGen.py rename : servo/src/components/main/dom/bindings/codegen/BindingUtils.cpp => servo/src/components/script/dom/bindings/codegen/BindingUtils.cpp rename : servo/src/components/main/dom/bindings/codegen/BindingUtils.h => servo/src/components/script/dom/bindings/codegen/BindingUtils.h rename : servo/src/components/main/dom/bindings/codegen/Bindings.conf => servo/src/components/script/dom/bindings/codegen/Bindings.conf rename : servo/src/components/main/dom/bindings/codegen/ClientRect.webidl => servo/src/components/script/dom/bindings/codegen/ClientRect.webidl rename : servo/src/components/main/dom/bindings/codegen/ClientRectList.webidl => servo/src/components/script/dom/bindings/codegen/ClientRectList.webidl rename : servo/src/components/main/dom/bindings/codegen/Codegen.py => servo/src/components/script/dom/bindings/codegen/Codegen.py rename : servo/src/components/main/dom/bindings/codegen/CodegenRust.py => servo/src/components/script/dom/bindings/codegen/CodegenRust.py rename : servo/src/components/main/dom/bindings/codegen/Configuration.py => servo/src/components/script/dom/bindings/codegen/Configuration.py rename : servo/src/components/main/dom/bindings/codegen/DOMJSClass.h => servo/src/components/script/dom/bindings/codegen/DOMJSClass.h rename : servo/src/components/main/dom/bindings/codegen/DOMJSProxyHandler.cpp => servo/src/components/script/dom/bindings/codegen/DOMJSProxyHandler.cpp rename : servo/src/components/main/dom/bindings/codegen/DOMJSProxyHandler.h => servo/src/components/script/dom/bindings/codegen/DOMJSProxyHandler.h rename : servo/src/components/main/dom/bindings/codegen/DOMParser.webidl => servo/src/components/script/dom/bindings/codegen/DOMParser.webidl rename : servo/src/components/main/dom/bindings/codegen/ErrorResult.h => servo/src/components/script/dom/bindings/codegen/ErrorResult.h rename : servo/src/components/main/dom/bindings/codegen/Errors.msg => servo/src/components/script/dom/bindings/codegen/Errors.msg rename : servo/src/components/main/dom/bindings/codegen/Event.webidl => servo/src/components/script/dom/bindings/codegen/Event.webidl rename : servo/src/components/main/dom/bindings/codegen/EventTarget.webidl => servo/src/components/script/dom/bindings/codegen/EventTarget.webidl rename : servo/src/components/main/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py => servo/src/components/script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py rename : servo/src/components/main/dom/bindings/codegen/GlobalGen.py => servo/src/components/script/dom/bindings/codegen/GlobalGen.py rename : servo/src/components/main/dom/bindings/codegen/HTMLCollection.webidl => servo/src/components/script/dom/bindings/codegen/HTMLCollection.webidl rename : servo/src/components/main/dom/bindings/codegen/Makefile.in => servo/src/components/script/dom/bindings/codegen/Makefile.in rename : servo/src/components/main/dom/bindings/codegen/Nullable.h => servo/src/components/script/dom/bindings/codegen/Nullable.h rename : servo/src/components/main/dom/bindings/codegen/PrimitiveConversions.h => servo/src/components/script/dom/bindings/codegen/PrimitiveConversions.h rename : servo/src/components/main/dom/bindings/codegen/RegisterBindings.cpp => servo/src/components/script/dom/bindings/codegen/RegisterBindings.cpp rename : servo/src/components/main/dom/bindings/codegen/RegisterBindings.h => servo/src/components/script/dom/bindings/codegen/RegisterBindings.h rename : servo/src/components/main/dom/bindings/codegen/TypedArray.h => servo/src/components/script/dom/bindings/codegen/TypedArray.h rename : servo/src/components/main/dom/bindings/codegen/crashtests/769464.html => servo/src/components/script/dom/bindings/codegen/crashtests/769464.html rename : servo/src/components/main/dom/bindings/codegen/crashtests/crashtests.list => servo/src/components/script/dom/bindings/codegen/crashtests/crashtests.list rename : servo/src/components/main/dom/bindings/codegen/parser/README => servo/src/components/script/dom/bindings/codegen/parser/README rename : servo/src/components/main/dom/bindings/codegen/parser/UPSTREAM => servo/src/components/script/dom/bindings/codegen/parser/UPSTREAM rename : servo/src/components/main/dom/bindings/codegen/parser/WebIDL.py => servo/src/components/script/dom/bindings/codegen/parser/WebIDL.py rename : servo/src/components/main/dom/bindings/codegen/parser/runtests.py => servo/src/components/script/dom/bindings/codegen/parser/runtests.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_any_null.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_any_null.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_argument_novoid.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_argument_novoid.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_array_of_interface.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_arraybuffer.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_attr.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_attr.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_builtin_filename.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_builtin_filename.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_builtins.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_builtins.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_callback.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_callback.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_callback_interface.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_callback_interface.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_const.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_const.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_constructor.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_constructor.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_deduplicate.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_deduplicate.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_dictionary.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_distinguishability.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_double_null.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_double_null.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_empty_enum.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_empty_enum.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_enum.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_enum.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_error_colno.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_error_colno.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_error_lineno.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_error_lineno.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_extended_attributes.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_extended_attributes.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_forward_decl.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_forward_decl.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_implements.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_implements.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_incomplete_parent.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_parent.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_incomplete_types.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_types.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_interface.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_method.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_method.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_nullable_void.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_void.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_optional_constraints.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_optional_constraints.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_overload.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_overload.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_sanity.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_sanity.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_methods.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_typedef.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_typedef.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_union.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_union.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_union_any.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_union_any.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_union_nullable.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_union_nullable.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_variadic_callback.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_callback.py rename : servo/src/components/main/dom/bindings/codegen/parser/tests/test_variadic_constraints.py => servo/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_constraints.py rename : servo/src/components/main/dom/bindings/codegen/ply/COPYING => servo/src/components/script/dom/bindings/codegen/ply/COPYING rename : servo/src/components/main/dom/bindings/codegen/ply/README => servo/src/components/script/dom/bindings/codegen/ply/README rename : servo/src/components/main/dom/bindings/codegen/ply/ply/__init__.py => servo/src/components/script/dom/bindings/codegen/ply/ply/__init__.py rename : servo/src/components/main/dom/bindings/codegen/ply/ply/lex.py => servo/src/components/script/dom/bindings/codegen/ply/ply/lex.py rename : servo/src/components/main/dom/bindings/codegen/ply/ply/yacc.py => servo/src/components/script/dom/bindings/codegen/ply/ply/yacc.py rename : servo/src/components/main/dom/bindings/codegen/pythonpath.py => servo/src/components/script/dom/bindings/codegen/pythonpath.py rename : servo/src/components/main/dom/bindings/codegen/stubgenerator/Skeleton.cpp => servo/src/components/script/dom/bindings/codegen/stubgenerator/Skeleton.cpp rename : servo/src/components/main/dom/bindings/codegen/stubgenerator/Skeleton.h => servo/src/components/script/dom/bindings/codegen/stubgenerator/Skeleton.h rename : servo/src/components/main/dom/bindings/codegen/stubgenerator/generate.sh => servo/src/components/script/dom/bindings/codegen/stubgenerator/generate.sh rename : servo/src/components/main/dom/bindings/codegen/test/Makefile.in => servo/src/components/script/dom/bindings/codegen/test/Makefile.in rename : servo/src/components/main/dom/bindings/codegen/test/TestBindingHeader.h => servo/src/components/script/dom/bindings/codegen/test/TestBindingHeader.h rename : servo/src/components/main/dom/bindings/codegen/test/TestCodeGen.webidl => servo/src/components/script/dom/bindings/codegen/test/TestCodeGen.webidl rename : servo/src/components/main/dom/bindings/codegen/test/TestDictionary.webidl => servo/src/components/script/dom/bindings/codegen/test/TestDictionary.webidl rename : servo/src/components/main/dom/bindings/codegen/test/TestTypedef.webidl => servo/src/components/script/dom/bindings/codegen/test/TestTypedef.webidl rename : servo/src/components/main/dom/bindings/codegen/test/file_bug775543.html => servo/src/components/script/dom/bindings/codegen/test/file_bug775543.html rename : servo/src/components/main/dom/bindings/codegen/test/forOf_iframe.html => servo/src/components/script/dom/bindings/codegen/test/forOf_iframe.html rename : servo/src/components/main/dom/bindings/codegen/test/test_InstanceOf.html => servo/src/components/script/dom/bindings/codegen/test/test_InstanceOf.html rename : servo/src/components/main/dom/bindings/codegen/test/test_bug773326.html => servo/src/components/script/dom/bindings/codegen/test/test_bug773326.html rename : servo/src/components/main/dom/bindings/codegen/test/test_bug775543.html => servo/src/components/script/dom/bindings/codegen/test/test_bug775543.html rename : servo/src/components/main/dom/bindings/codegen/test/test_bug788369.html => servo/src/components/script/dom/bindings/codegen/test/test_bug788369.html rename : servo/src/components/main/dom/bindings/codegen/test/test_enums.html => servo/src/components/script/dom/bindings/codegen/test/test_enums.html rename : servo/src/components/main/dom/bindings/codegen/test/test_forOf.html => servo/src/components/script/dom/bindings/codegen/test/test_forOf.html rename : servo/src/components/main/dom/bindings/codegen/test/test_integers.html => servo/src/components/script/dom/bindings/codegen/test/test_integers.html rename : servo/src/components/main/dom/bindings/codegen/test/test_interfaceToString.html => servo/src/components/script/dom/bindings/codegen/test/test_interfaceToString.html rename : servo/src/components/main/dom/bindings/codegen/test/test_lookupGetter.html => servo/src/components/script/dom/bindings/codegen/test/test_lookupGetter.html rename : servo/src/components/main/dom/bindings/codegen/test/test_sequence_wrapping.html => servo/src/components/script/dom/bindings/codegen/test/test_sequence_wrapping.html rename : servo/src/components/main/dom/bindings/codegen/test/test_traceProtos.html => servo/src/components/script/dom/bindings/codegen/test/test_traceProtos.html rename : servo/src/components/main/dom/bindings/conversions.rs => servo/src/components/script/dom/bindings/conversions.rs rename : servo/src/components/main/dom/bindings/document.rs => servo/src/components/script/dom/bindings/document.rs rename : servo/src/components/main/dom/bindings/domparser.rs => servo/src/components/script/dom/bindings/domparser.rs rename : servo/src/components/main/dom/bindings/element.rs => servo/src/components/script/dom/bindings/element.rs rename : servo/src/components/main/dom/bindings/event.rs => servo/src/components/script/dom/bindings/event.rs rename : servo/src/components/main/dom/bindings/eventtarget.rs => servo/src/components/script/dom/bindings/eventtarget.rs rename : servo/src/components/main/dom/bindings/htmlcollection.rs => servo/src/components/script/dom/bindings/htmlcollection.rs rename : servo/src/components/main/dom/bindings/node.rs => servo/src/components/script/dom/bindings/node.rs rename : servo/src/components/main/dom/bindings/proxyhandler.rs => servo/src/components/script/dom/bindings/proxyhandler.rs rename : servo/src/components/main/dom/bindings/text.rs => servo/src/components/script/dom/bindings/text.rs rename : servo/src/components/main/dom/bindings/utils.rs => servo/src/components/script/dom/bindings/utils.rs rename : servo/src/components/main/dom/bindings/window.rs => servo/src/components/script/dom/bindings/window.rs rename : servo/src/components/main/dom/characterdata.rs => servo/src/components/script/dom/characterdata.rs rename : servo/src/components/main/dom/clientrect.rs => servo/src/components/script/dom/clientrect.rs rename : servo/src/components/main/dom/clientrectlist.rs => servo/src/components/script/dom/clientrectlist.rs rename : servo/src/components/main/dom/document.rs => servo/src/components/script/dom/document.rs rename : servo/src/components/main/dom/domparser.rs => servo/src/components/script/dom/domparser.rs rename : servo/src/components/main/dom/element.rs => servo/src/components/script/dom/element.rs rename : servo/src/components/main/dom/event.rs => servo/src/components/script/dom/event.rs rename : servo/src/components/main/dom/eventtarget.rs => servo/src/components/script/dom/eventtarget.rs rename : servo/src/components/main/dom/htmlcollection.rs => servo/src/components/script/dom/htmlcollection.rs rename : servo/src/components/main/dom/node.rs => servo/src/components/script/dom/node.rs rename : servo/src/components/main/dom/window.rs => servo/src/components/script/dom/window.rs rename : servo/src/components/main/html/cssparse.rs => servo/src/components/script/html/cssparse.rs rename : servo/src/components/main/html/hubbub_html_parser.rs => servo/src/components/script/html/hubbub_html_parser.rs rename : servo/src/components/main/scripting/script_task.rs => servo/src/components/script/script_task.rs
2013-05-30 11:06:42 +04:00
// Loop indefinitely.
}
}
// Create a layout context for use in building display lists, hit testing, &c.
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
fn build_layout_context<'a>(&self,
guards: StylesheetGuards<'a>,
rw_data: &LayoutThreadData,
request_images: bool)
-> LayoutContext<'a> {
let thread_local_style_context_creation_data =
ThreadLocalStyleContextCreationInfo::new(self.new_animations_sender.clone());
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
LayoutContext {
style_context: SharedStyleContext {
stylist: rw_data.stylist.clone(),
options: StyleSystemOptions::default(),
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
guards: guards,
running_animations: self.running_animations.clone(),
expired_animations: self.expired_animations.clone(),
error_reporter: Box::new(self.error_reporter.clone()),
local_context_creation_data: Mutex::new(thread_local_style_context_creation_data),
timer: self.timer.clone(),
quirks_mode: self.quirks_mode.unwrap(),
traversal_flags: TraversalFlags::empty(),
},
image_cache: self.image_cache.clone(),
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
font_cache_thread: Mutex::new(self.font_cache_thread.clone()),
webrender_image_cache: self.webrender_image_cache.clone(),
pending_images: if request_images { Some(Mutex::new(vec![])) } else { None },
}
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// Receives and dispatches messages from the script and constellation threads
fn handle_request<'a, 'b>(&mut self, possibly_locked_rw_data: &mut RwData<'a, 'b>) -> bool {
enum Request {
FromPipeline(LayoutControlMsg),
FromScript(Msg),
FromFontCache,
}
let request = {
let port_from_script = &self.port;
let port_from_pipeline = &self.pipeline_port;
let port_from_font_cache = &self.font_cache_receiver;
select! {
msg = port_from_pipeline.recv() => {
Request::FromPipeline(msg.unwrap())
},
msg = port_from_script.recv() => {
Request::FromScript(msg.unwrap())
},
msg = port_from_font_cache.recv() => {
msg.unwrap();
Request::FromFontCache
}
}
};
match request {
Request::FromPipeline(LayoutControlMsg::SetStackingContextScrollStates(
new_scroll_states)) => {
self.handle_request_helper(Msg::SetStackingContextScrollStates(new_scroll_states),
possibly_locked_rw_data)
},
Request::FromPipeline(LayoutControlMsg::TickAnimations) => {
self.handle_request_helper(Msg::TickAnimations, possibly_locked_rw_data)
},
Request::FromPipeline(LayoutControlMsg::GetCurrentEpoch(sender)) => {
self.handle_request_helper(Msg::GetCurrentEpoch(sender), possibly_locked_rw_data)
},
Request::FromPipeline(LayoutControlMsg::GetWebFontLoadState(sender)) => {
self.handle_request_helper(Msg::GetWebFontLoadState(sender),
possibly_locked_rw_data)
},
Request::FromPipeline(LayoutControlMsg::ExitNow) => {
self.handle_request_helper(Msg::ExitNow, possibly_locked_rw_data)
},
Request::FromScript(msg) => {
self.handle_request_helper(msg, possibly_locked_rw_data)
},
Request::FromFontCache => {
let _rw_data = possibly_locked_rw_data.lock();
self.outstanding_web_fonts.fetch_sub(1, Ordering::SeqCst);
font_context::invalidate_font_caches();
self.script_chan.send(ConstellationControlMsg::WebFontLoaded(self.id)).unwrap();
true
},
}
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// Receives and dispatches messages from other threads.
fn handle_request_helper<'a, 'b>(&mut self,
request: Msg,
possibly_locked_rw_data: &mut RwData<'a, 'b>)
-> bool {
match request {
servo: Merge #8039 - Move Stylesheet loading and ownership from the layout task into HTML elements (from tschneidereit:script-owns-stylesheets); r=jdm Stylesheets for `HTMLLinkElement`s are now loaded by the resource task, triggered by the element in question. Stylesheets are owned by the elements they're associated with, which can be `HTMLStyleElement`, `HTMLLinkElement`, and `HTMLMetaElement` (for `<meta name="viewport">). Additionally, the quirks mode stylesheet (just as the user and user agent stylesheets a couple of commits ago), is implemented as a lazy static, loaded once per process and shared between all documents. This all has various nice consequences: - Stylesheet loading becomes a non-blocking operation. - Stylesheets are removed when the element they're associated with is removed from the document. - It'll be possible to implement the CSSOM APIs that require direct access to the stylesheets (i.e., ~ all of them). - Various subtle correctness issues are fixed. One piece of interesting follow-up work would be to move parsing of external stylesheets to the resource task, too. Right now, it happens in the link element once loading is complete, so blocks the script task. Moving it to the resource task would probably be fairly straight-forward as it doesn't require access to any external state. Depends on #7979 because without that loading stylesheets asynchronously breaks lots of content. Source-Repo: https://github.com/servo/servo Source-Revision: 7ff3a17524e0e703e3ac279441729c185444be24
2015-11-07 22:41:54 +03:00
Msg::AddStylesheet(style_info) => {
self.handle_add_stylesheet(style_info, possibly_locked_rw_data)
}
Msg::SetQuirksMode => self.handle_set_quirks_mode(possibly_locked_rw_data),
Msg::GetRPC(response_chan) => {
response_chan.send(box LayoutRPCImpl(self.rw_data.clone()) as
Box<LayoutRPC + Send>).unwrap();
},
Msg::Reflow(data) => {
servo: Merge #5348 - Rename lots of profiling-related things (from nnethercote:profiler-renaming); r=jdm ``` ------------------------------------------------------------------------ BEFORE AFTER ------------------------------------------------------------------------ util::memory util::mem - heap_size_of - heap_size_of (unchanged) - SizeOf - HeapSizeOf - size_of_excluding_self - heap_size_of_children prof::mem prof::mem - MemoryProfilerChan - ProfilerChan - MemoryReport - Report - MemoryReportsChan - ReportsChan - MemoryReporter - Reporter - MemoryProfilerMsg - ProfilerMsg - {R,UnR}egisterMemoryReporter - {R,UnR}egisterReporter - MemoryProfiler - Prof - ReportsForest - ReportsForest (unchanged) - ReportsTree - ReportsTree (unchanged) - SystemMemoryReporter - SystemReporter prof::time prof::time - TimeProfilerChan - ProfilerChan - TimerMetadata - TimerMetadata (unchanged) - Formatable - Formattable [spelling!] - TimeProfilerMsg - ProfilerMsg - TimeProfilerCategory - ProfilerCategory - TimeProfilerBuckets - ProfilerBuckets - TimeProfiler - Profiler - TimerMetadataFrameType - TimerMetadataFrameType (unchanged) - TimerMetadataReflowType - TimerMetadataReflowType (unchanged) - ProfilerMetadata - ProfilerMetadata (unchanged) ``` In a few places both prof::time and prof::mem are used, and so module-qualification is needed to avoid overlap, e.g. time::Profiler and mem::Profiler. Likewise with std::mem and prof::mem. This is not a big deal. Source-Repo: https://github.com/servo/servo Source-Revision: d784d9c488be4533a3590a154addd366d15a5864
2015-03-26 06:18:48 +03:00
profile(time::ProfilerCategory::LayoutPerform,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
|| self.handle_reflow(&data, possibly_locked_rw_data));
},
Msg::TickAnimations => self.tick_all_animations(possibly_locked_rw_data),
Msg::SetStackingContextScrollStates(new_scroll_states) => {
self.set_stacking_context_scroll_states(new_scroll_states,
possibly_locked_rw_data);
}
Msg::ReapStyleAndLayoutData(dead_data) => {
unsafe {
drop_style_and_layout_data(dead_data)
}
}
servo: Merge #5348 - Rename lots of profiling-related things (from nnethercote:profiler-renaming); r=jdm ``` ------------------------------------------------------------------------ BEFORE AFTER ------------------------------------------------------------------------ util::memory util::mem - heap_size_of - heap_size_of (unchanged) - SizeOf - HeapSizeOf - size_of_excluding_self - heap_size_of_children prof::mem prof::mem - MemoryProfilerChan - ProfilerChan - MemoryReport - Report - MemoryReportsChan - ReportsChan - MemoryReporter - Reporter - MemoryProfilerMsg - ProfilerMsg - {R,UnR}egisterMemoryReporter - {R,UnR}egisterReporter - MemoryProfiler - Prof - ReportsForest - ReportsForest (unchanged) - ReportsTree - ReportsTree (unchanged) - SystemMemoryReporter - SystemReporter prof::time prof::time - TimeProfilerChan - ProfilerChan - TimerMetadata - TimerMetadata (unchanged) - Formatable - Formattable [spelling!] - TimeProfilerMsg - ProfilerMsg - TimeProfilerCategory - ProfilerCategory - TimeProfilerBuckets - ProfilerBuckets - TimeProfiler - Profiler - TimerMetadataFrameType - TimerMetadataFrameType (unchanged) - TimerMetadataReflowType - TimerMetadataReflowType (unchanged) - ProfilerMetadata - ProfilerMetadata (unchanged) ``` In a few places both prof::time and prof::mem are used, and so module-qualification is needed to avoid overlap, e.g. time::Profiler and mem::Profiler. Likewise with std::mem and prof::mem. This is not a big deal. Source-Repo: https://github.com/servo/servo Source-Revision: d784d9c488be4533a3590a154addd366d15a5864
2015-03-26 06:18:48 +03:00
Msg::CollectReports(reports_chan) => {
self.collect_reports(reports_chan, possibly_locked_rw_data);
},
Msg::GetCurrentEpoch(sender) => {
let _rw_data = possibly_locked_rw_data.lock();
sender.send(self.epoch).unwrap();
},
servo: Merge #12751 - compositor: Send animation ticks to layout even if there are script animation frames (from emilio:transitions-raf); r=pcwalton <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12749 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> The script tick ends up only processing JS callbacks related to animation frames, so CSS transitions/animations end up not working as expected. This could have accidentally worked before #12563 because we over-restyled, but now this is no longer the case. Other possible way to do it is making a layout reflow with RAF handle CSS animations/transitions too, but that may not work if the reflow ends up being suppressed (that could very well be the case), and we'd need to handle a lot more state in the document, so this solution (assuming it doesn't break try) seems a bit less flacky. Missing a test, will add one soon. Fixes #12749. Source-Repo: https://github.com/servo/servo Source-Revision: 0b9832119e9d42bc3ba4d8e4a4e573a03705de3e
2016-08-08 06:52:32 +03:00
Msg::AdvanceClockMs(how_many, do_tick) => {
self.handle_advance_clock_ms(how_many, possibly_locked_rw_data, do_tick);
}
Msg::GetWebFontLoadState(sender) => {
let _rw_data = possibly_locked_rw_data.lock();
let outstanding_web_fonts = self.outstanding_web_fonts.load(Ordering::SeqCst);
sender.send(outstanding_web_fonts != 0).unwrap();
},
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
Msg::CreateLayoutThread(info) => {
self.create_layout_thread(info)
}
Msg::SetFinalUrl(final_url) => {
self.url = final_url;
},
Msg::PrepareToExit(response_chan) => {
self.prepare_to_exit(response_chan);
return false
},
Msg::ExitNow => {
debug!("layout: ExitNow received");
self.exit_now();
return false
}
}
true
}
fn collect_reports<'a, 'b>(&self,
reports_chan: ReportsChan,
possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let mut reports = vec![];
// FIXME(njn): Just measuring the display tree for now.
let rw_data = possibly_locked_rw_data.lock();
let display_list = rw_data.display_list.as_ref();
let formatted_url = &format!("url({})", self.url);
servo: Merge #5348 - Rename lots of profiling-related things (from nnethercote:profiler-renaming); r=jdm ``` ------------------------------------------------------------------------ BEFORE AFTER ------------------------------------------------------------------------ util::memory util::mem - heap_size_of - heap_size_of (unchanged) - SizeOf - HeapSizeOf - size_of_excluding_self - heap_size_of_children prof::mem prof::mem - MemoryProfilerChan - ProfilerChan - MemoryReport - Report - MemoryReportsChan - ReportsChan - MemoryReporter - Reporter - MemoryProfilerMsg - ProfilerMsg - {R,UnR}egisterMemoryReporter - {R,UnR}egisterReporter - MemoryProfiler - Prof - ReportsForest - ReportsForest (unchanged) - ReportsTree - ReportsTree (unchanged) - SystemMemoryReporter - SystemReporter prof::time prof::time - TimeProfilerChan - ProfilerChan - TimerMetadata - TimerMetadata (unchanged) - Formatable - Formattable [spelling!] - TimeProfilerMsg - ProfilerMsg - TimeProfilerCategory - ProfilerCategory - TimeProfilerBuckets - ProfilerBuckets - TimeProfiler - Profiler - TimerMetadataFrameType - TimerMetadataFrameType (unchanged) - TimerMetadataReflowType - TimerMetadataReflowType (unchanged) - ProfilerMetadata - ProfilerMetadata (unchanged) ``` In a few places both prof::time and prof::mem are used, and so module-qualification is needed to avoid overlap, e.g. time::Profiler and mem::Profiler. Likewise with std::mem and prof::mem. This is not a big deal. Source-Repo: https://github.com/servo/servo Source-Revision: d784d9c488be4533a3590a154addd366d15a5864
2015-03-26 06:18:48 +03:00
reports.push(Report {
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
path: path![formatted_url, "layout-thread", "display-list"],
servo: Merge #6802 - Add a `kind` field to memory reports (from nnethercote:report-kind); r=jdm This is used for two memory reporting improvements. - It's used to distinguish "explicit" memory reports from others. This mirrors the same categorization that is used in Firefox, and gives a single tree that's the best place to look. It replaces the "pages" tree which was always intended to be a temporary stand-in for "explicit". - It's used to computed "heap-unclassified" values for both the jemalloc and system heaps, both of which are placed into the "explicit" tree. Example output: ``` | 114.99 MiB -- explicit | 52.34 MiB -- jemalloc-heap-unclassified | 46.14 MiB -- system-heap-unclassified | 14.95 MiB -- url(file:///home/njn/moz/servo2/../servo-static-suite/wikipe dia/Guardians%20of%20the%20Galaxy%20(film)%20-%20Wikipedia,%20the%20free%20encyc lopedia.html) | 7.32 MiB -- js | 3.07 MiB -- malloc-heap | 3.00 MiB -- gc-heap | 2.49 MiB -- used | 0.34 MiB -- decommitted | 0.09 MiB -- unused | 0.09 MiB -- admin | 1.25 MiB -- non-heap | 1.36 MiB -- layout-worker-3-local-context | 1.34 MiB -- layout-worker-0-local-context | 1.24 MiB -- layout-worker-1-local-context | 1.24 MiB -- layout-worker-4-local-context | 1.16 MiB -- layout-worker-2-local-context | 0.89 MiB -- layout-worker-5-local-context | 0.38 MiB -- layout-task | 0.31 MiB -- display-list | 0.07 MiB -- local-context | 1.56 MiB -- compositor-task | 0.78 MiB -- surface-map | 0.78 MiB -- layer-tree ``` The heap-unclassified values dominate the "explicit" tree because reporter coverage is still quite poor. Source-Repo: https://github.com/servo/servo Source-Revision: bff5e325a89ab6621a049ac55c1da66e901c776c
2015-07-30 04:42:00 +03:00
kind: ReportKind::ExplicitJemallocHeapSize,
size: display_list.map_or(0, |sc| sc.heap_size_of_children()),
});
let stylist = rw_data.stylist.as_ref();
reports.push(Report {
path: path![formatted_url, "layout-thread", "stylist"],
kind: ReportKind::ExplicitJemallocHeapSize,
size: stylist.heap_size_of_children(),
});
// The LayoutThread has data in Persistent TLS...
reports.push(Report {
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
path: path![formatted_url, "layout-thread", "local-context"],
servo: Merge #6802 - Add a `kind` field to memory reports (from nnethercote:report-kind); r=jdm This is used for two memory reporting improvements. - It's used to distinguish "explicit" memory reports from others. This mirrors the same categorization that is used in Firefox, and gives a single tree that's the best place to look. It replaces the "pages" tree which was always intended to be a temporary stand-in for "explicit". - It's used to computed "heap-unclassified" values for both the jemalloc and system heaps, both of which are placed into the "explicit" tree. Example output: ``` | 114.99 MiB -- explicit | 52.34 MiB -- jemalloc-heap-unclassified | 46.14 MiB -- system-heap-unclassified | 14.95 MiB -- url(file:///home/njn/moz/servo2/../servo-static-suite/wikipe dia/Guardians%20of%20the%20Galaxy%20(film)%20-%20Wikipedia,%20the%20free%20encyc lopedia.html) | 7.32 MiB -- js | 3.07 MiB -- malloc-heap | 3.00 MiB -- gc-heap | 2.49 MiB -- used | 0.34 MiB -- decommitted | 0.09 MiB -- unused | 0.09 MiB -- admin | 1.25 MiB -- non-heap | 1.36 MiB -- layout-worker-3-local-context | 1.34 MiB -- layout-worker-0-local-context | 1.24 MiB -- layout-worker-1-local-context | 1.24 MiB -- layout-worker-4-local-context | 1.16 MiB -- layout-worker-2-local-context | 0.89 MiB -- layout-worker-5-local-context | 0.38 MiB -- layout-task | 0.31 MiB -- display-list | 0.07 MiB -- local-context | 1.56 MiB -- compositor-task | 0.78 MiB -- surface-map | 0.78 MiB -- layer-tree ``` The heap-unclassified values dominate the "explicit" tree because reporter coverage is still quite poor. Source-Repo: https://github.com/servo/servo Source-Revision: bff5e325a89ab6621a049ac55c1da66e901c776c
2015-07-30 04:42:00 +03:00
kind: ReportKind::ExplicitJemallocHeapSize,
size: heap_size_of_persistent_local_context(),
});
reports_chan.send(reports);
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
fn create_layout_thread(&self, info: NewLayoutThreadInfo) {
LayoutThread::create(info.id,
FrameId::installed(),
info.url.clone(),
info.is_parent,
info.layout_pair,
info.pipeline_port,
info.constellation_chan,
info.script_chan.clone(),
info.image_cache.clone(),
self.font_cache_thread.clone(),
self.time_profiler_chan.clone(),
self.mem_profiler_chan.clone(),
info.content_process_shutdown_chan,
self.webrender_api.clone_sender(),
info.layout_threads);
}
/// Enters a quiescent state in which no new messages will be processed until an `ExitNow` is
/// received. A pong is immediately sent on the given response channel.
fn prepare_to_exit(&mut self, response_chan: Sender<()>) {
response_chan.send(()).unwrap();
loop {
match self.port.recv().unwrap() {
Msg::ReapStyleAndLayoutData(dead_data) => {
unsafe {
drop_style_and_layout_data(dead_data)
}
}
Msg::ExitNow => {
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
debug!("layout thread is exiting...");
self.exit_now();
break
}
Msg::CollectReports(_) => {
// Just ignore these messages at this point.
}
_ => {
panic!("layout: unexpected message received after `PrepareToExitMsg`")
}
}
}
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// Shuts down the layout thread now. If there are any DOM nodes left, layout will now (safely)
/// crash.
fn exit_now(&mut self) {
// Drop the rayon threadpool if present.
let _ = self.parallel_traversal.take();
}
fn handle_add_stylesheet<'a, 'b>(&self,
stylesheet: Arc<Stylesheet>,
possibly_locked_rw_data: &mut RwData<'a, 'b>) {
// Find all font-face rules and notify the font cache of them.
servo: Merge #8039 - Move Stylesheet loading and ownership from the layout task into HTML elements (from tschneidereit:script-owns-stylesheets); r=jdm Stylesheets for `HTMLLinkElement`s are now loaded by the resource task, triggered by the element in question. Stylesheets are owned by the elements they're associated with, which can be `HTMLStyleElement`, `HTMLLinkElement`, and `HTMLMetaElement` (for `<meta name="viewport">). Additionally, the quirks mode stylesheet (just as the user and user agent stylesheets a couple of commits ago), is implemented as a lazy static, loaded once per process and shared between all documents. This all has various nice consequences: - Stylesheet loading becomes a non-blocking operation. - Stylesheets are removed when the element they're associated with is removed from the document. - It'll be possible to implement the CSSOM APIs that require direct access to the stylesheets (i.e., ~ all of them). - Various subtle correctness issues are fixed. One piece of interesting follow-up work would be to move parsing of external stylesheets to the resource task, too. Right now, it happens in the link element once loading is complete, so blocks the script task. Moving it to the resource task would probably be fairly straight-forward as it doesn't require access to any external state. Depends on #7979 because without that loading stylesheets asynchronously breaks lots of content. Source-Repo: https://github.com/servo/servo Source-Revision: 7ff3a17524e0e703e3ac279441729c185444be24
2015-11-07 22:41:54 +03:00
// GWTODO: Need to handle unloading web fonts.
let rw_data = possibly_locked_rw_data.lock();
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
let guard = stylesheet.shared_lock.read();
if stylesheet.is_effective_for_device(&rw_data.stylist.device, &guard) {
servo: Merge #8039 - Move Stylesheet loading and ownership from the layout task into HTML elements (from tschneidereit:script-owns-stylesheets); r=jdm Stylesheets for `HTMLLinkElement`s are now loaded by the resource task, triggered by the element in question. Stylesheets are owned by the elements they're associated with, which can be `HTMLStyleElement`, `HTMLLinkElement`, and `HTMLMetaElement` (for `<meta name="viewport">). Additionally, the quirks mode stylesheet (just as the user and user agent stylesheets a couple of commits ago), is implemented as a lazy static, loaded once per process and shared between all documents. This all has various nice consequences: - Stylesheet loading becomes a non-blocking operation. - Stylesheets are removed when the element they're associated with is removed from the document. - It'll be possible to implement the CSSOM APIs that require direct access to the stylesheets (i.e., ~ all of them). - Various subtle correctness issues are fixed. One piece of interesting follow-up work would be to move parsing of external stylesheets to the resource task, too. Right now, it happens in the link element once loading is complete, so blocks the script task. Moving it to the resource task would probably be fairly straight-forward as it doesn't require access to any external state. Depends on #7979 because without that loading stylesheets asynchronously breaks lots of content. Source-Repo: https://github.com/servo/servo Source-Revision: 7ff3a17524e0e703e3ac279441729c185444be24
2015-11-07 22:41:54 +03:00
add_font_face_rules(&*stylesheet,
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
&guard,
&rw_data.stylist.device,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
&self.font_cache_thread,
&self.font_cache_sender,
&self.outstanding_web_fonts);
}
possibly_locked_rw_data.block(rw_data);
}
/// Advances the animation clock of the document.
fn handle_advance_clock_ms<'a, 'b>(&mut self,
how_many_ms: i32,
servo: Merge #12751 - compositor: Send animation ticks to layout even if there are script animation frames (from emilio:transitions-raf); r=pcwalton <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12749 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> The script tick ends up only processing JS callbacks related to animation frames, so CSS transitions/animations end up not working as expected. This could have accidentally worked before #12563 because we over-restyled, but now this is no longer the case. Other possible way to do it is making a layout reflow with RAF handle CSS animations/transitions too, but that may not work if the reflow ends up being suppressed (that could very well be the case), and we'd need to handle a lot more state in the document, so this solution (assuming it doesn't break try) seems a bit less flacky. Missing a test, will add one soon. Fixes #12749. Source-Repo: https://github.com/servo/servo Source-Revision: 0b9832119e9d42bc3ba4d8e4a4e573a03705de3e
2016-08-08 06:52:32 +03:00
possibly_locked_rw_data: &mut RwData<'a, 'b>,
tick_animations: bool) {
self.timer.increment(how_many_ms as f64 / 1000.0);
servo: Merge #12751 - compositor: Send animation ticks to layout even if there are script animation frames (from emilio:transitions-raf); r=pcwalton <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12749 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> The script tick ends up only processing JS callbacks related to animation frames, so CSS transitions/animations end up not working as expected. This could have accidentally worked before #12563 because we over-restyled, but now this is no longer the case. Other possible way to do it is making a layout reflow with RAF handle CSS animations/transitions too, but that may not work if the reflow ends up being suppressed (that could very well be the case), and we'd need to handle a lot more state in the document, so this solution (assuming it doesn't break try) seems a bit less flacky. Missing a test, will add one soon. Fixes #12749. Source-Repo: https://github.com/servo/servo Source-Revision: 0b9832119e9d42bc3ba4d8e4a4e573a03705de3e
2016-08-08 06:52:32 +03:00
if tick_animations {
self.tick_all_animations(possibly_locked_rw_data);
}
}
servo: Merge #8039 - Move Stylesheet loading and ownership from the layout task into HTML elements (from tschneidereit:script-owns-stylesheets); r=jdm Stylesheets for `HTMLLinkElement`s are now loaded by the resource task, triggered by the element in question. Stylesheets are owned by the elements they're associated with, which can be `HTMLStyleElement`, `HTMLLinkElement`, and `HTMLMetaElement` (for `<meta name="viewport">). Additionally, the quirks mode stylesheet (just as the user and user agent stylesheets a couple of commits ago), is implemented as a lazy static, loaded once per process and shared between all documents. This all has various nice consequences: - Stylesheet loading becomes a non-blocking operation. - Stylesheets are removed when the element they're associated with is removed from the document. - It'll be possible to implement the CSSOM APIs that require direct access to the stylesheets (i.e., ~ all of them). - Various subtle correctness issues are fixed. One piece of interesting follow-up work would be to move parsing of external stylesheets to the resource task, too. Right now, it happens in the link element once loading is complete, so blocks the script task. Moving it to the resource task would probably be fairly straight-forward as it doesn't require access to any external state. Depends on #7979 because without that loading stylesheets asynchronously breaks lots of content. Source-Repo: https://github.com/servo/servo Source-Revision: 7ff3a17524e0e703e3ac279441729c185444be24
2015-11-07 22:41:54 +03:00
/// Sets quirks mode for the document, causing the quirks mode stylesheet to be used.
fn handle_set_quirks_mode<'a, 'b>(&self, possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let mut rw_data = possibly_locked_rw_data.lock();
Arc::get_mut(&mut rw_data.stylist).unwrap().set_quirks_mode(true);
possibly_locked_rw_data.block(rw_data);
}
servo: Merge #9976 - Remove lifetimes from Style/Layout traits (from bholley:remove_trait_lifetimes); r=SimonSapin Right now, there's a huge amount of complexity in T{Node,Element,Document} and friends because of the lifetime parameter. Before I started generalizing this code for use by Gecko, these wrappers were plain structs. They had (and still have) a phantom lifetime associated with them to prevent references to DOM nodes from leaking past the end of restyle, when they might be invalidated by a GC. When I generalized them, I decided to put the lifetime on the trait as well, since there are some situations where the lifetime is, in fact, necessary. Specifically, they are necessary for the compiler to understand that all the things borrowed from all the nodes and elements and so on have the same lifetime (the lifetime of the restyle), rather than the lifetime of whichever particular element or node pointer the value was borrowed from. This come up in situations where we do |let el = node.as_element()| or |let n = el.as_node()| and then borrow something from the result. The compiler thinks the borrow lifetime is that of |el| or |n|, when it's actually longer. In practice though, I think the style and layout algorithms we use don't run into this issue much, and we can hack around it where it comes up. So I think we should remove the lifetimes from the traits, which will let us aggregate the embedding-provided traits together onto a single meta-trait and significantly simplify the code. Source-Repo: https://github.com/servo/servo Source-Revision: aea8d8959dcb157a8cc381f1403246ce8ca1ca00
2016-03-15 00:33:53 +03:00
fn try_get_layout_root<N: LayoutNode>(&self, node: N) -> Option<FlowRef> {
let mut data = match node.mutate_layout_data() {
Some(x) => x,
None => return None,
};
let result = data.flow_construction_result.get();
let mut flow = match result {
ConstructionResult::Flow(mut flow, abs_descendants) => {
// Note: Assuming that the root has display 'static' (as per
// CSS Section 9.3.1). Otherwise, if it were absolutely
// positioned, it would return a reference to itself in
// `abs_descendants` and would lead to a circular reference.
// Set Root as CB for any remaining absolute descendants.
flow.set_absolute_descendants(abs_descendants);
flow
}
_ => return None,
};
FlowRef::deref_mut(&mut flow).mark_as_root();
Some(flow)
}
/// Performs layout constraint solving.
///
/// This corresponds to `Reflow()` in Gecko and `layout()` in WebKit/Blink and should be
/// benchmarked against those two. It is marked `#[inline(never)]` to aid profiling.
#[inline(never)]
fn solve_constraints(layout_root: &mut Flow,
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
layout_context: &LayoutContext) {
let _scope = layout_debug_scope!("solve_constraints");
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
sequential::traverse_flow_tree_preorder(layout_root, layout_context);
}
/// Performs layout constraint solving in parallel.
///
/// This corresponds to `Reflow()` in Gecko and `layout()` in WebKit/Blink and should be
/// benchmarked against those two. It is marked `#[inline(never)]` to aid profiling.
#[inline(never)]
fn solve_constraints_parallel(traversal: &rayon::ThreadPool,
layout_root: &mut Flow,
profiler_metadata: Option<TimerMetadata>,
time_profiler_chan: time::ProfilerChan,
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
layout_context: &LayoutContext) {
let _scope = layout_debug_scope!("solve_constraints_parallel");
// NOTE: this currently computes borders, so any pruning should separate that
// operation out.
parallel::traverse_flow_tree_preorder(layout_root,
profiler_metadata,
time_profiler_chan,
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
layout_context,
traversal);
}
/// Computes the stacking-relative positions of all flows and, if the painting is dirty and the
/// reflow goal and query type need it, builds the display list.
fn compute_abs_pos_and_build_display_list(&mut self,
data: &Reflow,
query_type: Option<&ReflowQueryType>,
document: Option<&ServoLayoutDocument>,
layout_root: &mut Flow,
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
layout_context: &mut LayoutContext,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
rw_data: &mut LayoutThreadData) {
let writing_mode = flow::base(layout_root).writing_mode;
let (metadata, sender) = (self.profiler_metadata(), self.time_profiler_chan.clone());
servo: Merge #5348 - Rename lots of profiling-related things (from nnethercote:profiler-renaming); r=jdm ``` ------------------------------------------------------------------------ BEFORE AFTER ------------------------------------------------------------------------ util::memory util::mem - heap_size_of - heap_size_of (unchanged) - SizeOf - HeapSizeOf - size_of_excluding_self - heap_size_of_children prof::mem prof::mem - MemoryProfilerChan - ProfilerChan - MemoryReport - Report - MemoryReportsChan - ReportsChan - MemoryReporter - Reporter - MemoryProfilerMsg - ProfilerMsg - {R,UnR}egisterMemoryReporter - {R,UnR}egisterReporter - MemoryProfiler - Prof - ReportsForest - ReportsForest (unchanged) - ReportsTree - ReportsTree (unchanged) - SystemMemoryReporter - SystemReporter prof::time prof::time - TimeProfilerChan - ProfilerChan - TimerMetadata - TimerMetadata (unchanged) - Formatable - Formattable [spelling!] - TimeProfilerMsg - ProfilerMsg - TimeProfilerCategory - ProfilerCategory - TimeProfilerBuckets - ProfilerBuckets - TimeProfiler - Profiler - TimerMetadataFrameType - TimerMetadataFrameType (unchanged) - TimerMetadataReflowType - TimerMetadataReflowType (unchanged) - ProfilerMetadata - ProfilerMetadata (unchanged) ``` In a few places both prof::time and prof::mem are used, and so module-qualification is needed to avoid overlap, e.g. time::Profiler and mem::Profiler. Likewise with std::mem and prof::mem. This is not a big deal. Source-Repo: https://github.com/servo/servo Source-Revision: d784d9c488be4533a3590a154addd366d15a5864
2015-03-26 06:18:48 +03:00
profile(time::ProfilerCategory::LayoutDispListBuild,
metadata.clone(),
sender.clone(),
|| {
flow::mut_base(layout_root).stacking_relative_position =
LogicalPoint::zero(writing_mode).to_physical(writing_mode,
self.viewport_size);
servo: Merge #16336 - Used shared clips for overflow:hidden and CSS clip (from mrobinson:overflow-hidden); r=glennw Instead of passing down a complex clipping region to each item, used shared clipping to handle overflow:hidden and CSS clips. In addition to being more efficient, this should also fix quite a few issues related to absolutely positioned elements. One existing reftest is slightly modified to avoid tickling a quirk with the way that WebRender rasterizes masks. We are working out how to best express these combined masks with the API or need to. The change does not affect the original subject of the reftest. Fixes #13109. Fixes #10151. Fixes #7575. Fixes #8074. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #13109, #10151, #7575, #8074. <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: ab7e1e2d36829e20df130f7174c3c7d1dbbd5cc5 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : f0f2687589ff10964ff809060f17d3c7e3e358c8
2017-04-18 00:08:00 +03:00
flow::mut_base(layout_root).clip = data.page_clip_rect;
if flow::base(layout_root).restyle_damage.contains(REPOSITION) {
layout_root.traverse_preorder(&ComputeAbsolutePositions {
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
layout_context: layout_context
});
}
if flow::base(layout_root).restyle_damage.contains(REPAINT) ||
rw_data.display_list.is_none() {
let display_list_needed = query_type.map(reflow_query_type_needs_display_list)
.unwrap_or(false);
match (data.goal, display_list_needed) {
(ReflowGoal::ForDisplay, _) | (ReflowGoal::ForScriptQuery, true) => {
let mut build_state =
servo: Merge #14084 - Don't promote all scrollable regions to stacking contexts (from mrobinson:scroll_root_2); r=glennw <!-- Please describe your changes on the following line: --> Don't promote all scrollable regions to stacking contexts Instead annotate all flows with their owning ScrollRoots. When processing the display list items into a flattened display list, we add PushScrollRoot and PopScrollRoot to signal when scrolling regions start and end. It is possible for content from different scrolling regions to intersect and when they do, the stack of scrolling regions is duplicated. When these duplicated scrolling regions stacks reach WebRender, it will scroll them in tandem. The PushScrollRoot and PopScrollRoot items are currently represented as StackingContexts in WebRender, but eventually these will be replaced with special WebRender display items. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #13529 and #13298. (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: ef5ca14283f1f47654093b5c196ab813efb53ea8
2016-11-08 03:49:53 +03:00
sequential::build_display_list_for_subtree(layout_root,
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
layout_context);
debug!("Done building display list.");
let root_size = {
let root_flow = flow::base(layout_root);
if rw_data.stylist.viewport_constraints().is_some() {
root_flow.position.size.to_physical(root_flow.writing_mode)
} else {
root_flow.overflow.scroll.size
}
};
let origin = Rect::new(Point2D::new(Au(0), Au(0)), root_size);
build_state.root_stacking_context.bounds = origin;
build_state.root_stacking_context.overflow = origin;
if !build_state.iframe_sizes.is_empty() {
// build_state.iframe_sizes is only used here, so its okay to replace
// it with an empty vector
let iframe_sizes = std::mem::replace(&mut build_state.iframe_sizes, vec![]);
let msg = ConstellationMsg::FrameSizes(iframe_sizes);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Layout resize to constellation failed ({}).", e);
}
}
rw_data.display_list = Some(Arc::new(build_state.to_display_list()));
}
(ReflowGoal::ForScriptQuery, false) => {}
}
}
if data.goal != ReflowGoal::ForDisplay {
// Defer the paint step until the next ForDisplay.
//
// We need to tell the document about this so it doesn't
// incorrectly suppress reflows. See #13131.
document.expect("No document in a non-display reflow?")
.needs_paint_from_layout();
return;
}
if let Some(document) = document {
document.will_paint();
}
let display_list = (*rw_data.display_list.as_ref().unwrap()).clone();
if opts::get().dump_display_list {
display_list.print();
}
if opts::get().dump_display_list_json {
println!("{}", serde_json::to_string_pretty(&display_list).unwrap());
}
debug!("Layout done!");
// TODO: Avoid the temporary conversion and build webrender sc/dl directly!
let builder = rw_data.display_list.as_ref().unwrap().convert_to_webrender(self.id);
let viewport_size = Size2D::new(self.viewport_size.width.to_f32_px(),
self.viewport_size.height.to_f32_px());
self.epoch.next();
let Epoch(epoch_number) = self.epoch;
let viewport_size = webrender_traits::LayoutSize::from_untyped(&viewport_size);
self.webrender_api.set_display_list(
Some(get_root_flow_background_color(layout_root)),
webrender_traits::Epoch(epoch_number),
viewport_size,
builder.finalize(),
true);
self.webrender_api.generate_frame(None);
});
}
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
/// The high-level routine that performs layout threads.
fn handle_reflow<'a, 'b>(&mut self,
data: &ScriptReflow,
possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let document = unsafe { ServoLayoutNode::new(&data.document) };
let document = document.as_document().unwrap();
self.quirks_mode = Some(document.quirks_mode());
// FIXME(pcwalton): Combine `ReflowGoal` and `ReflowQueryType`. Then remove this assert.
debug_assert!((data.reflow_info.goal == ReflowGoal::ForDisplay &&
data.query_type == ReflowQueryType::NoQuery) ||
(data.reflow_info.goal == ReflowGoal::ForScriptQuery &&
data.query_type != ReflowQueryType::NoQuery));
// Parallelize if there's more than 750 objects based on rzambre's suggestion
// https://github.com/servo/servo/issues/10110
self.parallel_flag = self.layout_threads > 1 && data.dom_count > 750;
debug!("layout: received layout request for: {}", self.url);
debug!("Number of objects in DOM: {}", data.dom_count);
debug!("layout: parallel? {}", self.parallel_flag);
let mut rw_data = possibly_locked_rw_data.lock();
let element: ServoLayoutElement = match document.root_node() {
None => {
// Since we cannot compute anything, give spec-required placeholders.
debug!("layout: No root node: bailing");
match data.query_type {
ReflowQueryType::ContentBoxQuery(_) => {
rw_data.content_box_response = None;
},
ReflowQueryType::ContentBoxesQuery(_) => {
rw_data.content_boxes_response = Vec::new();
},
ReflowQueryType::HitTestQuery(..) => {
rw_data.hit_test_response = (None, false);
},
ReflowQueryType::NodesFromPoint(..) => {
rw_data.nodes_from_point_response = Vec::new();
},
ReflowQueryType::NodeGeometryQuery(_) => {
rw_data.client_rect_response = Rect::zero();
},
ReflowQueryType::NodeScrollGeometryQuery(_) => {
rw_data.scroll_area_response = Rect::zero();
},
ReflowQueryType::NodeOverflowQuery(_) => {
rw_data.overflow_response = NodeOverflowResponse(None);
},
ReflowQueryType::NodeScrollRootIdQuery(_) => {
rw_data.scroll_root_id_response = None;
},
ReflowQueryType::ResolvedStyleQuery(_, _, _) => {
rw_data.resolved_style_response = String::new();
},
ReflowQueryType::OffsetParentQuery(_) => {
rw_data.offset_parent_response = OffsetParentResponse::empty();
},
ReflowQueryType::MarginStyleQuery(_) => {
rw_data.margin_style_response = MarginStyleResponse::empty();
},
ReflowQueryType::TextIndexQuery(..) => {
rw_data.text_index_response = TextIndexResponse(None);
}
ReflowQueryType::NoQuery => {}
}
return;
},
Some(x) => x.as_element().unwrap(),
servo: Merge #466 - Introduce a phantom type to prevent script from unsafely accessing the layout data (from pcwalton:phantom-type); r=pcwalton See the explanation on the commit for more detail. r? @metajack Source-Repo: https://github.com/servo/servo Source-Revision: 90b01df4c3767c22f3d625dd8ed20bceef8eef04 --HG-- rename : servo/src/components/servo-gfx/color.rs => servo/src/components/gfx/color.rs rename : servo/src/components/servo-gfx/compositor.rs => servo/src/components/gfx/compositor.rs rename : servo/src/components/servo-gfx/display_list.rs => servo/src/components/gfx/display_list.rs rename : servo/src/components/servo-gfx/font.rs => servo/src/components/gfx/font.rs rename : servo/src/components/servo-gfx/font_context.rs => servo/src/components/gfx/font_context.rs rename : servo/src/components/servo-gfx/font_list.rs => servo/src/components/gfx/font_list.rs rename : servo/src/components/servo-gfx/freetype_impl/font_context.rs => servo/src/components/gfx/freetype_impl/font_context.rs rename : servo/src/components/servo-gfx/geometry.rs => servo/src/components/gfx/geometry.rs rename : servo/src/components/servo-gfx/servo_gfx.rc => servo/src/components/gfx/gfx.rc rename : servo/src/components/servo-gfx/native.rs => servo/src/components/gfx/native.rs rename : servo/src/components/servo-gfx/opts.rs => servo/src/components/gfx/opts.rs rename : servo/src/components/servo-gfx/platform/linux/font.rs => servo/src/components/gfx/platform/linux/font.rs rename : servo/src/components/servo-gfx/platform/linux/font_context.rs => servo/src/components/gfx/platform/linux/font_context.rs rename : servo/src/components/servo-gfx/platform/linux/font_list.rs => servo/src/components/gfx/platform/linux/font_list.rs rename : servo/src/components/servo-gfx/platform/macos/font.rs => servo/src/components/gfx/platform/macos/font.rs rename : servo/src/components/servo-gfx/platform/macos/font_context.rs => servo/src/components/gfx/platform/macos/font_context.rs rename : servo/src/components/servo-gfx/platform/macos/font_list.rs => servo/src/components/gfx/platform/macos/font_list.rs rename : servo/src/components/servo-gfx/platform/mod.rs => servo/src/components/gfx/platform/mod.rs rename : servo/src/components/servo-gfx/render_context.rs => servo/src/components/gfx/render_context.rs rename : servo/src/components/servo-gfx/render_layers.rs => servo/src/components/gfx/render_layers.rs rename : servo/src/components/servo-gfx/surface.rs => servo/src/components/gfx/surface.rs rename : servo/src/components/servo-gfx/text/glyph.rs => servo/src/components/gfx/text/glyph.rs rename : servo/src/components/servo-gfx/text/mod.rs => servo/src/components/gfx/text/mod.rs rename : servo/src/components/servo-gfx/text/shaper.rs => servo/src/components/gfx/text/shaper.rs rename : servo/src/components/servo-gfx/text/shaping/harfbuzz.rs => servo/src/components/gfx/text/shaping/harfbuzz.rs rename : servo/src/components/servo-gfx/text/shaping/mod.rs => servo/src/components/gfx/text/shaping/mod.rs rename : servo/src/components/servo-gfx/text/text_run.rs => servo/src/components/gfx/text/text_run.rs rename : servo/src/components/servo-gfx/text/util.rs => servo/src/components/gfx/text/util.rs rename : servo/src/components/servo/compositing/resize_rate_limiter.rs => servo/src/components/main/compositing/resize_rate_limiter.rs rename : servo/src/components/servo/css/matching.rs => servo/src/components/main/css/matching.rs rename : servo/src/components/servo/css/node_style.rs => servo/src/components/main/css/node_style.rs rename : servo/src/components/servo/css/node_util.rs => servo/src/components/main/css/node_util.rs rename : servo/src/components/servo/css/node_void_ptr.rs => servo/src/components/main/css/node_void_ptr.rs rename : servo/src/components/servo/css/select.rs => servo/src/components/main/css/select.rs rename : servo/src/components/servo/dom/bindings/clientrect.rs => servo/src/components/main/dom/bindings/clientrect.rs rename : servo/src/components/servo/dom/bindings/clientrectlist.rs => servo/src/components/main/dom/bindings/clientrectlist.rs rename : servo/src/components/servo/dom/bindings/codegen/BindingGen.py => servo/src/components/main/dom/bindings/codegen/BindingGen.py rename : servo/src/components/servo/dom/bindings/codegen/BindingUtils.cpp => servo/src/components/main/dom/bindings/codegen/BindingUtils.cpp rename : servo/src/components/servo/dom/bindings/codegen/BindingUtils.h => servo/src/components/main/dom/bindings/codegen/BindingUtils.h rename : servo/src/components/servo/dom/bindings/codegen/Bindings.conf => servo/src/components/main/dom/bindings/codegen/Bindings.conf rename : servo/src/components/servo/dom/bindings/codegen/ClientRect.webidl => servo/src/components/main/dom/bindings/codegen/ClientRect.webidl rename : servo/src/components/servo/dom/bindings/codegen/ClientRectList.webidl => servo/src/components/main/dom/bindings/codegen/ClientRectList.webidl rename : servo/src/components/servo/dom/bindings/codegen/Codegen.py => servo/src/components/main/dom/bindings/codegen/Codegen.py rename : servo/src/components/servo/dom/bindings/codegen/CodegenRust.py => servo/src/components/main/dom/bindings/codegen/CodegenRust.py rename : servo/src/components/servo/dom/bindings/codegen/Configuration.py => servo/src/components/main/dom/bindings/codegen/Configuration.py rename : servo/src/components/servo/dom/bindings/codegen/DOMJSClass.h => servo/src/components/main/dom/bindings/codegen/DOMJSClass.h rename : servo/src/components/servo/dom/bindings/codegen/DOMJSProxyHandler.cpp => servo/src/components/main/dom/bindings/codegen/DOMJSProxyHandler.cpp rename : servo/src/components/servo/dom/bindings/codegen/DOMJSProxyHandler.h => servo/src/components/main/dom/bindings/codegen/DOMJSProxyHandler.h rename : servo/src/components/servo/dom/bindings/codegen/DOMParser.webidl => servo/src/components/main/dom/bindings/codegen/DOMParser.webidl rename : servo/src/components/servo/dom/bindings/codegen/ErrorResult.h => servo/src/components/main/dom/bindings/codegen/ErrorResult.h rename : servo/src/components/servo/dom/bindings/codegen/Errors.msg => servo/src/components/main/dom/bindings/codegen/Errors.msg rename : servo/src/components/servo/dom/bindings/codegen/Event.webidl => servo/src/components/main/dom/bindings/codegen/Event.webidl rename : servo/src/components/servo/dom/bindings/codegen/EventTarget.webidl => servo/src/components/main/dom/bindings/codegen/EventTarget.webidl rename : servo/src/components/servo/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py => servo/src/components/main/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py rename : servo/src/components/servo/dom/bindings/codegen/GlobalGen.py => servo/src/components/main/dom/bindings/codegen/GlobalGen.py rename : servo/src/components/servo/dom/bindings/codegen/HTMLCollection.webidl => servo/src/components/main/dom/bindings/codegen/HTMLCollection.webidl rename : servo/src/components/servo/dom/bindings/codegen/Makefile.in => servo/src/components/main/dom/bindings/codegen/Makefile.in rename : servo/src/components/servo/dom/bindings/codegen/Nullable.h => servo/src/components/main/dom/bindings/codegen/Nullable.h rename : servo/src/components/servo/dom/bindings/codegen/PrimitiveConversions.h => servo/src/components/main/dom/bindings/codegen/PrimitiveConversions.h rename : servo/src/components/servo/dom/bindings/codegen/RegisterBindings.cpp => servo/src/components/main/dom/bindings/codegen/RegisterBindings.cpp rename : servo/src/components/servo/dom/bindings/codegen/RegisterBindings.h => servo/src/components/main/dom/bindings/codegen/RegisterBindings.h rename : servo/src/components/servo/dom/bindings/codegen/TypedArray.h => servo/src/components/main/dom/bindings/codegen/TypedArray.h rename : servo/src/components/servo/dom/bindings/codegen/crashtests/769464.html => servo/src/components/main/dom/bindings/codegen/crashtests/769464.html rename : servo/src/components/servo/dom/bindings/codegen/crashtests/crashtests.list => servo/src/components/main/dom/bindings/codegen/crashtests/crashtests.list rename : servo/src/components/servo/dom/bindings/codegen/parser/README => servo/src/components/main/dom/bindings/codegen/parser/README rename : servo/src/components/servo/dom/bindings/codegen/parser/UPSTREAM => servo/src/components/main/dom/bindings/codegen/parser/UPSTREAM rename : servo/src/components/servo/dom/bindings/codegen/parser/WebIDL.py => servo/src/components/main/dom/bindings/codegen/parser/WebIDL.py rename : servo/src/components/servo/dom/bindings/codegen/parser/runtests.py => servo/src/components/main/dom/bindings/codegen/parser/runtests.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_any_null.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_any_null.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_argument_novoid.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_argument_novoid.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_array_of_interface.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_array_of_interface.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_arraybuffer.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_arraybuffer.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_attr.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_attr.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_builtin_filename.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_builtin_filename.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_builtins.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_builtins.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_callback.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_callback.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_callback_interface.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_callback_interface.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_const.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_const.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_constructor.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_constructor.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_deduplicate.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_deduplicate.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_dictionary.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_dictionary.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_distinguishability.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_distinguishability.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_double_null.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_double_null.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_empty_enum.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_empty_enum.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_enum.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_enum.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_error_colno.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_error_colno.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_error_lineno.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_error_lineno.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_extended_attributes.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_extended_attributes.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_forward_decl.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_forward_decl.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_implements.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_implements.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_incomplete_parent.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_incomplete_parent.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_incomplete_types.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_incomplete_types.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_interface.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_method.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_method.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_nullable_void.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_nullable_void.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_optional_constraints.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_optional_constraints.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_overload.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_overload.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_sanity.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_sanity.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_special_methods.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_methods.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_typedef.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_typedef.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_union.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_union.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_union_any.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_union_any.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_union_nullable.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_union_nullable.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_variadic_callback.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_variadic_callback.py rename : servo/src/components/servo/dom/bindings/codegen/parser/tests/test_variadic_constraints.py => servo/src/components/main/dom/bindings/codegen/parser/tests/test_variadic_constraints.py rename : servo/src/components/servo/dom/bindings/codegen/ply/COPYING => servo/src/components/main/dom/bindings/codegen/ply/COPYING rename : servo/src/components/servo/dom/bindings/codegen/ply/README => servo/src/components/main/dom/bindings/codegen/ply/README rename : servo/src/components/servo/dom/bindings/codegen/ply/ply/__init__.py => servo/src/components/main/dom/bindings/codegen/ply/ply/__init__.py rename : servo/src/components/servo/dom/bindings/codegen/ply/ply/lex.py => servo/src/components/main/dom/bindings/codegen/ply/ply/lex.py rename : servo/src/components/servo/dom/bindings/codegen/ply/ply/yacc.py => servo/src/components/main/dom/bindings/codegen/ply/ply/yacc.py rename : servo/src/components/servo/dom/bindings/codegen/pythonpath.py => servo/src/components/main/dom/bindings/codegen/pythonpath.py rename : servo/src/components/servo/dom/bindings/codegen/stubgenerator/Skeleton.cpp => servo/src/components/main/dom/bindings/codegen/stubgenerator/Skeleton.cpp rename : servo/src/components/servo/dom/bindings/codegen/stubgenerator/Skeleton.h => servo/src/components/main/dom/bindings/codegen/stubgenerator/Skeleton.h rename : servo/src/components/servo/dom/bindings/codegen/stubgenerator/generate.sh => servo/src/components/main/dom/bindings/codegen/stubgenerator/generate.sh rename : servo/src/components/servo/dom/bindings/codegen/test/Makefile.in => servo/src/components/main/dom/bindings/codegen/test/Makefile.in rename : servo/src/components/servo/dom/bindings/codegen/test/TestBindingHeader.h => servo/src/components/main/dom/bindings/codegen/test/TestBindingHeader.h rename : servo/src/components/servo/dom/bindings/codegen/test/TestCodeGen.webidl => servo/src/components/main/dom/bindings/codegen/test/TestCodeGen.webidl rename : servo/src/components/servo/dom/bindings/codegen/test/TestDictionary.webidl => servo/src/components/main/dom/bindings/codegen/test/TestDictionary.webidl rename : servo/src/components/servo/dom/bindings/codegen/test/TestTypedef.webidl => servo/src/components/main/dom/bindings/codegen/test/TestTypedef.webidl rename : servo/src/components/servo/dom/bindings/codegen/test/file_bug775543.html => servo/src/components/main/dom/bindings/codegen/test/file_bug775543.html rename : servo/src/components/servo/dom/bindings/codegen/test/forOf_iframe.html => servo/src/components/main/dom/bindings/codegen/test/forOf_iframe.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_InstanceOf.html => servo/src/components/main/dom/bindings/codegen/test/test_InstanceOf.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_bug773326.html => servo/src/components/main/dom/bindings/codegen/test/test_bug773326.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_bug775543.html => servo/src/components/main/dom/bindings/codegen/test/test_bug775543.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_bug788369.html => servo/src/components/main/dom/bindings/codegen/test/test_bug788369.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_enums.html => servo/src/components/main/dom/bindings/codegen/test/test_enums.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_forOf.html => servo/src/components/main/dom/bindings/codegen/test/test_forOf.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_integers.html => servo/src/components/main/dom/bindings/codegen/test/test_integers.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_interfaceToString.html => servo/src/components/main/dom/bindings/codegen/test/test_interfaceToString.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_lookupGetter.html => servo/src/components/main/dom/bindings/codegen/test/test_lookupGetter.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_sequence_wrapping.html => servo/src/components/main/dom/bindings/codegen/test/test_sequence_wrapping.html rename : servo/src/components/servo/dom/bindings/codegen/test/test_traceProtos.html => servo/src/components/main/dom/bindings/codegen/test/test_traceProtos.html rename : servo/src/components/servo/dom/bindings/conversions.rs => servo/src/components/main/dom/bindings/conversions.rs rename : servo/src/components/servo/dom/bindings/document.rs => servo/src/components/main/dom/bindings/document.rs rename : servo/src/components/servo/dom/bindings/domparser.rs => servo/src/components/main/dom/bindings/domparser.rs rename : servo/src/components/servo/dom/bindings/element.rs => servo/src/components/main/dom/bindings/element.rs rename : servo/src/components/servo/dom/bindings/event.rs => servo/src/components/main/dom/bindings/event.rs rename : servo/src/components/servo/dom/bindings/eventtarget.rs => servo/src/components/main/dom/bindings/eventtarget.rs rename : servo/src/components/servo/dom/bindings/htmlcollection.rs => servo/src/components/main/dom/bindings/htmlcollection.rs rename : servo/src/components/servo/dom/bindings/node.rs => servo/src/components/main/dom/bindings/node.rs rename : servo/src/components/servo/dom/bindings/proxyhandler.rs => servo/src/components/main/dom/bindings/proxyhandler.rs rename : servo/src/components/servo/dom/bindings/text.rs => servo/src/components/main/dom/bindings/text.rs rename : servo/src/components/servo/dom/bindings/utils.rs => servo/src/components/main/dom/bindings/utils.rs rename : servo/src/components/servo/dom/bindings/window.rs => servo/src/components/main/dom/bindings/window.rs rename : servo/src/components/servo/dom/characterdata.rs => servo/src/components/main/dom/characterdata.rs rename : servo/src/components/servo/dom/clientrect.rs => servo/src/components/main/dom/clientrect.rs rename : servo/src/components/servo/dom/clientrectlist.rs => servo/src/components/main/dom/clientrectlist.rs rename : servo/src/components/servo/dom/document.rs => servo/src/components/main/dom/document.rs rename : servo/src/components/servo/dom/domparser.rs => servo/src/components/main/dom/domparser.rs rename : servo/src/components/servo/dom/element.rs => servo/src/components/main/dom/element.rs rename : servo/src/components/servo/dom/event.rs => servo/src/components/main/dom/event.rs rename : servo/src/components/servo/dom/eventtarget.rs => servo/src/components/main/dom/eventtarget.rs rename : servo/src/components/servo/dom/htmlcollection.rs => servo/src/components/main/dom/htmlcollection.rs rename : servo/src/components/servo/dom/window.rs => servo/src/components/main/dom/window.rs rename : servo/src/components/servo/engine.rs => servo/src/components/main/engine.rs rename : servo/src/components/servo/html/cssparse.rs => servo/src/components/main/html/cssparse.rs rename : servo/src/components/servo/html/hubbub_html_parser.rs => servo/src/components/main/html/hubbub_html_parser.rs rename : servo/src/components/servo/image.rs => servo/src/components/main/image.rs rename : servo/src/components/servo/layout/block.rs => servo/src/components/main/layout/block.rs rename : servo/src/components/servo/layout/box.rs => servo/src/components/main/layout/box.rs rename : servo/src/components/servo/layout/box_builder.rs => servo/src/components/main/layout/box_builder.rs rename : servo/src/components/servo/layout/context.rs => servo/src/components/main/layout/context.rs rename : servo/src/components/servo/layout/debug.rs => servo/src/components/main/layout/debug.rs rename : servo/src/components/servo/layout/display_list_builder.rs => servo/src/components/main/layout/display_list_builder.rs rename : servo/src/components/servo/layout/flow.rs => servo/src/components/main/layout/flow.rs rename : servo/src/components/servo/layout/inline.rs => servo/src/components/main/layout/inline.rs rename : servo/src/components/servo/layout/layout_task.rs => servo/src/components/main/layout/layout_task.rs rename : servo/src/components/servo/layout/text.rs => servo/src/components/main/layout/text.rs rename : servo/src/components/servo/macros.rs => servo/src/components/main/macros.rs rename : servo/src/components/servo/platform/common/glut_windowing.rs => servo/src/components/main/platform/common/glut_windowing.rs rename : servo/src/components/servo/platform/common/shared_gl_windowing.rs => servo/src/components/main/platform/common/shared_gl_windowing.rs rename : servo/src/components/servo/platform/mod.rs => servo/src/components/main/platform/mod.rs rename : servo/src/components/servo/scripting/script_task.rs => servo/src/components/main/scripting/script_task.rs rename : servo/src/components/servo/servo.rc => servo/src/components/main/servo.rc rename : servo/src/components/servo/util/mod.rs => servo/src/components/main/util/mod.rs rename : servo/src/components/servo/util/task.rs => servo/src/components/main/util/task.rs rename : servo/src/components/servo/windowing.rs => servo/src/components/main/windowing.rs rename : servo/src/components/servo-net/file_loader.rs => servo/src/components/net/file_loader.rs rename : servo/src/components/servo-net/http_loader.rs => servo/src/components/net/http_loader.rs rename : servo/src/components/servo-net/image/base.rs => servo/src/components/net/image/base.rs rename : servo/src/components/servo-net/image/holder.rs => servo/src/components/net/image/holder.rs rename : servo/src/components/servo-net/image/test.jpeg => servo/src/components/net/image/test.jpeg rename : servo/src/components/servo-net/image_cache_task.rs => servo/src/components/net/image_cache_task.rs rename : servo/src/components/servo-net/local_image_cache.rs => servo/src/components/net/local_image_cache.rs rename : servo/src/components/servo-net/servo_net.rc => servo/src/components/net/net.rc rename : servo/src/components/servo-net/resource_task.rs => servo/src/components/net/resource_task.rs rename : servo/src/components/servo-net/util.rs => servo/src/components/net/util.rs rename : servo/src/components/servo-util/cache.rs => servo/src/components/util/cache.rs rename : servo/src/components/servo-util/range.rs => servo/src/components/util/range.rs rename : servo/src/components/servo-util/time.rs => servo/src/components/util/time.rs rename : servo/src/components/servo-util/tree.rs => servo/src/components/util/tree.rs rename : servo/src/components/servo-util/url.rs => servo/src/components/util/url.rs rename : servo/src/components/servo-util/servo_util.rc => servo/src/components/util/util.rc rename : servo/src/components/servo-util/vec.rs => servo/src/components/util/vec.rs rename : servo/src/components/contenttest/contenttest.rs => servo/src/test/harness/contenttest/contenttest.rs rename : servo/src/components/reftest/rasterize.py => servo/src/test/harness/reftest/rasterize.py rename : servo/src/components/reftest/reftest.rs => servo/src/test/harness/reftest/reftest.rs rename : servo/src/test/about-mozilla.html => servo/src/test/html/about-mozilla.html rename : servo/src/test/acid1.html => servo/src/test/html/acid1.html rename : servo/src/test/combining-character-sequences.html => servo/src/test/html/combining-character-sequences.html rename : servo/src/test/content/harness.js => servo/src/test/html/content/harness.js rename : servo/src/test/content/test_prototypes.html => servo/src/test/html/content/test_prototypes.html rename : servo/src/test/content/test_prototypes.js => servo/src/test/html/content/test_prototypes.js rename : servo/src/test/demo.css => servo/src/test/html/demo.css rename : servo/src/test/demo.html => servo/src/test/html/demo.html rename : servo/src/test/head_link_test.html => servo/src/test/html/head_link_test.html rename : servo/src/test/hello.html => servo/src/test/html/hello.html rename : servo/src/test/ligatures.html => servo/src/test/html/ligatures.html rename : servo/src/test/lipsum.html => servo/src/test/html/lipsum.html rename : servo/src/test/lots_of_background_colors.css => servo/src/test/html/lots_of_background_colors.css rename : servo/src/test/mojira.html => servo/src/test/html/mojira.html rename : servo/src/test/small-layout-test.html => servo/src/test/html/small-layout-test.html rename : servo/src/test/small_color_test.css => servo/src/test/html/small_color_test.css rename : servo/src/test/small_color_test.html => servo/src/test/html/small_color_test.html rename : servo/src/test/test-absolute.css => servo/src/test/html/test-absolute.css rename : servo/src/test/test-absolute.html => servo/src/test/html/test-absolute.html rename : servo/src/test/test-alert.js => servo/src/test/html/test-alert.js rename : servo/src/test/test-border.css => servo/src/test/html/test-border.css rename : servo/src/test/test-border.html => servo/src/test/html/test-border.html rename : servo/src/test/test-inline.html => servo/src/test/html/test-inline.html rename : servo/src/test/test-js-alert.html => servo/src/test/html/test-js-alert.html rename : servo/src/test/test-js-image.html => servo/src/test/html/test-js-image.html rename : servo/src/test/test-js.html => servo/src/test/html/test-js.html rename : servo/src/test/test-many-images-different.html => servo/src/test/html/test-many-images-different.html rename : servo/src/test/test-many-images.html => servo/src/test/html/test-many-images.html rename : servo/src/test/test-text-break.html => servo/src/test/html/test-text-break.html rename : servo/src/test/test-text.html => servo/src/test/html/test-text.html rename : servo/src/test/test.css => servo/src/test/html/test.css rename : servo/src/test/test.html => servo/src/test/html/test.html rename : servo/src/test/test.jpeg => servo/src/test/html/test.jpeg rename : servo/src/test/test.js => servo/src/test/html/test.js rename : servo/src/test/test_bg_color.html => servo/src/test/html/test_bg_color.html rename : servo/src/test/test_bg_color_simple.css => servo/src/test/html/test_bg_color_simple.css rename : servo/src/test/test_bg_color_simple.html => servo/src/test/html/test_bg_color_simple.html rename : servo/src/test/test_bindings.html => servo/src/test/html/test_bindings.html rename : servo/src/test/test_bindings.js => servo/src/test/html/test_bindings.js rename : servo/src/test/test_close.html => servo/src/test/html/test_close.html rename : servo/src/test/test_close.js => servo/src/test/html/test_close.js rename : servo/src/test/test_docelem.js => servo/src/test/html/test_docelem.js rename : servo/src/test/test_getter_time.html => servo/src/test/html/test_getter_time.html rename : servo/src/test/test_getter_time.js => servo/src/test/html/test_getter_time.js rename : servo/src/test/test_hammer_layout.css => servo/src/test/html/test_hammer_layout.css rename : servo/src/test/test_hammer_layout.html => servo/src/test/html/test_hammer_layout.html rename : servo/src/test/test_hammer_layout.js => servo/src/test/html/test_hammer_layout.js rename : servo/src/test/test_image_getter.js => servo/src/test/html/test_image_getter.js rename : servo/src/test/test_inline_boxes.html => servo/src/test/html/test_inline_boxes.html rename : servo/src/test/test_linking.css => servo/src/test/html/test_linking.css rename : servo/src/test/test_timeout.html => servo/src/test/html/test_timeout.html rename : servo/src/test/test_timeout.js => servo/src/test/html/test_timeout.js rename : servo/src/test/tiny_test.html => servo/src/test/html/tiny_test.html
2013-05-30 06:30:47 +04:00
};
debug!("layout: processing reflow request for: {:?} ({}) (query={:?})",
element, self.url, data.query_type);
debug!("{:?}", ShowSubtree(element.as_node()));
let initial_viewport = data.window_size.initial_viewport;
let old_viewport_size = self.viewport_size;
let current_screen_size = Size2D::new(Au::from_f32_px(initial_viewport.width),
Au::from_f32_px(initial_viewport.height));
// Calculate the actual viewport as per DEVICE-ADAPT § 6
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
let document_shared_lock = document.style_shared_lock();
self.document_shared_lock = Some(document_shared_lock.clone());
let author_guard = document_shared_lock.read();
let device = Device::new(MediaType::Screen, initial_viewport);
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
Arc::get_mut(&mut rw_data.stylist).unwrap()
.set_device(device, &author_guard, &data.document_stylesheets);
self.viewport_size =
rw_data.stylist.viewport_constraints().map_or(current_screen_size, |constraints| {
debug!("Viewport constraints: {:?}", constraints);
// other rules are evaluated against the actual viewport
Size2D::new(Au::from_f32_px(constraints.size.width),
Au::from_f32_px(constraints.size.height))
});
let viewport_size_changed = self.viewport_size != old_viewport_size;
if viewport_size_changed {
if let Some(constraints) = rw_data.stylist.viewport_constraints() {
// let the constellation know about the viewport constraints
rw_data.constellation_chan
.send(ConstellationMsg::ViewportConstrained(self.id, constraints.clone()))
.unwrap();
}
if data.document_stylesheets.iter().any(|sheet| sheet.dirty_on_viewport_size_change()) {
let mut iter = element.as_node().traverse_preorder();
let mut next = iter.next();
while let Some(node) = next {
if node.needs_dirty_on_viewport_size_changed() {
let el = node.as_element().unwrap();
if let Some(mut d) = element.mutate_data() {
if d.has_styles() {
d.ensure_restyle().hint.insert(&StoredRestyleHint::subtree());
}
}
if let Some(p) = el.parent_element() {
unsafe { p.note_dirty_descendant() };
}
next = iter.next_skipping_children();
} else {
next = iter.next();
}
}
}
}
// If the entire flow tree is invalid, then it will be reflowed anyhow.
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
let ua_stylesheets = &*UA_STYLESHEETS;
let ua_or_user_guard = ua_stylesheets.shared_lock.read();
let guards = StylesheetGuards {
author: &author_guard,
ua_or_user: &ua_or_user_guard,
};
let mut extra_data = ExtraStyleData {
author_style_disabled: None,
marker: PhantomData,
};
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
let needs_dirtying = Arc::get_mut(&mut rw_data.stylist).unwrap().update(
&data.document_stylesheets,
&guards,
Some(ua_stylesheets),
data.stylesheets_changed,
&mut extra_data);
let needs_reflow = viewport_size_changed && !needs_dirtying;
if needs_dirtying {
if let Some(mut d) = element.mutate_data() {
if d.has_styles() {
d.ensure_restyle().hint.insert(&StoredRestyleHint::subtree());
}
}
}
if needs_reflow {
if let Some(mut flow) = self.try_get_layout_root(element.as_node()) {
LayoutThread::reflow_all_nodes(FlowRef::deref_mut(&mut flow));
}
}
let restyles = document.drain_pending_restyles();
debug!("Draining restyles: {} (needs dirtying? {:?})", restyles.len(), needs_dirtying);
if !needs_dirtying {
for (el, restyle) in restyles {
// Propagate the descendant bit up the ancestors. Do this before
// the restyle calculation so that we can also do it for new
// unstyled nodes, which the descendants bit helps us find.
if let Some(parent) = el.parent_element() {
unsafe { parent.note_dirty_descendant() };
}
// If we haven't styled this node yet, we don't need to track a restyle.
let mut data = match el.mutate_layout_data() {
Some(d) => d,
None => continue,
};
let mut style_data = &mut data.base.style_data;
servo: Merge #14436 - Make restyle tracking more granular (from bholley:granular_restyle); r=emilio The primary idea of this patch is to ditch the rigid enum of Previous/Current styles, and replace it with a series of indicators for the various types of work that needs to be performed (expanding snapshots, rematching, recascading, and damage processing). This loses us a little bit of sanity checking (since the up-to-date-ness of our style is no longer baked into the type system), but gives us a lot more flexibility that we'll need going forward (especially when we separate matching from cascading). We also eliminate get_styling_mode in favor of a method on the traversal. This patch does a few other things as ridealongs: * Temporarily eliminates the handling for transfering ownership of styles to the frame. We'll need this again at some point, but for now it's causing too much complexity for a half-implemented feature. * Ditches TRestyleDamage, which is no longer necessary post-crate-merge, and is a constant source of compilation failures from either needing to be imported or being unnecessarily imported (which varies between gecko and servo). * Expands Snapshots for the traversal root, which was missing before. * Fixes up the skip_root stuff to avoid visiting the skipped root. * Unifies parallel traversal and avoids spawning for a single work item. * Adds an explicit pre_traverse step do any pre-processing and determine whether we need to traverse at all. Source-Repo: https://github.com/servo/servo Source-Revision: b9a8ccd775c3192e3810a1730b1d0bc2b5c9dfb6
2016-12-10 04:01:05 +03:00
debug_assert!(style_data.has_current_styles());
let mut restyle_data = style_data.ensure_restyle();
// Stash the data on the element for processing by the style system.
restyle_data.hint = restyle.hint.into();
restyle_data.damage = restyle.damage;
servo: Merge #14436 - Make restyle tracking more granular (from bholley:granular_restyle); r=emilio The primary idea of this patch is to ditch the rigid enum of Previous/Current styles, and replace it with a series of indicators for the various types of work that needs to be performed (expanding snapshots, rematching, recascading, and damage processing). This loses us a little bit of sanity checking (since the up-to-date-ness of our style is no longer baked into the type system), but gives us a lot more flexibility that we'll need going forward (especially when we separate matching from cascading). We also eliminate get_styling_mode in favor of a method on the traversal. This patch does a few other things as ridealongs: * Temporarily eliminates the handling for transfering ownership of styles to the frame. We'll need this again at some point, but for now it's causing too much complexity for a half-implemented feature. * Ditches TRestyleDamage, which is no longer necessary post-crate-merge, and is a constant source of compilation failures from either needing to be imported or being unnecessarily imported (which varies between gecko and servo). * Expands Snapshots for the traversal root, which was missing before. * Fixes up the skip_root stuff to avoid visiting the skipped root. * Unifies parallel traversal and avoids spawning for a single work item. * Adds an explicit pre_traverse step do any pre-processing and determine whether we need to traverse at all. Source-Repo: https://github.com/servo/servo Source-Revision: b9a8ccd775c3192e3810a1730b1d0bc2b5c9dfb6
2016-12-10 04:01:05 +03:00
if let Some(s) = restyle.snapshot {
restyle_data.snapshot.ensure(move || s);
}
debug!("Noting restyle for {:?}: {:?}", el, restyle_data);
}
}
// Create a layout context for use throughout the following passes.
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
let mut layout_context = self.build_layout_context(guards.clone(), &*rw_data, true);
// NB: Type inference falls apart here for some reason, so we need to be very verbose. :-(
let traversal_driver = if self.parallel_flag && self.parallel_traversal.is_some() {
TraversalDriver::Parallel
} else {
TraversalDriver::Sequential
};
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
let traversal = RecalcStyleAndConstructFlows::new(layout_context, traversal_driver);
let token = {
let stylist = &<RecalcStyleAndConstructFlows as
DomTraversal<ServoLayoutElement>>::shared_context(&traversal).stylist;
<RecalcStyleAndConstructFlows as
DomTraversal<ServoLayoutElement>>::pre_traverse(element, stylist, TraversalFlags::empty())
};
servo: Merge #14436 - Make restyle tracking more granular (from bholley:granular_restyle); r=emilio The primary idea of this patch is to ditch the rigid enum of Previous/Current styles, and replace it with a series of indicators for the various types of work that needs to be performed (expanding snapshots, rematching, recascading, and damage processing). This loses us a little bit of sanity checking (since the up-to-date-ness of our style is no longer baked into the type system), but gives us a lot more flexibility that we'll need going forward (especially when we separate matching from cascading). We also eliminate get_styling_mode in favor of a method on the traversal. This patch does a few other things as ridealongs: * Temporarily eliminates the handling for transfering ownership of styles to the frame. We'll need this again at some point, but for now it's causing too much complexity for a half-implemented feature. * Ditches TRestyleDamage, which is no longer necessary post-crate-merge, and is a constant source of compilation failures from either needing to be imported or being unnecessarily imported (which varies between gecko and servo). * Expands Snapshots for the traversal root, which was missing before. * Fixes up the skip_root stuff to avoid visiting the skipped root. * Unifies parallel traversal and avoids spawning for a single work item. * Adds an explicit pre_traverse step do any pre-processing and determine whether we need to traverse at all. Source-Repo: https://github.com/servo/servo Source-Revision: b9a8ccd775c3192e3810a1730b1d0bc2b5c9dfb6
2016-12-10 04:01:05 +03:00
if token.should_traverse() {
// Recalculate CSS styles and rebuild flows and fragments.
profile(time::ProfilerCategory::LayoutStyleRecalc,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
|| {
// Perform CSS selector matching and flow construction.
if traversal_driver.is_parallel() {
let pool = self.parallel_traversal.as_mut().unwrap();
// Parallel mode
parallel::traverse_dom::<ServoLayoutElement, RecalcStyleAndConstructFlows>(
&traversal, element, token, pool);
} else {
// Sequential mode
sequential::traverse_dom::<ServoLayoutElement, RecalcStyleAndConstructFlows>(
&traversal, element, token);
}
});
// TODO(pcwalton): Measure energy usage of text shaping, perhaps?
let text_shaping_time =
(font::get_and_reset_text_shaping_performance_counter() as u64) /
(self.layout_threads as u64);
time::send_profile_data(time::ProfilerCategory::LayoutTextShaping,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
0,
text_shaping_time,
0,
0);
// Retrieve the (possibly rebuilt) root flow.
self.root_flow = self.try_get_layout_root(element.as_node());
}
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
layout_context = traversal.destroy();
if opts::get().dump_style_tree {
println!("{:?}", ShowSubtreeDataAndPrimaryValues(element.as_node()));
}
if opts::get().dump_rule_tree {
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
layout_context.style_context.stylist.rule_tree.dump_stdout(&guards);
}
// GC the rule tree if some heuristics are met.
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
unsafe { layout_context.style_context.stylist.rule_tree.maybe_gc(); }
// Perform post-style recalculation layout passes.
if let Some(mut root_flow) = self.root_flow.clone() {
self.perform_post_style_recalc_layout_passes(&mut root_flow,
&data.reflow_info,
Some(&data.query_type),
Some(&document),
&mut rw_data,
&mut layout_context);
}
self.respond_to_query_if_necessary(&data.query_type,
&mut *rw_data,
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
&mut layout_context);
}
fn respond_to_query_if_necessary(&mut self,
query_type: &ReflowQueryType,
rw_data: &mut LayoutThreadData,
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
context: &mut LayoutContext) {
let pending_images = match context.pending_images {
Some(ref pending) => std_mem::replace(&mut *pending.lock().unwrap(), vec![]),
None => vec![],
};
rw_data.pending_images = pending_images;
let mut root_flow = match self.root_flow.clone() {
Some(root_flow) => root_flow,
None => return,
};
let root_flow = FlowRef::deref_mut(&mut root_flow);
match *query_type {
ReflowQueryType::ContentBoxQuery(node) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.content_box_response = process_content_box_request(node, root_flow);
},
ReflowQueryType::ContentBoxesQuery(node) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.content_boxes_response = process_content_boxes_request(node, root_flow);
},
ReflowQueryType::HitTestQuery(translated_point, client_point, update_cursor) => {
let mut translated_point = Point2D::new(Au::from_f32_px(translated_point.x),
Au::from_f32_px(translated_point.y));
let client_point = Point2D::new(Au::from_f32_px(client_point.x),
Au::from_f32_px(client_point.y));
let result = rw_data.display_list
.as_ref()
.expect("Tried to hit test with no display list")
.hit_test(&mut translated_point,
&client_point,
&rw_data.stacking_context_scroll_offsets);
rw_data.hit_test_response = (result.last().cloned(), update_cursor);
},
ReflowQueryType::TextIndexQuery(node, mouse_x, mouse_y) => {
let node = unsafe { ServoLayoutNode::new(&node) };
let opaque_node = node.opaque();
let client_point = Point2D::new(Au::from_px(mouse_x),
Au::from_px(mouse_y));
rw_data.text_index_response =
TextIndexResponse(rw_data.display_list
.as_ref()
.expect("Tried to hit test with no display list")
.text_index(opaque_node,
&client_point,
&rw_data.stacking_context_scroll_offsets));
},
ReflowQueryType::NodeGeometryQuery(node) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.client_rect_response = process_node_geometry_request(node, root_flow);
},
ReflowQueryType::NodeScrollGeometryQuery(node) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.scroll_area_response = process_node_scroll_area_request(node, root_flow);
},
ReflowQueryType::NodeOverflowQuery(node) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.overflow_response = process_node_overflow_request(node);
},
ReflowQueryType::NodeScrollRootIdQuery(node) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.scroll_root_id_response = Some(process_node_scroll_root_id_request(node));
},
ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.resolved_style_response =
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
process_resolved_style_request(context,
node,
pseudo,
property,
root_flow);
},
ReflowQueryType::OffsetParentQuery(node) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.offset_parent_response = process_offset_parent_query(node, root_flow);
},
ReflowQueryType::MarginStyleQuery(node) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.margin_style_response = process_margin_style_query(node);
},
ReflowQueryType::NodesFromPoint(page_point, client_point) => {
let page_point = Point2D::new(Au::from_f32_px(page_point.x),
Au::from_f32_px(page_point.y));
let client_point = Point2D::new(Au::from_f32_px(client_point.x),
Au::from_f32_px(client_point.y));
let nodes_from_point_list = {
let result = match rw_data.display_list {
None => panic!("Tried to hit test without a DisplayList"),
Some(ref display_list) => {
display_list.hit_test(&page_point,
&client_point,
&rw_data.stacking_context_scroll_offsets)
}
};
result
};
rw_data.nodes_from_point_response = nodes_from_point_list.iter()
.rev()
.map(|metadata| metadata.node.to_untrusted_node_address())
.collect()
},
ReflowQueryType::NoQuery => {}
}
}
fn set_stacking_context_scroll_states<'a, 'b>(
&mut self,
new_scroll_states: Vec<StackingContextScrollState>,
possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let mut rw_data = possibly_locked_rw_data.lock();
let mut script_scroll_states = vec![];
let mut layout_scroll_states = HashMap::new();
for new_scroll_state in &new_scroll_states {
let offset = new_scroll_state.scroll_offset;
layout_scroll_states.insert(new_scroll_state.scroll_root_id, offset);
if new_scroll_state.scroll_root_id == ScrollRootId::root() {
script_scroll_states.push((UntrustedNodeAddress::from_id(0), offset))
} else if !new_scroll_state.scroll_root_id.is_special() &&
new_scroll_state.scroll_root_id.fragment_type() == FragmentType::FragmentBody {
let id = new_scroll_state.scroll_root_id.id();
script_scroll_states.push((UntrustedNodeAddress::from_id(id), offset))
}
}
let _ = self.script_chan
.send(ConstellationControlMsg::SetScrollState(self.id, script_scroll_states));
rw_data.stacking_context_scroll_offsets = layout_scroll_states
}
fn tick_all_animations<'a, 'b>(&mut self, possibly_locked_rw_data: &mut RwData<'a, 'b>) {
let mut rw_data = possibly_locked_rw_data.lock();
self.tick_animations(&mut rw_data);
}
fn tick_animations(&mut self, rw_data: &mut LayoutThreadData) {
if opts::get().relayout_event {
println!("**** pipeline={}\tForDisplay\tSpecial\tAnimationTick", self.id);
}
if let Some(mut root_flow) = self.root_flow.clone() {
let reflow_info = Reflow {
goal: ReflowGoal::ForDisplay,
page_clip_rect: max_rect(),
};
// Unwrap here should not panic since self.root_flow is only ever set to Some(_)
// in handle_reflow() where self.document_shared_lock is as well.
let author_shared_lock = self.document_shared_lock.clone().unwrap();
let author_guard = author_shared_lock.read();
let ua_or_user_guard = UA_STYLESHEETS.shared_lock.read();
let guards = StylesheetGuards {
author: &author_guard,
ua_or_user: &ua_or_user_guard,
};
let mut layout_context = self.build_layout_context(guards, &*rw_data, false);
{
// Perform an abbreviated style recalc that operates without access to the DOM.
let animations = self.running_animations.read();
profile(time::ProfilerCategory::LayoutStyleRecalc,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
|| {
animation::recalc_style_for_animations(
&layout_context, FlowRef::deref_mut(&mut root_flow), &animations)
});
}
self.perform_post_style_recalc_layout_passes(&mut root_flow,
&reflow_info,
None,
None,
&mut *rw_data,
&mut layout_context);
assert!(layout_context.pending_images.is_none());
}
}
fn perform_post_style_recalc_layout_passes(&mut self,
root_flow: &mut FlowRef,
data: &Reflow,
query_type: Option<&ReflowQueryType>,
document: Option<&ServoLayoutDocument>,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
rw_data: &mut LayoutThreadData,
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
context: &mut LayoutContext) {
// Kick off animations if any were triggered, expire completed ones.
animation::update_animation_state(&self.constellation_chan,
&self.script_chan,
&mut *self.running_animations.write(),
&mut *self.expired_animations.write(),
&self.new_animations_receiver,
self.id,
&self.timer);
profile(time::ProfilerCategory::LayoutRestyleDamagePropagation,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
|| {
// Call `compute_layout_damage` even in non-incremental mode, because it sets flags
// that are needed in both incremental and non-incremental traversals.
let damage = FlowRef::deref_mut(root_flow).compute_layout_damage();
if opts::get().nonincremental_layout || damage.contains(REFLOW_ENTIRE_DOCUMENT) {
FlowRef::deref_mut(root_flow).reflow_entire_document()
}
});
if opts::get().trace_layout {
layout_debug::begin_trace(root_flow.clone());
}
// Resolve generated content.
profile(time::ProfilerCategory::LayoutGeneratedContent,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
|| sequential::resolve_generated_content(FlowRef::deref_mut(root_flow), &context));
// Guess float placement.
profile(time::ProfilerCategory::LayoutFloatPlacementSpeculation,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
|| sequential::guess_float_placement(FlowRef::deref_mut(root_flow)));
// Perform the primary layout passes over the flow tree to compute the locations of all
// the boxes.
if flow::base(&**root_flow).restyle_damage.intersects(REFLOW | REFLOW_OUT_OF_FLOW) {
profile(time::ProfilerCategory::LayoutMain,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
|| {
let profiler_metadata = self.profiler_metadata();
if let (true, Some(traversal)) = (self.parallel_flag, self.parallel_traversal.as_mut()) {
// Parallel mode.
LayoutThread::solve_constraints_parallel(traversal,
FlowRef::deref_mut(root_flow),
profiler_metadata,
self.time_profiler_chan.clone(),
&*context);
} else {
//Sequential mode
LayoutThread::solve_constraints(FlowRef::deref_mut(root_flow), &context)
}
});
}
profile(time::ProfilerCategory::LayoutStoreOverflow,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
|| {
sequential::store_overflow(context,
FlowRef::deref_mut(root_flow) as &mut Flow);
});
self.perform_post_main_layout_passes(data,
query_type,
document,
rw_data,
context);
}
fn perform_post_main_layout_passes(&mut self,
data: &Reflow,
query_type: Option<&ReflowQueryType>,
document: Option<&ServoLayoutDocument>,
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
rw_data: &mut LayoutThreadData,
servo: Merge #15417 - layout: Remove cached thread local context from LayoutContext, and use LayoutContext for assign_inline_sizes() (from stshine:column-flexbox); r=emilio <!-- Please describe your changes on the following line: --> According to https://github.com/servo/servo/pull/3069 the cached thread local context is introduced for green threads. Now green threads has gone, and the existence of cache force us to create a `LayoutContext`, an `AssignISizes` and an `AssignBSizes` for each flow during parallel layout, so the pull request tries to remove it. And it also switch `assign_inline_sizes()` to accept a `LayoutContext` parameter, as according to my current design we need to do full layout to some flex items for column flexbox during assign isize traversal. Part of #14123. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: e2b494b1d08b8929ca7e5ae369304f41af81ace2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9cd92ed44acfaa3b2ba04e345b33d21aff3d752c
2017-02-08 04:16:05 +03:00
layout_context: &mut LayoutContext) {
// Build the display list if necessary, and send it to the painter.
if let Some(mut root_flow) = self.root_flow.clone() {
self.compute_abs_pos_and_build_display_list(data,
query_type,
document,
FlowRef::deref_mut(&mut root_flow),
&mut *layout_context,
rw_data);
self.first_reflow = false;
if opts::get().trace_layout {
layout_debug::end_trace(self.generation);
}
if opts::get().dump_flow_tree {
root_flow.print("Post layout flow tree".to_owned());
}
self.generation += 1;
}
}
fn reflow_all_nodes(flow: &mut Flow) {
debug!("reflowing all nodes!");
flow::mut_base(flow)
.restyle_damage
.insert(REPAINT | STORE_OVERFLOW | REFLOW | REPOSITION);
for child in flow::child_iter_mut(flow) {
servo: Merge #9201 - task -> thread (from ajnirp:8512-task-thread); r=jdm for #8512 Source-Repo: https://github.com/servo/servo Source-Revision: d3e2f94f2024f4735f836588ed11303a0abafdf8 --HG-- rename : servo/components/canvas/canvas_paint_task.rs => servo/components/canvas/canvas_paint_thread.rs rename : servo/components/canvas/webgl_paint_task.rs => servo/components/canvas/webgl_paint_thread.rs rename : servo/components/compositing/compositor_task.rs => servo/components/compositing/compositor_thread.rs rename : servo/components/gfx/font_cache_task.rs => servo/components/gfx/font_cache_thread.rs rename : servo/components/gfx/paint_task.rs => servo/components/gfx/paint_thread.rs rename : servo/components/layout/layout_task.rs => servo/components/layout/layout_thread.rs rename : servo/components/net/image_cache_task.rs => servo/components/net/image_cache_thread.rs rename : servo/components/net/resource_task.rs => servo/components/net/resource_thread.rs rename : servo/components/net/storage_task.rs => servo/components/net/storage_thread.rs rename : servo/components/net_traits/image_cache_task.rs => servo/components/net_traits/image_cache_thread.rs rename : servo/components/net_traits/storage_task.rs => servo/components/net_traits/storage_thread.rs rename : servo/components/script/script_task.rs => servo/components/script/script_thread.rs rename : servo/components/util/task.rs => servo/components/util/thread.rs rename : servo/tests/unit/gfx/font_cache_task.rs => servo/tests/unit/gfx/font_cache_thread.rs rename : servo/tests/unit/net/resource_task.rs => servo/tests/unit/net/resource_thread.rs rename : servo/tests/unit/util/task.rs => servo/tests/unit/util/thread.rs
2016-01-10 13:19:04 +03:00
LayoutThread::reflow_all_nodes(child);
}
}
/// Returns profiling information which is passed to the time profiler.
fn profiler_metadata(&self) -> Option<TimerMetadata> {
Some(TimerMetadata {
url: self.url.to_string(),
iframe: if self.is_iframe {
TimerMetadataFrameType::IFrame
} else {
TimerMetadataFrameType::RootWindow
},
incremental: if self.first_reflow {
TimerMetadataReflowType::FirstReflow
} else {
TimerMetadataReflowType::Incremental
},
})
}
}
// The default computed value for background-color is transparent (see
// http://dev.w3.org/csswg/css-backgrounds/#background-color). However, we
// need to propagate the background color from the root HTML/Body
// element (http://dev.w3.org/csswg/css-backgrounds/#special-backgrounds) if
// it is non-transparent. The phrase in the spec "If the canvas background
// is not opaque, what shows through is UA-dependent." is handled by rust-layers
// clearing the frame buffer to white. This ensures that setting a background
// color on an iframe element, while the iframe content itself has a default
// transparent background color is handled correctly.
fn get_root_flow_background_color(flow: &mut Flow) -> webrender_traits::ColorF {
let transparent = webrender_traits::ColorF { r: 0.0, g: 0.0, b: 0.0, a: 0.0 };
if !flow.is_block_like() {
return transparent;
}
let block_flow = flow.as_mut_block();
let kid = match block_flow.base.children.iter_mut().next() {
None => return transparent,
Some(kid) => kid,
};
if !kid.is_block_like() {
return transparent;
}
let kid_block_flow = kid.as_block();
kid_block_flow.fragment
.style
.resolve_color(kid_block_flow.fragment.style.get_background().background_color)
.to_gfx_color()
}
fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
fn parse_ua_stylesheet(shared_lock: &SharedRwLock, filename: &'static str)
-> Result<Stylesheet, &'static str> {
let res = try!(read_resource_file(filename).map_err(|_| filename));
Ok(Stylesheet::from_bytes(
&res,
ServoUrl::parse(&format!("chrome://resources/{:?}", filename)).unwrap(),
None,
None,
Origin::UserAgent,
MediaList::empty(),
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
shared_lock.clone(),
None,
&StdoutErrorReporter))
}
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
let shared_lock = SharedRwLock::new();
let mut user_or_user_agent_stylesheets = vec!();
// FIXME: presentational-hints.css should be at author origin with zero specificity.
// (Does it make a difference?)
for &filename in &["user-agent.css", "servo.css", "presentational-hints.css"] {
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
user_or_user_agent_stylesheets.push(try!(parse_ua_stylesheet(&shared_lock, filename)));
}
for &(ref contents, ref url) in &opts::get().user_stylesheets {
user_or_user_agent_stylesheets.push(Stylesheet::from_bytes(
&contents, url.clone(), None, None, Origin::User, MediaList::empty(),
shared_lock.clone(), None, &StdoutErrorReporter));
}
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
let quirks_mode_stylesheet = try!(parse_ua_stylesheet(&shared_lock, "quirks-mode.css"));
Ok(UserAgentStylesheets {
servo: Merge #16014 - Per-process lock for CSSOM objects (from servo:style-ref); r=emilio <!-- Please describe your changes on the following line: --> Before this PR, every object reflected in CSSOM is in `Arc<RwLock<_>>` to enable safe (synchronized) mutable aliasing. Acquiring all these locks has significant cost during selector matching: * https://bugzilla.mozilla.org/show_bug.cgi?id=1311469 * https://bugzilla.mozilla.org/show_bug.cgi?id=1335941 * https://bugzilla.mozilla.org/show_bug.cgi?id=1339703 This PR introduce a mechanism to protect many objects with the same `RwLock` that only needs to be acquired once. In Stylo, there is one such lock per process (in a `lazy_static`), used for everything. I non-Stylo Servo, I originally intended to have one such lock per document (for author-origin stylesheets, and one per process for user-agent and user sytlesheets since they’re shared across documents, and never mutated anyway). However I failed to have the same document-specific (or pipeline-specific) `Arc` reachable from both `Document` nodes and `LayoutThread`. Recursively following callers lead me to include this `Arc` in `UnprivilegedPipelineContent`, but that needs to be serializable. So there is a second process-wide lock. This was previously #15998, closed accidentally. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: bb54f0a429de0e8b8861f8071b6cf82f73622664 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 851230e57ac8775707df5f0f103be5feac81fc41
2017-03-20 00:31:19 +03:00
shared_lock: shared_lock,
user_or_user_agent_stylesheets: user_or_user_agent_stylesheets,
quirks_mode_stylesheet: quirks_mode_stylesheet,
})
}
/// Returns true if the given reflow query type needs a full, up-to-date display list to be present
/// or false if it only needs stacking-relative positions.
fn reflow_query_type_needs_display_list(query_type: &ReflowQueryType) -> bool {
match *query_type {
ReflowQueryType::HitTestQuery(..) | ReflowQueryType::TextIndexQuery(..) |
ReflowQueryType::NodesFromPoint(..) => true,
ReflowQueryType::ContentBoxQuery(_) | ReflowQueryType::ContentBoxesQuery(_) |
ReflowQueryType::NodeGeometryQuery(_) | ReflowQueryType::NodeScrollGeometryQuery(_) |
ReflowQueryType::NodeOverflowQuery(_) | ReflowQueryType::NodeScrollRootIdQuery(_) |
ReflowQueryType::ResolvedStyleQuery(..) | ReflowQueryType::OffsetParentQuery(_) |
ReflowQueryType::MarginStyleQuery(_) | ReflowQueryType::NoQuery => false,
}
}
lazy_static! {
static ref UA_STYLESHEETS: UserAgentStylesheets = {
match get_ua_stylesheets() {
Ok(stylesheets) => stylesheets,
Err(filename) => {
error!("Failed to load UA stylesheet {}!", filename);
process::exit(1);
}
}
};
}