Adding back-off instead of busy-spinning

Also changed the total number of spinning similar to Cilk
Addressed code review comments.
auto merge of #3820 : cgaebel/servo/rebase-lalehs-patch, r=pcwalton

I addressed all but one of the code review comments, which was a request
for documentation on where a number came from (which I'm not qualified to
answer), and rebased this on to latest master.

xref: #3505 cc: @LalehB @larsbergstrom

r? @pcwalton
If opts is retrieved, but not set by platform layer, return a default set.

This is required for unit tests like the image cache task, which can
pass through code paths that query the command line options.
Make compositor event handling a Layer trait

This simplifies the way that event handling interacts with the
compositor.
Combine events and CompositorData methods into CompositorLayer

This is a more natural collection of methods, as they all operate
directly on layers and accept a layer as their first argument.
Move compositor_data.rs to compositor_layer.rs.

The new name better reflects the majority of the code in the file.
auto merge of #3819 : mrobinson/servo/clean-up-events, r=pcwalton

There are many function and methods that operate on a single layer, that can really just be methods on a CompositorLayer trait. This greatly simplifies the way that Compositor interacts with its child layers. This PR is just code motion.
Layout: Fix resize (which just plain doesn't work right now).

Currently, both restyle/flow construction _and_ reflow are skipped
during resize. Reflow should not be in that list. This patch fixes
that.
Run all task spawning through util, to allow for easy hooking.

During debugging, I found it useful to hook all task creation in a
central location, and util::task was the perfect place for it.

r? @pcwalton (or maybe someone else, I'm kinda sending you a bunch of
reviews today because I don't know who better to give them to)
make naming more consistent
layout: Implement flow tree dumping with RUST_LOG=debug is on.

r? @pcwalton
util: Primarily fixes a bug where SmallVec.into_iter just doesn't work.

into_iter used to use `inline_size` as the capacity insetad of the actual
capacity. This patch fixes that, adds some utility methods to `SmallVec`
to bring it closer in functionality to `Vec`, and removes the obsolete
`owns_managed` calls.
auto merge of #3827 : cgaebel/servo/use-custom-spawn, r=pcwalton

During debugging, I found it useful to hook all task creation in a
central location, and util::task was the perfect place for it.

r? @pcwalton (or maybe someone else, I'm kinda sending you a bunch of
reviews today because I don't know who better to give them to)
use println instead of error
combine conditions
remove warning
use size hints
util: Add a method to push all elements from another doubly-linked list
without any moves.

This is tracked upstream as Rust bug #18402.
gfx: Inline a few commonly-used methods that were showing up in profiles