| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 #if defined(OS_MACOSX) | 328 #if defined(OS_MACOSX) |
| 329 // Debugging instrumentation for crbug.com/401630. | 329 // Debugging instrumentation for crbug.com/401630. |
| 330 // TODO(ccameron): remove this. | 330 // TODO(ccameron): remove this. |
| 331 if (observer_list_.HasObserver(observer)) | 331 if (observer_list_.HasObserver(observer)) |
| 332 observer->observing_count_ -= 1; | 332 observer->observing_count_ -= 1; |
| 333 #endif | 333 #endif |
| 334 | 334 |
| 335 observer_list_.RemoveObserver(observer); | 335 observer_list_.RemoveObserver(observer); |
| 336 } | 336 } |
| 337 | 337 |
| 338 bool Compositor::HasObserver(CompositorObserver* observer) { | 338 bool Compositor::HasObserver(const CompositorObserver* observer) const { |
| 339 return observer_list_.HasObserver(observer); | 339 return observer_list_.HasObserver(observer); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void Compositor::AddAnimationObserver(CompositorAnimationObserver* observer) { | 342 void Compositor::AddAnimationObserver(CompositorAnimationObserver* observer) { |
| 343 animation_observer_list_.AddObserver(observer); | 343 animation_observer_list_.AddObserver(observer); |
| 344 host_->SetNeedsAnimate(); | 344 host_->SetNeedsAnimate(); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void Compositor::RemoveAnimationObserver( | 347 void Compositor::RemoveAnimationObserver( |
| 348 CompositorAnimationObserver* observer) { | 348 CompositorAnimationObserver* observer) { |
| 349 animation_observer_list_.RemoveObserver(observer); | 349 animation_observer_list_.RemoveObserver(observer); |
| 350 } | 350 } |
| 351 | 351 |
| 352 bool Compositor::HasAnimationObserver(CompositorAnimationObserver* observer) { | 352 bool Compositor::HasAnimationObserver( |
| 353 const CompositorAnimationObserver* observer) const { |
| 353 return animation_observer_list_.HasObserver(observer); | 354 return animation_observer_list_.HasObserver(observer); |
| 354 } | 355 } |
| 355 | 356 |
| 356 void Compositor::BeginMainFrame(const cc::BeginFrameArgs& args) { | 357 void Compositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
| 357 FOR_EACH_OBSERVER(CompositorAnimationObserver, | 358 FOR_EACH_OBSERVER(CompositorAnimationObserver, |
| 358 animation_observer_list_, | 359 animation_observer_list_, |
| 359 OnAnimationStep(args.frame_time)); | 360 OnAnimationStep(args.frame_time)); |
| 360 if (animation_observer_list_.might_have_observers()) | 361 if (animation_observer_list_.might_have_observers()) |
| 361 host_->SetNeedsAnimate(); | 362 host_->SetNeedsAnimate(); |
| 362 } | 363 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // Call ScheduleDraw() instead of Draw() in order to allow other | 484 // Call ScheduleDraw() instead of Draw() in order to allow other |
| 484 // CompositorObservers to be notified before starting another | 485 // CompositorObservers to be notified before starting another |
| 485 // draw cycle. | 486 // draw cycle. |
| 486 ScheduleDraw(); | 487 ScheduleDraw(); |
| 487 } | 488 } |
| 488 FOR_EACH_OBSERVER( | 489 FOR_EACH_OBSERVER( |
| 489 CompositorObserver, observer_list_, OnCompositingEnded(this)); | 490 CompositorObserver, observer_list_, OnCompositingEnded(this)); |
| 490 } | 491 } |
| 491 | 492 |
| 492 } // namespace ui | 493 } // namespace ui |
| OLD | NEW |