Commit a706dc90 authored by Nicolás Peña Moreno's avatar Nicolás Peña Moreno Committed by Commit Bot

Change push_back in UserTiming internals to use pointer

Currently, InsertPerformanceEntry receives a ref PerformanceEntry as
parameter, so push_back may be creating a copy of the object. We make
sure this does not happen by passing a raw pointer to push_back so it
creates a Member out of it to retain ownership and there's no risk of
cloning the object.

Change-Id: I3315e394a30baa6cb7627f935f4b83e560fe2a5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2558739Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830762}
parent ff9fcbc6
...@@ -42,11 +42,11 @@ void InsertPerformanceEntry(PerformanceEntryMap& performance_entry_map, ...@@ -42,11 +42,11 @@ void InsertPerformanceEntry(PerformanceEntryMap& performance_entry_map,
PerformanceEntryMap::iterator it = performance_entry_map.find(entry.name()); PerformanceEntryMap::iterator it = performance_entry_map.find(entry.name());
if (it != performance_entry_map.end()) { if (it != performance_entry_map.end()) {
DCHECK(it->value); DCHECK(it->value);
it->value->push_back(entry); it->value->push_back(&entry);
} else { } else {
PerformanceEntryVector* vector = PerformanceEntryVector* vector =
MakeGarbageCollected<PerformanceEntryVector>(); MakeGarbageCollected<PerformanceEntryVector>();
vector->push_back(entry); vector->push_back(&entry);
performance_entry_map.Set(entry.name(), vector); performance_entry_map.Set(entry.name(), vector);
} }
} }
......
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