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

Side by Side Diff: cc/scheduler/begin_frame_source.cc

Issue 2967553002: Revert "Fix Omnibox.CharTypedToRepaintLatency regression with D3DVsync experiment" (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « cc/scheduler/begin_frame_source.h ('k') | cc/scheduler/begin_frame_source_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 DCHECK(obs); 276 DCHECK(obs);
277 DCHECK(observers_.find(obs) == observers_.end()); 277 DCHECK(observers_.find(obs) == observers_.end());
278 278
279 bool observers_was_empty = observers_.empty(); 279 bool observers_was_empty = observers_.empty();
280 observers_.insert(obs); 280 observers_.insert(obs);
281 obs->OnBeginFrameSourcePausedChanged(paused_); 281 obs->OnBeginFrameSourcePausedChanged(paused_);
282 if (observers_was_empty) 282 if (observers_was_empty)
283 client_->OnNeedsBeginFrames(true); 283 client_->OnNeedsBeginFrames(true);
284 284
285 // Send a MISSED begin frame if necessary. 285 // Send a MISSED begin frame if necessary.
286 BeginFrameArgs missed_args = GetMissedBeginFrameArgs(obs); 286 if (last_begin_frame_args_.IsValid()) {
287 if (missed_args.IsValid()) { 287 const BeginFrameArgs& last_args = obs->LastUsedBeginFrameArgs();
288 DCHECK_EQ(BeginFrameArgs::MISSED, missed_args.type); 288 if (!last_args.IsValid() ||
289 obs->OnBeginFrame(missed_args); 289 (last_begin_frame_args_.frame_time > last_args.frame_time)) {
290 DCHECK(
291 (last_begin_frame_args_.source_id != last_args.source_id) ||
292 (last_begin_frame_args_.sequence_number > last_args.sequence_number))
293 << "current " << last_begin_frame_args_.AsValue()->ToString()
294 << ", last " << last_args.AsValue()->ToString();
295 BeginFrameArgs missed_args = last_begin_frame_args_;
296 missed_args.type = BeginFrameArgs::MISSED;
297 obs->OnBeginFrame(missed_args);
298 }
290 } 299 }
291 } 300 }
292 301
293 void ExternalBeginFrameSource::RemoveObserver(BeginFrameObserver* obs) { 302 void ExternalBeginFrameSource::RemoveObserver(BeginFrameObserver* obs) {
294 DCHECK(obs); 303 DCHECK(obs);
295 DCHECK(observers_.find(obs) != observers_.end()); 304 DCHECK(observers_.find(obs) != observers_.end());
296 305
297 observers_.erase(obs); 306 observers_.erase(obs);
298 if (observers_.empty()) 307 if (observers_.empty()) {
308 last_begin_frame_args_ = BeginFrameArgs();
299 client_->OnNeedsBeginFrames(false); 309 client_->OnNeedsBeginFrames(false);
310 }
300 } 311 }
301 312
302 bool ExternalBeginFrameSource::IsThrottled() const { 313 bool ExternalBeginFrameSource::IsThrottled() const {
303 return true; 314 return true;
304 } 315 }
305 316
306 void ExternalBeginFrameSource::OnSetBeginFrameSourcePaused(bool paused) { 317 void ExternalBeginFrameSource::OnSetBeginFrameSourcePaused(bool paused) {
307 if (paused_ == paused) 318 if (paused_ == paused)
308 return; 319 return;
309 paused_ = paused; 320 paused_ = paused;
(...skipping 13 matching lines...) Expand all
323 if (!last_args.IsValid() || (args.frame_time > last_args.frame_time)) { 334 if (!last_args.IsValid() || (args.frame_time > last_args.frame_time)) {
324 DCHECK((args.source_id != last_args.source_id) || 335 DCHECK((args.source_id != last_args.source_id) ||
325 (args.sequence_number > last_args.sequence_number)) 336 (args.sequence_number > last_args.sequence_number))
326 << "current " << args.AsValue()->ToString() << ", last " 337 << "current " << args.AsValue()->ToString() << ", last "
327 << last_args.AsValue()->ToString(); 338 << last_args.AsValue()->ToString();
328 obs->OnBeginFrame(args); 339 obs->OnBeginFrame(args);
329 } 340 }
330 } 341 }
331 } 342 }
332 343
333 BeginFrameArgs ExternalBeginFrameSource::GetMissedBeginFrameArgs(
334 BeginFrameObserver* obs) {
335 if (!last_begin_frame_args_.IsValid())
336 return BeginFrameArgs();
337
338 const BeginFrameArgs& last_args = obs->LastUsedBeginFrameArgs();
339 if (last_args.IsValid() &&
340 last_begin_frame_args_.frame_time <= last_args.frame_time) {
341 return BeginFrameArgs();
342 }
343
344 DCHECK((last_begin_frame_args_.source_id != last_args.source_id) ||
345 (last_begin_frame_args_.sequence_number > last_args.sequence_number))
346 << "current " << last_begin_frame_args_.AsValue()->ToString() << ", last "
347 << last_args.AsValue()->ToString();
348 BeginFrameArgs missed_args = last_begin_frame_args_;
349 missed_args.type = BeginFrameArgs::MISSED;
350 return missed_args;
351 }
352
353 } // namespace cc 344 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/begin_frame_source.h ('k') | cc/scheduler/begin_frame_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698