OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/scheduler/begin_frame_source.h" | 5 #include "cc/scheduler/begin_frame_source.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 | 291 |
292 void ExternalBeginFrameSource::OnSetBeginFrameSourcePaused(bool paused) { | 292 void ExternalBeginFrameSource::OnSetBeginFrameSourcePaused(bool paused) { |
293 if (paused_ == paused) | 293 if (paused_ == paused) |
294 return; | 294 return; |
295 paused_ = paused; | 295 paused_ = paused; |
296 std::unordered_set<BeginFrameObserver*> observers(observers_); | 296 std::unordered_set<BeginFrameObserver*> observers(observers_); |
297 for (auto* obs : observers) | 297 for (auto* obs : observers) |
298 obs->OnBeginFrameSourcePausedChanged(paused_); | 298 obs->OnBeginFrameSourcePausedChanged(paused_); |
299 } | 299 } |
300 | 300 |
301 void ExternalBeginFrameSource::OnBeginFrame(const BeginFrameArgs& args) { | 301 void ExternalBeginFrameSource::OnBeginFrame(const BeginFrameArgs& args) { |
brianderson
2017/02/17 20:29:09
I didn't catch this in the source_id patch you lan
Eric Seckler
2017/02/17 22:38:39
I don't think that makes sense. BeginFrame creator
brianderson
2017/02/17 22:47:19
My thinking was that it's a little weird for this
| |
302 missed_begin_frame_args_ = args; | 302 missed_begin_frame_args_ = args; |
303 missed_begin_frame_args_.type = BeginFrameArgs::MISSED; | 303 missed_begin_frame_args_.type = BeginFrameArgs::MISSED; |
304 std::unordered_set<BeginFrameObserver*> observers(observers_); | 304 std::unordered_set<BeginFrameObserver*> observers(observers_); |
305 for (auto* obs : observers) | 305 for (auto* obs : observers) { |
306 obs->OnBeginFrame(args); | 306 // It is possible that the source in which |args| originate changes, or that |
307 // our hookup to this source changes, so we have to check for continuity. | |
308 // See also https://crbug.com/690127 for what may happen without this check. | |
309 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.
| |
310 if (!last_args.IsValid() || (args.frame_time > last_args.frame_time)) { | |
311 DCHECK((args.source_id != last_args.source_id) || | |
312 (args.sequence_number > last_args.sequence_number)) | |
313 << "current " << args.AsValue()->ToString() << ", last " | |
314 << last_args.AsValue()->ToString(); | |
315 obs->OnBeginFrame(args); | |
316 } | |
317 } | |
307 } | 318 } |
308 | 319 |
309 } // namespace cc | 320 } // namespace cc |
OLD | NEW |