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

Unified Diff: cc/scheduler/begin_frame_source.cc

Issue 2706493002: Check for BeginFrame time/seqnum continuity in ExternalBFS::OnBF. (Closed)
Patch Set: Use const ref. Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/begin_frame_source.cc
diff --git a/cc/scheduler/begin_frame_source.cc b/cc/scheduler/begin_frame_source.cc
index e8cda0e1728752da6ce82c320ff073f65fc84310..a5aa4bd55c83f6541f540f0910349805a42c2748 100644
--- a/cc/scheduler/begin_frame_source.cc
+++ b/cc/scheduler/begin_frame_source.cc
@@ -261,7 +261,7 @@ void ExternalBeginFrameSource::AddObserver(BeginFrameObserver* obs) {
// Send a MISSED begin frame if necessary.
if (missed_begin_frame_args_.IsValid()) {
- BeginFrameArgs last_args = obs->LastUsedBeginFrameArgs();
+ const BeginFrameArgs& last_args = obs->LastUsedBeginFrameArgs();
if (!last_args.IsValid() ||
(missed_begin_frame_args_.frame_time > last_args.frame_time)) {
DCHECK((missed_begin_frame_args_.source_id != last_args.source_id) ||
@@ -302,8 +302,19 @@ void ExternalBeginFrameSource::OnBeginFrame(const BeginFrameArgs& args) {
missed_begin_frame_args_ = args;
missed_begin_frame_args_.type = BeginFrameArgs::MISSED;
std::unordered_set<BeginFrameObserver*> observers(observers_);
- for (auto* obs : observers)
- obs->OnBeginFrame(args);
+ for (auto* obs : observers) {
+ // It is possible that the source in which |args| originate changes, or that
+ // our hookup to this source changes, so we have to check for continuity.
+ // See also https://crbug.com/690127 for what may happen without this check.
+ const BeginFrameArgs& last_args = obs->LastUsedBeginFrameArgs();
+ if (!last_args.IsValid() || (args.frame_time > last_args.frame_time)) {
+ DCHECK((args.source_id != last_args.source_id) ||
+ (args.sequence_number > last_args.sequence_number))
+ << "current " << args.AsValue()->ToString() << ", last "
+ << last_args.AsValue()->ToString();
+ obs->OnBeginFrame(args);
+ }
+ }
}
} // namespace cc
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698