Commit 9625f0fb authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[layoutng] Use emplace instead of operator= to assign to base::Optional

It's more efficient (avoids a copy), as confirmed by inspecting the
generated assembly.

R=eae@chromium.org,ikilpatrick@chromium.org

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I55a0d9edded65545b2e7404e941f776a3e9978da
Reviewed-on: https://chromium-review.googlesource.com/1226306
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591425}
parent 90c99b1f
...@@ -288,7 +288,7 @@ void NGExclusionSpaceInternal::DerivedGeometry::Add( ...@@ -288,7 +288,7 @@ void NGExclusionSpaceInternal::DerivedGeometry::Add(
// the shelf if we need to insert a new shelf later in the loop. // the shelf if we need to insert a new shelf later in the loop.
base::Optional<NGShelf> shelf_copy; base::Optional<NGShelf> shelf_copy;
if (is_between_shelves) if (is_between_shelves)
shelf_copy = shelves_[i]; shelf_copy.emplace(shelves_[i]);
// A new scope is created as shelf may be removed. // A new scope is created as shelf may be removed.
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment