Bug 1476368 - Pre-allocate primitives vector in setup_picture_caching. r=gw

--HG--
extra : source : 32aa85626f6c484dff616ec9ae78ca53ea38dec5
extra : histedit_source : 109a92a512932d686f31906c37392f5f55db18e8
This commit is contained in:
Nicolas Silva 2019-02-20 10:01:28 +01:00
Родитель b6c94f1ece
Коммит 859c756fae
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -312,10 +312,7 @@ impl<'a> DisplayListFlattener<'a> {
};
// Get the list of existing primitives in the main stacking context.
let mut old_prim_list = mem::replace(
primitives,
Vec::new(),
);
let mut old_prim_list = primitives.take();
// In the simple case, there are no preceding or trailing primitives,
// because everything is anchored to the root scroll node. Handle
@ -409,6 +406,7 @@ impl<'a> DisplayListFlattener<'a> {
// This contains the tile caching picture, with preceding and
// trailing primitives outside the main scroll root.
primitives.reserve(preceding_prims.len() + trailing_prims.len() + 1);
primitives.extend(preceding_prims);
primitives.push(instance);
primitives.extend(trailing_prims);