| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 292 |
| 293 void Compositor::SetVisible(bool visible) { | 293 void Compositor::SetVisible(bool visible) { |
| 294 host_->SetVisible(visible); | 294 host_->SetVisible(visible); |
| 295 } | 295 } |
| 296 | 296 |
| 297 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const { | 297 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const { |
| 298 return vsync_manager_; | 298 return vsync_manager_; |
| 299 } | 299 } |
| 300 | 300 |
| 301 void Compositor::AddObserver(CompositorObserver* observer) { | 301 void Compositor::AddObserver(CompositorObserver* observer) { |
| 302 #if defined(OS_MACOSX) | 302 DCHECK(observer); |
| 303 // Debugging instrumentation for crbug.com/401630. | |
| 304 // TODO(ccameron): remove this. | |
| 305 CHECK(observer); | |
| 306 if (!observer_list_.HasObserver(observer)) | 303 if (!observer_list_.HasObserver(observer)) |
| 307 observer->observing_count_ += 1; | 304 observer->observing_count_ += 1; |
| 308 #endif | |
| 309 | |
| 310 observer_list_.AddObserver(observer); | 305 observer_list_.AddObserver(observer); |
| 311 } | 306 } |
| 312 | 307 |
| 313 void Compositor::RemoveObserver(CompositorObserver* observer) { | 308 void Compositor::RemoveObserver(CompositorObserver* observer) { |
| 314 #if defined(OS_MACOSX) | |
| 315 // Debugging instrumentation for crbug.com/401630. | |
| 316 // TODO(ccameron): remove this. | |
| 317 if (observer_list_.HasObserver(observer)) | 309 if (observer_list_.HasObserver(observer)) |
| 318 observer->observing_count_ -= 1; | 310 observer->observing_count_ -= 1; |
| 319 #endif | |
| 320 | |
| 321 observer_list_.RemoveObserver(observer); | 311 observer_list_.RemoveObserver(observer); |
| 322 } | 312 } |
| 323 | 313 |
| 324 bool Compositor::HasObserver(const CompositorObserver* observer) const { | 314 bool Compositor::HasObserver(const CompositorObserver* observer) const { |
| 325 return observer_list_.HasObserver(observer); | 315 return observer_list_.HasObserver(observer); |
| 326 } | 316 } |
| 327 | 317 |
| 328 void Compositor::AddAnimationObserver(CompositorAnimationObserver* observer) { | 318 void Compositor::AddAnimationObserver(CompositorAnimationObserver* observer) { |
| 329 animation_observer_list_.AddObserver(observer); | 319 animation_observer_list_.AddObserver(observer); |
| 330 host_->SetNeedsAnimate(); | 320 host_->SetNeedsAnimate(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // Call ScheduleDraw() instead of Draw() in order to allow other | 473 // Call ScheduleDraw() instead of Draw() in order to allow other |
| 484 // CompositorObservers to be notified before starting another | 474 // CompositorObservers to be notified before starting another |
| 485 // draw cycle. | 475 // draw cycle. |
| 486 ScheduleDraw(); | 476 ScheduleDraw(); |
| 487 } | 477 } |
| 488 FOR_EACH_OBSERVER( | 478 FOR_EACH_OBSERVER( |
| 489 CompositorObserver, observer_list_, OnCompositingEnded(this)); | 479 CompositorObserver, observer_list_, OnCompositingEnded(this)); |
| 490 } | 480 } |
| 491 | 481 |
| 492 } // namespace ui | 482 } // namespace ui |
| OLD | NEW |