Avoid string/vector copies in /net.
The CL from which this is split did the following: -- Avoid creating temporaries when rvalues are sufficient. -- Move where possible. -- Use const-ref variables where possible. -- Pass values and move in constructor where helpful. -- Remove stray consts which would block moves. This CL was uploaded by git cl split. R=ricea@chromium.org Bug: 377242769 Change-Id: I668d0787198bed6c246184a02ce3a6ff793a479b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5989292 Reviewed-by: Adam Rice <ricea@chromium.org> Auto-Submit: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org> Cr-Commit-Position: refs/heads/main@{#1378531}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
23d74e0e98
commit
a1085c42a4
@ -538,8 +538,7 @@ void ReportingCacheImpl::RemoveClient(
|
||||
|
||||
void ReportingCacheImpl::RemoveClientsForOrigin(const url::Origin& origin) {
|
||||
ConsistencyCheckClients();
|
||||
std::string domain = origin.host();
|
||||
const auto domain_range = clients_.equal_range(domain);
|
||||
const auto domain_range = clients_.equal_range(origin.host());
|
||||
ClientMap::iterator it = domain_range.first;
|
||||
while (it != domain_range.second) {
|
||||
if (it->second.origin == origin) {
|
||||
@ -989,7 +988,7 @@ void ReportingCacheImpl::SetEndpointForTesting(
|
||||
DCHECK(group_key.origin.has_value());
|
||||
Client new_client(group_key.network_anonymization_key,
|
||||
group_key.origin.value());
|
||||
std::string domain = group_key.origin.value().host();
|
||||
const std::string& domain = group_key.origin.value().host();
|
||||
client_it = clients_.emplace(domain, std::move(new_client));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user