layout: Enforce that flow construction is thread-safe.

Closes #1584.
auto merge of #1605 : pcwalton/servo/harden-layout-more, r=metajack

Closes #1584.

r? @metajack