Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 | 42 |
| 43 // The amount of time for which we want to have prepainting coverage. | 43 // The amount of time for which we want to have prepainting coverage. |
| 44 const double prepainting_window_time_seconds = 1.0; | 44 const double prepainting_window_time_seconds = 1.0; |
| 45 const double backfling_guard_distance_pixels = 314.0; | 45 const double backfling_guard_distance_pixels = 314.0; |
| 46 | 46 |
| 47 // Explicitly limit how far ahead we will prepaint to limit memory usage. | 47 // Explicitly limit how far ahead we will prepaint to limit memory usage. |
| 48 if (prio.distance_to_visible_in_pixels > | 48 if (prio.distance_to_visible_in_pixels > |
| 49 TilePriority::kMaxDistanceInContentSpace) | 49 TilePriority::kMaxDistanceInContentSpace) |
| 50 return NEVER_BIN; | 50 return NEVER_BIN; |
| 51 | 51 |
| 52 if (prio.time_to_visible_in_seconds == std::numeric_limits<float>::max()) | |
| 53 return NEVER_BIN; | |
| 54 | |
| 55 if (prio.time_to_visible_in_seconds == 0 || | 52 if (prio.time_to_visible_in_seconds == 0 || |
| 56 prio.distance_to_visible_in_pixels < backfling_guard_distance_pixels) | 53 prio.distance_to_visible_in_pixels < backfling_guard_distance_pixels) |
| 57 return NOW_BIN; | 54 return NOW_BIN; |
| 58 | 55 |
| 59 if (prio.resolution == NON_IDEAL_RESOLUTION) | 56 if (prio.resolution == NON_IDEAL_RESOLUTION) |
| 60 return EVENTUALLY_BIN; | 57 return EVENTUALLY_BIN; |
| 61 | 58 |
| 62 if (prio.time_to_visible_in_seconds < prepainting_window_time_seconds) | 59 if (prio.time_to_visible_in_seconds < prepainting_window_time_seconds) |
| 63 return SOON_BIN; | 60 return SOON_BIN; |
| 64 | 61 |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 continue; | 507 continue; |
| 511 } | 508 } |
| 512 if (tile_bytes > bytes_left) { | 509 if (tile_bytes > bytes_left) { |
| 513 managed_tile_state.can_use_gpu_memory = false; | 510 managed_tile_state.can_use_gpu_memory = false; |
| 514 bytes_that_exceeded_memory_budget += tile_bytes; | 511 bytes_that_exceeded_memory_budget += tile_bytes; |
| 515 FreeResourcesForTile(tile); | 512 FreeResourcesForTile(tile); |
| 516 continue; | 513 continue; |
| 517 } | 514 } |
| 518 bytes_left -= tile_bytes; | 515 bytes_left -= tile_bytes; |
| 519 managed_tile_state.can_use_gpu_memory = true; | 516 managed_tile_state.can_use_gpu_memory = true; |
| 520 if (!managed_tile_state.resource && | 517 if (managed_tile_state.resource || |
|
ccameron
2013/02/12 05:05:36
Remove this part of the diff.
| |
| 521 !managed_tile_state.resource_is_being_initialized) { | 518 managed_tile_state.resource_is_being_initialized) |
| 519 continue; | |
| 520 | |
| 521 // Only rasterize NOW, and SOON tiles. EVENTUALLY-binned tiles are kept | |
| 522 // around if we had their texture, but a never pro-actively painted. | |
| 523 bool is_in_eventually_bins = | |
| 524 managed_tile_state.bin[HIGH_PRIORITY_BIN] == EVENTUALLY_BIN && | |
| 525 managed_tile_state.bin[LOW_PRIORITY_BIN] == EVENTUALLY_BIN; | |
| 526 if (!is_in_eventually_bins) { | |
| 522 tiles_that_need_to_be_rasterized_.push_back(tile); | 527 tiles_that_need_to_be_rasterized_.push_back(tile); |
| 523 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); | 528 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); |
| 524 } | 529 } |
| 525 } | 530 } |
| 526 | 531 |
| 527 ever_exceeded_memory_budget_ |= bytes_that_exceeded_memory_budget > 0; | 532 ever_exceeded_memory_budget_ |= bytes_that_exceeded_memory_budget > 0; |
| 528 if (ever_exceeded_memory_budget_) { | 533 if (ever_exceeded_memory_budget_) { |
| 529 TRACE_COUNTER_ID2("cc", "over_memory_budget", this, | 534 TRACE_COUNTER_ID2("cc", "over_memory_budget", this, |
| 530 "budget", global_state_.memory_limit_in_bytes, | 535 "budget", global_state_.memory_limit_in_bytes, |
| 531 "over", bytes_that_exceeded_memory_budget); | 536 "over", bytes_that_exceeded_memory_budget); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 decode_begin_time = base::TimeTicks::Now(); | 890 decode_begin_time = base::TimeTicks::Now(); |
| 886 pixel_ref->Decode(); | 891 pixel_ref->Decode(); |
| 887 if (stats) { | 892 if (stats) { |
| 888 stats->totalDeferredImageDecodeCount++; | 893 stats->totalDeferredImageDecodeCount++; |
| 889 stats->totalDeferredImageDecodeTime += | 894 stats->totalDeferredImageDecodeTime += |
| 890 base::TimeTicks::Now() - decode_begin_time; | 895 base::TimeTicks::Now() - decode_begin_time; |
| 891 } | 896 } |
| 892 } | 897 } |
| 893 | 898 |
| 894 } // namespace cc | 899 } // namespace cc |
| OLD | NEW |