Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: ui/latency/latency_info.cc

Issue 2953073002: LatencyInfo trace_id_ no longer dependent on sequence_number. (Closed)
Patch Set: Address nit. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/latency/latency_info.h ('k') | ui/latency/latency_info_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/latency/latency_info.cc
diff --git a/ui/latency/latency_info.cc b/ui/latency/latency_info.cc
index 9427c4ccc308e9eaa71f9a60b5b5df36b69c1cd6..68523af0e1082cd3891ba8e682067b577b493804 100644
--- a/ui/latency/latency_info.cc
+++ b/ui/latency/latency_info.cc
@@ -135,6 +135,7 @@ LatencyInfo::LatencyInfo() : LatencyInfo(SourceEventType::UNKNOWN) {}
LatencyInfo::LatencyInfo(SourceEventType type)
: trace_id_(-1),
coalesced_(false),
+ began_(false),
terminated_(false),
source_event_type_(type) {}
@@ -144,6 +145,7 @@ LatencyInfo::~LatencyInfo() {}
LatencyInfo::LatencyInfo(int64_t trace_id, bool terminated)
: trace_id_(trace_id),
+ began_(false),
terminated_(terminated),
source_event_type_(SourceEventType::UNKNOWN) {}
@@ -171,6 +173,12 @@ void LatencyInfo::CopyLatencyFrom(const LatencyInfo& other,
lc.second.event_count);
}
}
+ trace_id_ = other.trace_id();
+ coalesced_ = other.coalesced();
+ // TODO(tdresser): Ideally we'd copy |began_| here as well, but |began_| isn't
+ // very intuitive, and we can actually begin multiple times across copied
+ // events.
+ terminated_ = other.terminated();
}
void LatencyInfo::AddNewLatencyFrom(const LatencyInfo& other) {
@@ -183,6 +191,12 @@ void LatencyInfo::AddNewLatencyFrom(const LatencyInfo& other) {
lc.second.event_count);
}
}
+ trace_id_ = other.trace_id();
+ coalesced_ = other.coalesced();
+ // TODO(tdresser): Ideally we'd copy |began_| here as well, but |began_| isn't
+ // very intuitive, and we can actually begin multiple times across copied
+ // events.
+ terminated_ = other.terminated();
}
void LatencyInfo::AddLatencyNumber(LatencyComponentType component,
@@ -223,8 +237,10 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl(
if (IsBeginComponent(component)) {
// Should only ever add begin component once.
- CHECK_EQ(-1, trace_id_);
- trace_id_ = component_sequence_number;
+ CHECK(!began_);
+ began_ = true;
+ // We should have a trace ID assigned by now.
+ DCHECK(trace_id_ != -1);
if (*latency_info_enabled) {
// The timestamp for ASYNC_BEGIN trace event is used for drawing the
@@ -287,7 +303,7 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl(
}
}
- if (IsTerminalComponent(component) && trace_id_ != -1) {
+ if (IsTerminalComponent(component) && began_) {
// Should only ever add terminal component once.
CHECK(!terminated_);
terminated_ = true;
« no previous file with comments | « ui/latency/latency_info.h ('k') | ui/latency/latency_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698