OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 void Compositor::RemoveObserver(CompositorObserver* observer) { | 492 void Compositor::RemoveObserver(CompositorObserver* observer) { |
493 observer_list_.RemoveObserver(observer); | 493 observer_list_.RemoveObserver(observer); |
494 } | 494 } |
495 | 495 |
496 bool Compositor::HasObserver(CompositorObserver* observer) { | 496 bool Compositor::HasObserver(CompositorObserver* observer) { |
497 return observer_list_.HasObserver(observer); | 497 return observer_list_.HasObserver(observer); |
498 } | 498 } |
499 | 499 |
500 void Compositor::OnUpdateVSyncParameters(base::TimeTicks timebase, | 500 void Compositor::OnUpdateVSyncParameters(base::TimeTicks timebase, |
501 base::TimeDelta interval) { | 501 base::TimeDelta interval, |
502 FOR_EACH_OBSERVER(CompositorObserver, | 502 bool interval_is_authoritative) { |
503 observer_list_, | 503 if (interval_is_authoritative) { |
504 OnUpdateVSyncParameters(this, timebase, interval)); | 504 authoritative_vsync_interval_ = interval; |
| 505 } else { |
| 506 if (authoritative_vsync_interval_ != base::TimeDelta()) |
| 507 interval = authoritative_vsync_interval_; |
| 508 } |
| 509 |
| 510 if (!timebase.is_null()) { |
| 511 FOR_EACH_OBSERVER(CompositorObserver, |
| 512 observer_list_, |
| 513 OnUpdateVSyncParameters(this, timebase, interval)); |
| 514 } |
505 } | 515 } |
506 | 516 |
507 void Compositor::Layout() { | 517 void Compositor::Layout() { |
508 // We're sending damage that will be addressed during this composite | 518 // We're sending damage that will be addressed during this composite |
509 // cycle, so we don't need to schedule another composite to address it. | 519 // cycle, so we don't need to schedule another composite to address it. |
510 disable_schedule_composite_ = true; | 520 disable_schedule_composite_ = true; |
511 if (root_layer_) | 521 if (root_layer_) |
512 root_layer_->SendDamagedRects(); | 522 root_layer_->SendDamagedRects(); |
513 disable_schedule_composite_ = false; | 523 disable_schedule_composite_ = false; |
514 } | 524 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 // CompositorObservers to be notified before starting another | 635 // CompositorObservers to be notified before starting another |
626 // draw cycle. | 636 // draw cycle. |
627 ScheduleDraw(); | 637 ScheduleDraw(); |
628 } | 638 } |
629 FOR_EACH_OBSERVER(CompositorObserver, | 639 FOR_EACH_OBSERVER(CompositorObserver, |
630 observer_list_, | 640 observer_list_, |
631 OnCompositingEnded(this)); | 641 OnCompositingEnded(this)); |
632 } | 642 } |
633 | 643 |
634 } // namespace ui | 644 } // namespace ui |
OLD | NEW |