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

Unified Diff: cc/scheduler/begin_frame_source.cc

Issue 2897263003: Fix Omnibox.CharTypedToRepaintLatency regression with D3DVsync experiment (Closed)
Patch Set: Addressed feedback Created 3 years, 7 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 | « cc/scheduler/begin_frame_source.h ('k') | content/browser/compositor/gpu_vsync_begin_frame_source.h » ('j') | 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 be6394e617a88882f5806432ef0d3de16927d2cc..14f81585f6c8e869e0b4b597bb4bed095a2d063f 100644
--- a/cc/scheduler/begin_frame_source.cc
+++ b/cc/scheduler/begin_frame_source.cc
@@ -284,19 +284,10 @@ void ExternalBeginFrameSource::AddObserver(BeginFrameObserver* obs) {
client_->OnNeedsBeginFrames(true);
// Send a MISSED begin frame if necessary.
- if (last_begin_frame_args_.IsValid()) {
- const BeginFrameArgs& last_args = obs->LastUsedBeginFrameArgs();
- if (!last_args.IsValid() ||
- (last_begin_frame_args_.frame_time > last_args.frame_time)) {
- DCHECK(
- (last_begin_frame_args_.source_id != last_args.source_id) ||
- (last_begin_frame_args_.sequence_number > last_args.sequence_number))
- << "current " << last_begin_frame_args_.AsValue()->ToString()
- << ", last " << last_args.AsValue()->ToString();
- BeginFrameArgs missed_args = last_begin_frame_args_;
- missed_args.type = BeginFrameArgs::MISSED;
- obs->OnBeginFrame(missed_args);
- }
+ BeginFrameArgs missed_args = GetMissedBeginFrameArgs(obs);
+ if (missed_args.IsValid()) {
+ DCHECK_EQ(BeginFrameArgs::MISSED, missed_args.type);
+ obs->OnBeginFrame(missed_args);
}
}
@@ -305,10 +296,8 @@ void ExternalBeginFrameSource::RemoveObserver(BeginFrameObserver* obs) {
DCHECK(observers_.find(obs) != observers_.end());
observers_.erase(obs);
- if (observers_.empty()) {
- last_begin_frame_args_ = BeginFrameArgs();
+ if (observers_.empty())
client_->OnNeedsBeginFrames(false);
- }
}
void ExternalBeginFrameSource::DidFinishFrame(BeginFrameObserver* obs,
@@ -345,4 +334,24 @@ void ExternalBeginFrameSource::OnBeginFrame(const BeginFrameArgs& args) {
}
}
+BeginFrameArgs ExternalBeginFrameSource::GetMissedBeginFrameArgs(
+ BeginFrameObserver* obs) {
+ if (!last_begin_frame_args_.IsValid())
+ return BeginFrameArgs();
+
+ const BeginFrameArgs& last_args = obs->LastUsedBeginFrameArgs();
+ if (last_args.IsValid() &&
+ last_begin_frame_args_.frame_time == last_args.frame_time) {
+ return BeginFrameArgs();
+ }
+
+ DCHECK((last_begin_frame_args_.source_id != last_args.source_id) ||
+ (last_begin_frame_args_.sequence_number > last_args.sequence_number))
+ << "current " << last_begin_frame_args_.AsValue()->ToString() << ", last "
+ << last_args.AsValue()->ToString();
+ BeginFrameArgs missed_args = last_begin_frame_args_;
+ missed_args.type = BeginFrameArgs::MISSED;
+ return missed_args;
+}
+
} // namespace cc
« no previous file with comments | « cc/scheduler/begin_frame_source.h ('k') | content/browser/compositor/gpu_vsync_begin_frame_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698