OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/tile_manager.h" | 5 #include "cc/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Determine bin based on three categories of tiles: things we need now, | 41 // Determine bin based on three categories of tiles: things we need now, |
42 // things we need soon, and eventually. | 42 // things we need soon, and eventually. |
43 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) { | 43 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) { |
44 if (!prio.is_live) | 44 if (!prio.is_live) |
45 return NEVER_BIN; | 45 return NEVER_BIN; |
46 | 46 |
47 // The amount of time for which we want to have prepainting coverage. | 47 // The amount of time for which we want to have prepainting coverage. |
48 const double prepainting_window_time_seconds = 1.0; | 48 const double prepainting_window_time_seconds = 1.0; |
49 const double backfling_guard_distance_pixels = 314.0; | 49 const double backfling_guard_distance_pixels = 314.0; |
50 | 50 |
51 // Explicitly limit how far ahead we will prepaint to limit memory usage. | |
52 if (prio.distance_to_visible_in_pixels > | |
53 TilePriority::kMaxDistanceInContentSpace) | |
54 return NEVER_BIN; | |
55 | |
56 if (prio.time_to_visible_in_seconds == 0 || | 51 if (prio.time_to_visible_in_seconds == 0 || |
57 prio.distance_to_visible_in_pixels < backfling_guard_distance_pixels) | 52 prio.distance_to_visible_in_pixels < backfling_guard_distance_pixels) |
58 return NOW_BIN; | 53 return NOW_BIN; |
59 | 54 |
60 if (prio.resolution == NON_IDEAL_RESOLUTION) | 55 if (prio.resolution == NON_IDEAL_RESOLUTION) |
61 return EVENTUALLY_BIN; | 56 return EVENTUALLY_BIN; |
62 | 57 |
63 if (prio.time_to_visible_in_seconds < prepainting_window_time_seconds) | 58 if (prio.time_to_visible_in_seconds < prepainting_window_time_seconds) |
64 return SOON_BIN; | 59 return SOON_BIN; |
65 | 60 |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 decode_begin_time = base::TimeTicks::HighResNow(); | 991 decode_begin_time = base::TimeTicks::HighResNow(); |
997 pixel_ref->Decode(); | 992 pixel_ref->Decode(); |
998 if (stats) { | 993 if (stats) { |
999 stats->totalDeferredImageDecodeCount++; | 994 stats->totalDeferredImageDecodeCount++; |
1000 stats->totalDeferredImageDecodeTime += | 995 stats->totalDeferredImageDecodeTime += |
1001 base::TimeTicks::HighResNow() - decode_begin_time; | 996 base::TimeTicks::HighResNow() - decode_begin_time; |
1002 } | 997 } |
1003 } | 998 } |
1004 | 999 |
1005 } // namespace cc | 1000 } // namespace cc |
OLD | NEW |