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

Add DCHECK in InsertPerformanceEntry

There is a reported crash in cases where InsertPerformanceEntry is
called, so add a DCHECK to make debugging easier and determine whether
this is indeed the problem or if it's something else. Also cleanup the
method.

Bug: 1141666
Change-Id: I9d15ff62255b4830ce7abf9fd7569b15195b6524
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495343Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821396}
parent f1225166
......@@ -35,23 +35,24 @@
namespace blink {
UserTiming::UserTiming(Performance& performance) : performance_(&performance) {}
namespace {
static void InsertPerformanceEntry(PerformanceEntryMap& performance_entry_map,
PerformanceEntry& entry) {
void InsertPerformanceEntry(PerformanceEntryMap& performance_entry_map,
PerformanceEntry& entry) {
PerformanceEntryMap::iterator it = performance_entry_map.find(entry.name());
if (it != performance_entry_map.end()) {
it->value->push_back(&entry);
DCHECK(it->value);
it->value->push_back(entry);
} else {
PerformanceEntryVector* vector =
MakeGarbageCollected<PerformanceEntryVector>(1);
(*vector)[0] = Member<PerformanceEntry>(entry);
MakeGarbageCollected<PerformanceEntryVector>();
vector->push_back(entry);
performance_entry_map.Set(entry.name(), vector);
}
}
static void ClearPeformanceEntries(PerformanceEntryMap& performance_entry_map,
const AtomicString& name) {
void ClearPeformanceEntries(PerformanceEntryMap& performance_entry_map,
const AtomicString& name) {
if (name.IsNull()) {
performance_entry_map.clear();
return;
......@@ -61,6 +62,10 @@ static void ClearPeformanceEntries(PerformanceEntryMap& performance_entry_map,
performance_entry_map.erase(name);
}
} // namespace
UserTiming::UserTiming(Performance& performance) : performance_(&performance) {}
void UserTiming::AddMarkToPerformanceTimeline(PerformanceMark& mark) {
if (performance_->timing()) {
TRACE_EVENT_COPY_MARK1("blink.user_timing", mark.name().Utf8().c_str(),
......
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