Commit ca3f4879 authored by alph's avatar alph Committed by Commit bot

[runtime stats] Fix crash after r41001

The timer can be missing in the timers stack when RCS is started dynamically.

BUG=chromium:665659
TBR=cbruni@chromium.org

Review-Url: https://codereview.chromium.org/2505813002
Cr-Commit-Position: refs/heads/master@{#41049}
parent 006041e8
......@@ -313,7 +313,7 @@ const RuntimeCallStats::CounterId RuntimeCallStats::counters[] = {
void RuntimeCallStats::Enter(RuntimeCallStats* stats, RuntimeCallTimer* timer,
CounterId counter_id) {
RuntimeCallCounter* counter = &(stats->*counter_id);
DCHECK(counter->name != NULL);
DCHECK(counter->name != nullptr);
timer->Start(counter, stats->current_timer_.Value());
stats->current_timer_.SetValue(timer);
}
......@@ -327,7 +327,8 @@ void RuntimeCallStats::Leave(RuntimeCallStats* stats, RuntimeCallTimer* timer) {
// buried one that's leaving. We don't care about keeping nested timings
// accurate, just avoid crashing by keeping the chain intact.
RuntimeCallTimer* next = stats->current_timer_.Value();
while (next->parent() != timer) next = next->parent();
while (next && next->parent() != timer) next = next->parent();
if (next == nullptr) return;
next->parent_.SetValue(timer->Stop());
}
}
......
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