Chromium Code Reviews| 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..77a6bb925daa7365ec8a3207a30c1bdbb17a9764 100644 |
| --- a/cc/scheduler/begin_frame_source.cc |
| +++ b/cc/scheduler/begin_frame_source.cc |
| @@ -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. |
| + BeginFrameArgs last_args = obs->LastUsedBeginFrameArgs(); |
|
brianderson
2017/02/17 20:29:09
const ref
Eric Seckler
2017/02/17 22:38:39
done, also above.
|
| + 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 |