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/resources/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 // If we don't have the required version, and it's not in flight | 817 // If we don't have the required version, and it's not in flight |
818 // then we'll have to pay to create a new task. | 818 // then we'll have to pay to create a new task. |
819 if (!tile_version.resource_ && !tile_version.raster_task_) { | 819 if (!tile_version.resource_ && !tile_version.raster_task_) { |
820 tile_bytes += bytes_if_allocated; | 820 tile_bytes += bytes_if_allocated; |
821 tile_resources++; | 821 tile_resources++; |
822 } | 822 } |
823 } | 823 } |
824 | 824 |
825 // Tile is OOM. | 825 // Tile is OOM. |
826 if (tile_bytes > tile_bytes_left || tile_resources > resources_left) { | 826 if (tile_bytes > tile_bytes_left || tile_resources > resources_left) { |
827 bool was_ready_to_draw = tile->IsReadyToDraw(); | 827 FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); |
828 | |
829 FreeResourcesForTile(tile); | |
830 | 828 |
831 // This tile was already on screen and now its resources have been | 829 // This tile was already on screen and now its resources have been |
832 // released. In order to prevent checkerboarding, set this tile as | 830 // released. In order to prevent checkerboarding, set this tile as |
833 // rasterize on demand immediately. | 831 // rasterize on demand immediately. |
834 if (mts.visible_and_ready_to_draw) | 832 if (mts.visible_and_ready_to_draw) |
835 tile_version.set_rasterize_on_demand(); | 833 tile_version.set_rasterize_on_demand(); |
836 | 834 |
837 if (was_ready_to_draw) | |
838 client_->NotifyTileStateChanged(tile); | |
839 | |
840 oomed_soft = true; | 835 oomed_soft = true; |
841 if (tile_uses_hard_limit) { | 836 if (tile_uses_hard_limit) { |
842 oomed_hard = true; | 837 oomed_hard = true; |
843 bytes_that_exceeded_memory_budget += tile_bytes; | 838 bytes_that_exceeded_memory_budget += tile_bytes; |
844 } | 839 } |
845 } else { | 840 } else { |
846 resources_left -= tile_resources; | 841 resources_left -= tile_resources; |
847 hard_bytes_left -= tile_bytes; | 842 hard_bytes_left -= tile_bytes; |
848 soft_bytes_left = | 843 soft_bytes_left = |
849 (soft_bytes_left > tile_bytes) ? soft_bytes_left - tile_bytes : 0; | 844 (soft_bytes_left > tile_bytes) ? soft_bytes_left - tile_bytes : 0; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate"); | 1162 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate"); |
1168 | 1163 |
1169 rasterizer_->CheckForCompletedTasks(); | 1164 rasterizer_->CheckForCompletedTasks(); |
1170 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; | 1165 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; |
1171 | 1166 |
1172 if (IsReadyToActivate()) | 1167 if (IsReadyToActivate()) |
1173 client_->NotifyReadyToActivate(); | 1168 client_->NotifyReadyToActivate(); |
1174 } | 1169 } |
1175 | 1170 |
1176 } // namespace cc | 1171 } // namespace cc |
OLD | NEW |