Commit 40cd7e23 authored by Mike Wittman's avatar Mike Wittman Committed by Commit Bot

Emplace ContentSettingPatternSource to avoid unnecessary Value clone

Pushing back ContentSettingPatternSource by value results in a copy and
assignment, causing an unnecessary clone of the contained Value. This
results in a small (5ms) but avoidable cost at startup. Observed in the
execution profiles at:
https://uma.googleplex.com/p/chrome/callstacks?sid=e6d04c6a58a9d19cff68156c450453bf

Change-Id: I8c4bf641414438ea3c365cab12642ea1b1a0062e
Reviewed-on: https://chromium-review.googlesource.com/1033832
Commit-Queue: Mike Wittman <wittman@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554773}
parent 07dfbf2e
......@@ -696,9 +696,9 @@ void HostContentSettingsMap::AddSettingsForOneType(
while (rule_iterator->HasNext()) {
const content_settings::Rule& rule = rule_iterator->Next();
settings->push_back(ContentSettingPatternSource(
settings->emplace_back(
rule.primary_pattern, rule.secondary_pattern, rule.value->Clone(),
kProviderNamesSourceMap[provider_type].provider_name, incognito));
kProviderNamesSourceMap[provider_type].provider_name, incognito);
}
}
......
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