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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 #if defined(OS_MACOSX) | 305 #if defined(OS_MACOSX) |
306 // Debugging instrumentation for crbug.com/401630. | 306 // Debugging instrumentation for crbug.com/401630. |
307 // TODO(ccameron): remove this. | 307 // TODO(ccameron): remove this. |
308 if (observer_list_.HasObserver(observer)) | 308 if (observer_list_.HasObserver(observer)) |
309 observer->observing_count_ -= 1; | 309 observer->observing_count_ -= 1; |
310 #endif | 310 #endif |
311 | 311 |
312 observer_list_.RemoveObserver(observer); | 312 observer_list_.RemoveObserver(observer); |
313 } | 313 } |
314 | 314 |
315 bool Compositor::HasObserver(CompositorObserver* observer) { | 315 bool Compositor::HasObserver(const CompositorObserver* observer) const { |
316 return observer_list_.HasObserver(observer); | 316 return observer_list_.HasObserver(observer); |
317 } | 317 } |
318 | 318 |
319 void Compositor::AddAnimationObserver(CompositorAnimationObserver* observer) { | 319 void Compositor::AddAnimationObserver(CompositorAnimationObserver* observer) { |
320 animation_observer_list_.AddObserver(observer); | 320 animation_observer_list_.AddObserver(observer); |
321 host_->SetNeedsAnimate(); | 321 host_->SetNeedsAnimate(); |
322 } | 322 } |
323 | 323 |
324 void Compositor::RemoveAnimationObserver( | 324 void Compositor::RemoveAnimationObserver( |
325 CompositorAnimationObserver* observer) { | 325 CompositorAnimationObserver* observer) { |
326 animation_observer_list_.RemoveObserver(observer); | 326 animation_observer_list_.RemoveObserver(observer); |
327 } | 327 } |
328 | 328 |
329 bool Compositor::HasAnimationObserver(CompositorAnimationObserver* observer) { | 329 bool Compositor::HasAnimationObserver( |
| 330 const CompositorAnimationObserver* observer) const { |
330 return animation_observer_list_.HasObserver(observer); | 331 return animation_observer_list_.HasObserver(observer); |
331 } | 332 } |
332 | 333 |
333 void Compositor::BeginMainFrame(const cc::BeginFrameArgs& args) { | 334 void Compositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
334 FOR_EACH_OBSERVER(CompositorAnimationObserver, | 335 FOR_EACH_OBSERVER(CompositorAnimationObserver, |
335 animation_observer_list_, | 336 animation_observer_list_, |
336 OnAnimationStep(args.frame_time)); | 337 OnAnimationStep(args.frame_time)); |
337 if (animation_observer_list_.might_have_observers()) | 338 if (animation_observer_list_.might_have_observers()) |
338 host_->SetNeedsAnimate(); | 339 host_->SetNeedsAnimate(); |
339 } | 340 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 // Call ScheduleDraw() instead of Draw() in order to allow other | 451 // Call ScheduleDraw() instead of Draw() in order to allow other |
451 // CompositorObservers to be notified before starting another | 452 // CompositorObservers to be notified before starting another |
452 // draw cycle. | 453 // draw cycle. |
453 ScheduleDraw(); | 454 ScheduleDraw(); |
454 } | 455 } |
455 FOR_EACH_OBSERVER( | 456 FOR_EACH_OBSERVER( |
456 CompositorObserver, observer_list_, OnCompositingEnded(this)); | 457 CompositorObserver, observer_list_, OnCompositingEnded(this)); |
457 } | 458 } |
458 | 459 |
459 } // namespace ui | 460 } // namespace ui |
OLD | NEW |