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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void BackToBackBeginFrameSource::RemoveObserver(BeginFrameObserver* obs) { | 93 void BackToBackBeginFrameSource::RemoveObserver(BeginFrameObserver* obs) { |
94 DCHECK(obs); | 94 DCHECK(obs); |
95 DCHECK(observers_.find(obs) != observers_.end()); | 95 DCHECK(observers_.find(obs) != observers_.end()); |
96 observers_.erase(obs); | 96 observers_.erase(obs); |
97 pending_begin_frame_observers_.erase(obs); | 97 pending_begin_frame_observers_.erase(obs); |
98 if (pending_begin_frame_observers_.empty()) | 98 if (pending_begin_frame_observers_.empty()) |
99 time_source_->SetActive(false); | 99 time_source_->SetActive(false); |
100 } | 100 } |
101 | 101 |
102 void BackToBackBeginFrameSource::DidFinishFrame(BeginFrameObserver* obs, | 102 void BackToBackBeginFrameSource::DidFinishFrame(BeginFrameObserver* obs, |
103 size_t remaining_frames) { | 103 const BeginFrameAck& ack) { |
104 if (remaining_frames == 0 && observers_.find(obs) != observers_.end()) { | 104 if (ack.remaining_frames == 0 && observers_.find(obs) != observers_.end()) { |
105 pending_begin_frame_observers_.insert(obs); | 105 pending_begin_frame_observers_.insert(obs); |
106 time_source_->SetActive(true); | 106 time_source_->SetActive(true); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 bool BackToBackBeginFrameSource::IsThrottled() const { | 110 bool BackToBackBeginFrameSource::IsThrottled() const { |
111 return false; | 111 return false; |
112 } | 112 } |
113 | 113 |
114 void BackToBackBeginFrameSource::OnTimerTick() { | 114 void BackToBackBeginFrameSource::OnTimerTick() { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 void ExternalBeginFrameSource::OnBeginFrame(const BeginFrameArgs& args) { | 292 void ExternalBeginFrameSource::OnBeginFrame(const BeginFrameArgs& args) { |
293 missed_begin_frame_args_ = args; | 293 missed_begin_frame_args_ = args; |
294 missed_begin_frame_args_.type = BeginFrameArgs::MISSED; | 294 missed_begin_frame_args_.type = BeginFrameArgs::MISSED; |
295 std::unordered_set<BeginFrameObserver*> observers(observers_); | 295 std::unordered_set<BeginFrameObserver*> observers(observers_); |
296 for (auto* obs : observers) | 296 for (auto* obs : observers) |
297 obs->OnBeginFrame(args); | 297 obs->OnBeginFrame(args); |
298 } | 298 } |
299 | 299 |
300 } // namespace cc | 300 } // namespace cc |
OLD | NEW |