| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 DidVisibilityChange(this, visible_); | 1981 DidVisibilityChange(this, visible_); |
| 1982 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); | 1982 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
| 1983 | 1983 |
| 1984 // If we just became visible, we have to ensure that we draw high res tiles, | 1984 // If we just became visible, we have to ensure that we draw high res tiles, |
| 1985 // to prevent checkerboard/low res flashes. | 1985 // to prevent checkerboard/low res flashes. |
| 1986 if (visible_) | 1986 if (visible_) |
| 1987 SetRequiresHighResToDraw(); | 1987 SetRequiresHighResToDraw(); |
| 1988 else | 1988 else |
| 1989 EvictAllUIResources(); | 1989 EvictAllUIResources(); |
| 1990 | 1990 |
| 1991 // Call PrepareTiles unconditionally on visibility change since this tab may | 1991 // Call PrepareTiles to evict tiles when we become invisible. |
| 1992 // never get another draw or timer tick. When becoming visible we care about | 1992 if (!visible) |
| 1993 // unblocking the scheduler which might be waiting for activation / ready to | 1993 PrepareTiles(); |
| 1994 // draw. When becoming invisible we care about evicting tiles immediately. | |
| 1995 PrepareTiles(); | |
| 1996 | 1994 |
| 1997 if (!renderer_) | 1995 if (!renderer_) |
| 1998 return; | 1996 return; |
| 1999 | 1997 |
| 2000 renderer_->SetVisible(visible); | 1998 renderer_->SetVisible(visible); |
| 2001 } | 1999 } |
| 2002 | 2000 |
| 2003 void LayerTreeHostImpl::SetNeedsAnimate() { | 2001 void LayerTreeHostImpl::SetNeedsAnimate() { |
| 2004 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 2002 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
| 2005 client_->SetNeedsAnimateOnImplThread(); | 2003 client_->SetNeedsAnimateOnImplThread(); |
| (...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3609 if (active_tree()) { | 3607 if (active_tree()) { |
| 3610 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3608 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
| 3611 if (layer) | 3609 if (layer) |
| 3612 return layer->ScrollOffsetForAnimation(); | 3610 return layer->ScrollOffsetForAnimation(); |
| 3613 } | 3611 } |
| 3614 | 3612 |
| 3615 return gfx::ScrollOffset(); | 3613 return gfx::ScrollOffset(); |
| 3616 } | 3614 } |
| 3617 | 3615 |
| 3618 } // namespace cc | 3616 } // namespace cc |
| OLD | NEW |