servo/components/script
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
..
dom Auto merge of #6586 - pcwalton:resource-task-ipc, r=jdm 2015-07-31 16:06:36 -06:00
parse Directly append children to output node in parse_html_fragment 2015-07-15 17:09:26 -04:00
build.rs Fix build scripts warnings. 2015-03-18 21:53:48 +01:00
Cargo.toml script: Make the resource task communication use IPC channels. 2015-07-31 11:28:09 -07:00
clipboard_provider.rs Add set_clipboard_context function and relevant plumbing. Use Option more consistantly (less unwraps) in textinput's selection handling. 2015-07-29 12:19:37 -04:00
cors.rs script: Make the resource task communication use IPC channels. 2015-07-31 11:28:09 -07:00
devtools.rs devtools: Convert the developer tools to run over IPC. 2015-07-27 09:10:01 -07:00
document_loader.rs script: Fix test failures. 2015-07-31 15:03:39 -07:00
horribly_inefficient_timers.rs Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
layout_interface.rs Implement getComputedStyle 2015-07-29 20:17:50 -04:00
lib.rs Use local slice_chars 2015-07-31 12:23:13 -06:00
makefile.cargo Don't generate pyc files. 2015-06-17 18:43:08 -06:00
network_listener.rs script: Fix test failures. 2015-07-31 15:03:39 -07:00
page.rs Make enum/fn part of unrooted_must_root handle type parameters 2015-07-22 10:44:26 +05:30
script_task.rs script: Fix test failures. 2015-07-31 15:03:39 -07:00
textinput.rs Use local slice_chars 2015-07-31 12:23:13 -06:00
timers.rs Refactor #[jstraceable] to #[derive(JSTraceable)] 2015-07-01 18:27:06 -04:00
webdriver_handlers.rs Added support for int32 to webdriver. 2015-07-24 20:23:15 -04:00