Chromium Code Reviews

Unified Diff: src/counters.cc

Issue 2484963002: [runtime stats] Fix crash when RCS are enabled dynamically. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters.cc
diff --git a/src/counters.cc b/src/counters.cc
index d8061f5f3341a2917480713596c6c536f1e8d77e..6e7c1cb90c740ca7ebc5ef45c63a5db267ecbabc 100644
--- a/src/counters.cc
+++ b/src/counters.cc
@@ -309,9 +309,10 @@ void RuntimeCallStats::Leave(RuntimeCallStats* stats, RuntimeCallTimer* timer) {
// static
void RuntimeCallStats::CorrectCurrentCounterId(RuntimeCallStats* stats,
CounterId counter_id) {
- DCHECK_NOT_NULL(stats->current_timer_.Value());
- RuntimeCallCounter* counter = &(stats->*counter_id);
- stats->current_timer_.Value()->counter_ = counter;
+ RuntimeCallTimer* timer = stats->current_timer_.Value();
+ // When RCS are enabled dynamically there might be no current timer set up.
+ if (timer == nullptr) return;
+ timer->counter_ = &(stats->*counter_id);
}
void RuntimeCallStats::Print(std::ostream& os) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine