servo/components/layout
bors-servo 2eb122f394 Auto merge of #6586 - pcwalton:resource-task-ipc, r=jdm
script: Make the resource task communication use IPC channels.

This change makes Servo use serialized messages over IPC channels for resource loading. The goal is to make it easier to make Servo multiprocess in the future. This patch does not make Servo multiprocess now; there are many other channels that need to be changed to IPC before that can happen. It does introduce a dependency on https://github.com/serde-rs/serde and https://github.com/pcwalton/ipc-channel for the first time.

At the moment, `ipc-channel` uses JSON for serialization. This is because serde does not yet have official support for bincode. When serde gains support for bincode, I'll switch to that. For now, however, the JSON encoding and decoding will constitute a significant performance regression in resource loading.

To avoid having to send boxed `AsyncResponseTarget` trait objects across process boundaries, this series of commits changes `AsyncResponseTarget` to wrap a sender only. It is then the client's responsibility to spawn a thread to proxy calls from that sender to the consumer of the resource data. This only had to be done in a few places. In the future, we may want to collapse those threads into one per process to reduce overhead. (It is impossible to continue to use `AsyncResponseTarget` as a boxed trait object across processes, regardless of how much work is done on `ipc-channel`. Vtables are fundamentally incompatible with IPC across mutually untrusting processes.)

In general, I was pretty pleased with how this turned out. The main changes are adding serialization functionality to various objects that `serde` does not know how to serialize natively—the most complicated being Hyper objects—and reworking `AsyncResponseTarget`. The overall structure of the code is unchanged, and other than `AsyncResponseTarget` no functionality was lost in moving to serialization and IPC.

r? @jdm

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6586)
<!-- Reviewable:end -->
2015-07-31 16:06:36 -06:00
..
css Replace the StyledNode trait with inherent methods. 2015-07-27 19:57:33 +02:00
animation.rs Upgrade to rustc 1.3.0-dev (f3b97a74a 2015-07-03) 2015-07-04 11:32:41 +02:00
block.rs Implement getComputedStyle 2015-07-29 20:17:50 -04:00
Cargo.toml script: Make the resource task communication use IPC channels. 2015-07-31 11:28:09 -07:00
construct.rs Implement getComputedStyle 2015-07-29 20:17:50 -04:00
context.rs script: Make the ImageCacheTask use IPC. 2015-07-26 23:07:44 -07:00
data.rs Remove LayoutChan from LayoutDataWrapper 2015-07-04 03:54:40 -04:00
display_list_builder.rs Implement getComputedStyle 2015-07-29 20:17:50 -04:00
floats.rs Positioning fixes for RTL floats 2015-05-18 17:25:06 -07:00
flow.rs Fix panic when html element has display: table. 2015-07-31 16:40:06 +10:00
flow_list.rs Use usize in flow_list. 2015-03-29 12:43:44 +02:00
flow_ref.rs Remove Deref and DerefMut implementations from WeakFlowRef. 2015-06-27 18:09:14 +02:00
fragment.rs Use local slice_chars 2015-07-31 12:23:13 -06:00
generated_content.rs Fix #6680 2015-07-22 16:45:43 +03:00
incremental.rs Move to latest hyper everywhere 2015-06-02 20:12:14 +05:30
inline.rs Use local slice_chars 2015-07-31 12:23:13 -06:00
layout_debug.rs Change not(ndebug) to debug_assertions 2015-06-01 13:48:38 -07:00
layout_task.rs script: Make the resource task communication use IPC channels. 2015-07-31 11:28:09 -07:00
lib.rs Use local slice_chars 2015-07-31 12:23:13 -06:00
list_item.rs Fix panic when html element has display: table. 2015-07-31 16:40:06 +10:00
model.rs Change transforms to use LengthOrPercentage. 2015-07-28 09:42:05 +10:00
multicol.rs Fix panic when html element has display: table. 2015-07-31 16:40:06 +10:00
opaque_node.rs Replace OpaqueNodeMethods::from_{threadsafe_,}layout_node by opaque methods. 2015-06-24 14:55:43 +02:00
parallel.rs Remove unused implementation of ParallelPostorderFlowTraversal for BubbleISizes. 2015-07-23 19:30:43 +02:00
sequential.rs Move the traversal traits into the traversal module. 2015-07-17 11:40:40 +02:00
table.rs Fix panic when html element has display: table. 2015-07-31 16:40:06 +10:00
table_caption.rs Use euclid from crates.io 2015-06-19 00:04:24 +02:00
table_cell.rs Replace the StyledNode trait with inherent methods. 2015-07-27 19:57:33 +02:00
table_colgroup.rs Replace the StyledNode trait with inherent methods. 2015-07-27 19:57:33 +02:00
table_row.rs Use euclid from crates.io 2015-06-19 00:04:24 +02:00
table_rowgroup.rs Use euclid from crates.io 2015-06-19 00:04:24 +02:00
table_wrapper.rs Fix panic when html element has display: table. 2015-07-31 16:40:06 +10:00
text.rs Implement getComputedStyle 2015-07-29 20:17:50 -04:00
traversal.rs Replace the StyledNode trait with inherent methods. 2015-07-27 19:57:33 +02:00
wrapper.rs Inline ThreadSafeLayoutNode::get_style. 2015-07-27 19:57:38 +02:00