Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: cc/tile_manager.cc

Issue 12280021: cc: Don't discard tiles unless memory is low (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « cc/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698