Auto merge of #6461 - Ms2ger:workqueuedata, r=pcwalton

Use a dedicated type for the opaque type parameter to WorkQueue in layout.

Currently, we use UnsafeFlow and UnsafeLayoutNode, both of which are aliases
for (usize, usize) and thus interconvertible. This change should make it
clearer that the WorkQueue is not limited to one particular type.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6461)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-06-26 14:10:07 -06:00
commit 07a1e187f0
2 changed files with 8 additions and 6 deletions

View file

@ -28,6 +28,8 @@ use util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
const CHUNK_SIZE: usize = 64;
pub struct WorkQueueData(usize, usize);
#[allow(dead_code)]
fn static_assertion(node: UnsafeLayoutNode) {
unsafe {
@ -443,7 +445,7 @@ fn build_display_list(unsafe_flow: UnsafeFlow,
}
fn run_queue_with_custom_work_data_type<To,F>(
queue: &mut WorkQueue<SharedLayoutContextWrapper,UnsafeLayoutNode>,
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>,
callback: F)
where To: 'static + Send, F: FnOnce(&mut WorkQueue<SharedLayoutContextWrapper,To>) {
unsafe {
@ -455,7 +457,7 @@ fn run_queue_with_custom_work_data_type<To,F>(
pub fn traverse_dom_preorder(root: LayoutNode,
shared_layout_context: &SharedLayoutContext,
queue: &mut WorkQueue<SharedLayoutContextWrapper, UnsafeLayoutNode>) {
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>) {
queue.data = SharedLayoutContextWrapper(shared_layout_context as *const _);
run_queue_with_custom_work_data_type(queue, |queue| {
@ -473,7 +475,7 @@ pub fn traverse_flow_tree_preorder(
profiler_metadata: ProfilerMetadata,
time_profiler_chan: time::ProfilerChan,
shared_layout_context: &SharedLayoutContext,
queue: &mut WorkQueue<SharedLayoutContextWrapper,UnsafeLayoutNode>) {
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>) {
if opts::get().bubble_inline_sizes_separately {
let layout_context = LayoutContext::new(shared_layout_context);
let bubble_inline_sizes = BubbleISizes { layout_context: &layout_context };
@ -500,7 +502,7 @@ pub fn build_display_list_for_subtree(
profiler_metadata: ProfilerMetadata,
time_profiler_chan: time::ProfilerChan,
shared_layout_context: &SharedLayoutContext,
queue: &mut WorkQueue<SharedLayoutContextWrapper,UnsafeLayoutNode>) {
queue: &mut WorkQueue<SharedLayoutContextWrapper, WorkQueueData>) {
queue.data = SharedLayoutContextWrapper(shared_layout_context as *const _);
run_queue_with_custom_work_data_type(queue, |queue| {