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 // PrepareTiles when becoming invisible so that we evict tiles immediately. |
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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3613 if (active_tree()) { | 3611 if (active_tree()) { |
3614 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3612 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
3615 if (layer) | 3613 if (layer) |
3616 return layer->ScrollOffsetForAnimation(); | 3614 return layer->ScrollOffsetForAnimation(); |
3617 } | 3615 } |
3618 | 3616 |
3619 return gfx::ScrollOffset(); | 3617 return gfx::ScrollOffset(); |
3620 } | 3618 } |
3621 | 3619 |
3622 } // namespace cc | 3620 } // namespace cc |
OLD | NEW |