Commit d1ebe528 authored by Daniel Cheng's avatar Daniel Cheng Committed by Commit Bot

Fix undefined sequencing in trace_log.cc

Prior to C++17, it's not defined if the LHS or RHS of an assignment
is evaluated first: the only that's defined is the evaluation of the
LHS and RHS happen before the assignment.

Bug: 805881
Change-Id: Ieece0dd53f174d82a8e32ff41418e894f0c27ddd
Reviewed-on: https://chromium-review.googlesource.com/899948Reviewed-by: default avataroysteine <oysteine@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534205}
parent 428f6f6c
...@@ -1346,8 +1346,10 @@ std::string TraceLog::EventToConsoleMessage(unsigned char phase, ...@@ -1346,8 +1346,10 @@ std::string TraceLog::EventToConsoleMessage(unsigned char phase,
} }
std::string thread_name = thread_names_[thread_id]; std::string thread_name = thread_names_[thread_id];
if (thread_colors_.find(thread_name) == thread_colors_.end()) if (thread_colors_.find(thread_name) == thread_colors_.end()) {
thread_colors_[thread_name] = (thread_colors_.size() % 6) + 1; size_t next_color = (thread_colors_.size() % 6) + 1;
thread_colors_[thread_name] = next_color;
}
std::ostringstream log; std::ostringstream log;
log << base::StringPrintf("%s: \x1b[0;3%dm", thread_name.c_str(), log << base::StringPrintf("%s: \x1b[0;3%dm", thread_name.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