| 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 } | 638 } |
| 639 | 639 |
| 640 const PictureLayerTiling* PictureLayerImpl::GetPendingOrActiveTwinTiling( | 640 const PictureLayerTiling* PictureLayerImpl::GetPendingOrActiveTwinTiling( |
| 641 const PictureLayerTiling* tiling) const { | 641 const PictureLayerTiling* tiling) const { |
| 642 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); | 642 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); |
| 643 if (!twin_layer) | 643 if (!twin_layer) |
| 644 return nullptr; | 644 return nullptr; |
| 645 // TODO(danakj): Remove this when no longer swapping tilings. | 645 // TODO(danakj): Remove this when no longer swapping tilings. |
| 646 if (!twin_layer->tilings_) | 646 if (!twin_layer->tilings_) |
| 647 return nullptr; | 647 return nullptr; |
| 648 return twin_layer->tilings_->TilingAtScale(tiling->contents_scale()); | 648 return twin_layer->tilings_->FindTilingWithScale(tiling->contents_scale()); |
| 649 } | 649 } |
| 650 | 650 |
| 651 PictureLayerTiling* PictureLayerImpl::GetRecycledTwinTiling( | 651 PictureLayerTiling* PictureLayerImpl::GetRecycledTwinTiling( |
| 652 const PictureLayerTiling* tiling) { | 652 const PictureLayerTiling* tiling) { |
| 653 PictureLayerImpl* recycled_twin = GetRecycledTwinLayer(); | 653 PictureLayerImpl* recycled_twin = GetRecycledTwinLayer(); |
| 654 if (!recycled_twin || !recycled_twin->tilings_) | 654 if (!recycled_twin || !recycled_twin->tilings_) |
| 655 return nullptr; | 655 return nullptr; |
| 656 return recycled_twin->tilings_->TilingAtScale(tiling->contents_scale()); | 656 return recycled_twin->tilings_->FindTilingWithScale(tiling->contents_scale()); |
| 657 } | 657 } |
| 658 | 658 |
| 659 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const { | 659 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const { |
| 660 if (!HasValidTilePriorities()) | 660 if (!HasValidTilePriorities()) |
| 661 return TilePriority::EVENTUALLY; | 661 return TilePriority::EVENTUALLY; |
| 662 return TilePriority::NOW; | 662 return TilePriority::NOW; |
| 663 } | 663 } |
| 664 | 664 |
| 665 size_t PictureLayerImpl::GetMaxTilesForInterestArea() const { | 665 size_t PictureLayerImpl::GetMaxTilesForInterestArea() const { |
| 666 return layer_tree_impl()->settings().max_tiles_for_interest_area; | 666 return layer_tree_impl()->settings().max_tiles_for_interest_area; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer()) | 882 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer()) |
| 883 twin_layer->SyncTiling(tiling); | 883 twin_layer->SyncTiling(tiling); |
| 884 | 884 |
| 885 return tiling; | 885 return tiling; |
| 886 } | 886 } |
| 887 | 887 |
| 888 void PictureLayerImpl::RemoveTiling(float contents_scale) { | 888 void PictureLayerImpl::RemoveTiling(float contents_scale) { |
| 889 if (!tilings_ || tilings_->num_tilings() == 0) | 889 if (!tilings_ || tilings_->num_tilings() == 0) |
| 890 return; | 890 return; |
| 891 | 891 |
| 892 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 892 tilings_->RemoveTilingWithScale(contents_scale); |
| 893 PictureLayerTiling* tiling = tilings_->tiling_at(i); | |
| 894 if (tiling->contents_scale() == contents_scale) { | |
| 895 tilings_->Remove(tiling); | |
| 896 break; | |
| 897 } | |
| 898 } | |
| 899 if (tilings_->num_tilings() == 0) | 893 if (tilings_->num_tilings() == 0) |
| 900 ResetRasterScale(); | 894 ResetRasterScale(); |
| 901 SanityCheckTilingState(); | 895 SanityCheckTilingState(); |
| 902 } | 896 } |
| 903 | 897 |
| 904 void PictureLayerImpl::RemoveAllTilings() { | 898 void PictureLayerImpl::RemoveAllTilings() { |
| 905 if (tilings_) | 899 if (tilings_) |
| 906 tilings_->RemoveAllTilings(); | 900 tilings_->RemoveAllTilings(); |
| 907 // If there are no tilings, then raster scales are no longer meaningful. | 901 // If there are no tilings, then raster scales are no longer meaningful. |
| 908 ResetRasterScale(); | 902 ResetRasterScale(); |
| 909 } | 903 } |
| 910 | 904 |
| 911 namespace { | 905 void PictureLayerImpl::AddTilingsForRasterScale() { |
| 906 // Reset all resolution enums on tilings, we'll be setting new values in this |
| 907 // function. |
| 908 tilings_->MarkAllTilingsNonIdeal(); |
| 912 | 909 |
| 913 inline float PositiveRatio(float float1, float float2) { | 910 PictureLayerTiling* high_res = |
| 914 DCHECK_GT(float1, 0); | 911 tilings_->FindTilingWithScale(raster_contents_scale_); |
| 915 DCHECK_GT(float2, 0); | 912 // We always need a high res tiling, so create one if it doesn't exist. |
| 916 return float1 > float2 ? float1 / float2 : float2 / float1; | 913 if (!high_res) |
| 917 } | 914 high_res = AddTiling(raster_contents_scale_); |
| 918 | 915 |
| 919 } // namespace | 916 // Try and find a low res tiling. |
| 920 | |
| 921 void PictureLayerImpl::AddTilingsForRasterScale() { | |
| 922 PictureLayerTiling* high_res = nullptr; | |
| 923 PictureLayerTiling* low_res = nullptr; | 917 PictureLayerTiling* low_res = nullptr; |
| 924 | 918 if (raster_contents_scale_ == low_res_raster_contents_scale_) |
| 925 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 919 low_res = high_res; |
| 926 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 920 else |
| 927 if (tiling->contents_scale() == raster_contents_scale_) | 921 low_res = tilings_->FindTilingWithScale(low_res_raster_contents_scale_); |
| 928 high_res = tiling; | |
| 929 if (tiling->contents_scale() == low_res_raster_contents_scale_) | |
| 930 low_res = tiling; | |
| 931 | |
| 932 // Reset all tilings to non-ideal until the end of this function. | |
| 933 tiling->set_resolution(NON_IDEAL_RESOLUTION); | |
| 934 } | |
| 935 | |
| 936 if (!high_res) { | |
| 937 high_res = AddTiling(raster_contents_scale_); | |
| 938 if (raster_contents_scale_ == low_res_raster_contents_scale_) | |
| 939 low_res = high_res; | |
| 940 } | |
| 941 | 922 |
| 942 // Only create new low res tilings when the transform is static. This | 923 // Only create new low res tilings when the transform is static. This |
| 943 // prevents wastefully creating a paired low res tiling for every new high res | 924 // prevents wastefully creating a paired low res tiling for every new high res |
| 944 // tiling during a pinch or a CSS animation. | 925 // tiling during a pinch or a CSS animation. |
| 926 bool can_have_low_res = layer_tree_impl()->create_low_res_tiling(); |
| 927 bool needs_low_res = !low_res; |
| 945 bool is_pinching = layer_tree_impl()->PinchGestureActive(); | 928 bool is_pinching = layer_tree_impl()->PinchGestureActive(); |
| 946 if (layer_tree_impl()->create_low_res_tiling() && !is_pinching && | 929 bool is_animating = draw_properties().screen_space_transform_is_animating; |
| 947 !draw_properties().screen_space_transform_is_animating && !low_res && | 930 if (can_have_low_res && needs_low_res && !is_pinching && !is_animating) |
| 948 low_res != high_res) | |
| 949 low_res = AddTiling(low_res_raster_contents_scale_); | 931 low_res = AddTiling(low_res_raster_contents_scale_); |
| 950 | 932 |
| 951 // Set low-res if we have one. | 933 // Set low-res if we have one. |
| 952 if (low_res && low_res != high_res) | 934 if (low_res && low_res != high_res) |
| 953 low_res->set_resolution(LOW_RESOLUTION); | 935 low_res->set_resolution(LOW_RESOLUTION); |
| 954 | 936 |
| 955 // Make sure we always have one high-res (even if high == low). | 937 // Make sure we always have one high-res (even if high == low). |
| 956 high_res->set_resolution(HIGH_RESOLUTION); | 938 high_res->set_resolution(HIGH_RESOLUTION); |
| 957 | 939 |
| 958 SanityCheckTilingState(); | 940 SanityCheckTilingState(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 // When the source scale changes we want to match it, but not when animating | 974 // When the source scale changes we want to match it, but not when animating |
| 993 // or when we've fixed the scale in place. | 975 // or when we've fixed the scale in place. |
| 994 if (!draw_properties().screen_space_transform_is_animating && | 976 if (!draw_properties().screen_space_transform_is_animating && |
| 995 !raster_source_scale_is_fixed_ && | 977 !raster_source_scale_is_fixed_ && |
| 996 raster_source_scale_ != ideal_source_scale_) | 978 raster_source_scale_ != ideal_source_scale_) |
| 997 return true; | 979 return true; |
| 998 | 980 |
| 999 return false; | 981 return false; |
| 1000 } | 982 } |
| 1001 | 983 |
| 1002 float PictureLayerImpl::SnappedContentsScale(float scale) { | |
| 1003 // If a tiling exists within the max snapping ratio, snap to its scale. | |
| 1004 float snapped_contents_scale = scale; | |
| 1005 float snapped_ratio = kSnapToExistingTilingRatio; | |
| 1006 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | |
| 1007 float tiling_contents_scale = tilings_->tiling_at(i)->contents_scale(); | |
| 1008 float ratio = PositiveRatio(tiling_contents_scale, scale); | |
| 1009 if (ratio < snapped_ratio) { | |
| 1010 snapped_contents_scale = tiling_contents_scale; | |
| 1011 snapped_ratio = ratio; | |
| 1012 } | |
| 1013 } | |
| 1014 return snapped_contents_scale; | |
| 1015 } | |
| 1016 | |
| 1017 void PictureLayerImpl::RecalculateRasterScales() { | 984 void PictureLayerImpl::RecalculateRasterScales() { |
| 1018 float old_raster_contents_scale = raster_contents_scale_; | 985 float old_raster_contents_scale = raster_contents_scale_; |
| 1019 float old_raster_page_scale = raster_page_scale_; | 986 float old_raster_page_scale = raster_page_scale_; |
| 1020 float old_raster_source_scale = raster_source_scale_; | 987 float old_raster_source_scale = raster_source_scale_; |
| 1021 | 988 |
| 1022 raster_device_scale_ = ideal_device_scale_; | 989 raster_device_scale_ = ideal_device_scale_; |
| 1023 raster_page_scale_ = ideal_page_scale_; | 990 raster_page_scale_ = ideal_page_scale_; |
| 1024 raster_source_scale_ = ideal_source_scale_; | 991 raster_source_scale_ = ideal_source_scale_; |
| 1025 raster_contents_scale_ = ideal_contents_scale_; | 992 raster_contents_scale_ = ideal_contents_scale_; |
| 1026 | 993 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1051 // - When zooming in, approximate ideal using multiple of kMaxScaleRatio. | 1018 // - When zooming in, approximate ideal using multiple of kMaxScaleRatio. |
| 1052 bool zooming_out = old_raster_page_scale > ideal_page_scale_; | 1019 bool zooming_out = old_raster_page_scale > ideal_page_scale_; |
| 1053 float desired_contents_scale = old_raster_contents_scale; | 1020 float desired_contents_scale = old_raster_contents_scale; |
| 1054 if (zooming_out) { | 1021 if (zooming_out) { |
| 1055 while (desired_contents_scale > ideal_contents_scale_) | 1022 while (desired_contents_scale > ideal_contents_scale_) |
| 1056 desired_contents_scale /= kMaxScaleRatioDuringPinch; | 1023 desired_contents_scale /= kMaxScaleRatioDuringPinch; |
| 1057 } else { | 1024 } else { |
| 1058 while (desired_contents_scale < ideal_contents_scale_) | 1025 while (desired_contents_scale < ideal_contents_scale_) |
| 1059 desired_contents_scale *= kMaxScaleRatioDuringPinch; | 1026 desired_contents_scale *= kMaxScaleRatioDuringPinch; |
| 1060 } | 1027 } |
| 1061 raster_contents_scale_ = SnappedContentsScale(desired_contents_scale); | 1028 raster_contents_scale_ = tilings_->GetSnappedContentsScale( |
| 1029 desired_contents_scale, kSnapToExistingTilingRatio); |
| 1062 raster_page_scale_ = | 1030 raster_page_scale_ = |
| 1063 raster_contents_scale_ / raster_device_scale_ / raster_source_scale_; | 1031 raster_contents_scale_ / raster_device_scale_ / raster_source_scale_; |
| 1064 } | 1032 } |
| 1065 | 1033 |
| 1066 // If we're not re-rasterizing during animation, rasterize at the maximum | 1034 // If we're not re-rasterizing during animation, rasterize at the maximum |
| 1067 // scale that will occur during the animation, if the maximum scale is | 1035 // scale that will occur during the animation, if the maximum scale is |
| 1068 // known. However we want to avoid excessive memory use. If the scale is | 1036 // known. However we want to avoid excessive memory use. If the scale is |
| 1069 // smaller than what we would choose otherwise, then it's always better off | 1037 // smaller than what we would choose otherwise, then it's always better off |
| 1070 // for us memory-wise. But otherwise, we don't choose a scale at which this | 1038 // for us memory-wise. But otherwise, we don't choose a scale at which this |
| 1071 // layer's rastered content would become larger than the viewport. | 1039 // layer's rastered content would become larger than the viewport. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 min_acceptable_high_res_scale = std::min( | 1103 min_acceptable_high_res_scale = std::min( |
| 1136 min_acceptable_high_res_scale, | 1104 min_acceptable_high_res_scale, |
| 1137 std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_)); | 1105 std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_)); |
| 1138 max_acceptable_high_res_scale = std::max( | 1106 max_acceptable_high_res_scale = std::max( |
| 1139 max_acceptable_high_res_scale, | 1107 max_acceptable_high_res_scale, |
| 1140 std::max(twin->raster_contents_scale_, twin->ideal_contents_scale_)); | 1108 std::max(twin->raster_contents_scale_, twin->ideal_contents_scale_)); |
| 1141 | 1109 |
| 1142 // TODO(danakj): Remove the tilings_ check when we create them in the | 1110 // TODO(danakj): Remove the tilings_ check when we create them in the |
| 1143 // constructor. | 1111 // constructor. |
| 1144 if (twin->tilings_) { | 1112 if (twin->tilings_) { |
| 1145 for (size_t i = 0; i < twin->tilings_->num_tilings(); ++i) { | 1113 PictureLayerTiling* tiling = |
| 1146 PictureLayerTiling* tiling = twin->tilings_->tiling_at(i); | 1114 twin->tilings_->FindTilingWithResolution(LOW_RESOLUTION); |
| 1147 if (tiling->resolution() == LOW_RESOLUTION) | 1115 if (tiling) |
| 1148 twin_low_res_scale = tiling->contents_scale(); | 1116 twin_low_res_scale = tiling->contents_scale(); |
| 1149 } | |
| 1150 } | 1117 } |
| 1151 } | 1118 } |
| 1152 | 1119 |
| 1120 // TODO(vmpstr): Put this logic into PictureLayerTilingSet. |
| 1153 std::vector<PictureLayerTiling*> to_remove; | 1121 std::vector<PictureLayerTiling*> to_remove; |
| 1154 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 1122 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 1155 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 1123 PictureLayerTiling* tiling = tilings_->tiling_at(i); |
| 1156 | 1124 |
| 1157 // Keep multiple high resolution tilings even if not used to help | 1125 // Keep multiple high resolution tilings even if not used to help |
| 1158 // activate earlier at non-ideal resolutions. | 1126 // activate earlier at non-ideal resolutions. |
| 1159 if (tiling->contents_scale() >= min_acceptable_high_res_scale && | 1127 if (tiling->contents_scale() >= min_acceptable_high_res_scale && |
| 1160 tiling->contents_scale() <= max_acceptable_high_res_scale) | 1128 tiling->contents_scale() <= max_acceptable_high_res_scale) |
| 1161 continue; | 1129 continue; |
| 1162 | 1130 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 // We should only have one high res tiling. | 1230 // We should only have one high res tiling. |
| 1263 DCHECK_EQ(1, tilings_->NumHighResTilings()); | 1231 DCHECK_EQ(1, tilings_->NumHighResTilings()); |
| 1264 #endif | 1232 #endif |
| 1265 } | 1233 } |
| 1266 | 1234 |
| 1267 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const { | 1235 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const { |
| 1268 return layer_tree_impl()->use_gpu_rasterization(); | 1236 return layer_tree_impl()->use_gpu_rasterization(); |
| 1269 } | 1237 } |
| 1270 | 1238 |
| 1271 float PictureLayerImpl::MaximumTilingContentsScale() const { | 1239 float PictureLayerImpl::MaximumTilingContentsScale() const { |
| 1272 float max_contents_scale = MinimumContentsScale(); | 1240 float max_contents_scale = tilings_->GetMaximumContentsScale(); |
| 1273 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 1241 return std::max(max_contents_scale, MinimumContentsScale()); |
| 1274 const PictureLayerTiling* tiling = tilings_->tiling_at(i); | |
| 1275 max_contents_scale = std::max(max_contents_scale, tiling->contents_scale()); | |
| 1276 } | |
| 1277 return max_contents_scale; | |
| 1278 } | 1242 } |
| 1279 | 1243 |
| 1280 void PictureLayerImpl::UpdateIdealScales() { | 1244 void PictureLayerImpl::UpdateIdealScales() { |
| 1281 DCHECK(CanHaveTilings()); | 1245 DCHECK(CanHaveTilings()); |
| 1282 | 1246 |
| 1283 float min_contents_scale = MinimumContentsScale(); | 1247 float min_contents_scale = MinimumContentsScale(); |
| 1284 DCHECK_GT(min_contents_scale, 0.f); | 1248 DCHECK_GT(min_contents_scale, 0.f); |
| 1285 float min_page_scale = layer_tree_impl()->min_page_scale_factor(); | 1249 float min_page_scale = layer_tree_impl()->min_page_scale_factor(); |
| 1286 DCHECK_GT(min_page_scale, 0.f); | 1250 DCHECK_GT(min_page_scale, 0.f); |
| 1287 float min_device_scale = 1.f; | 1251 float min_device_scale = 1.f; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1303 SkColor* color, | 1267 SkColor* color, |
| 1304 float* width) const { | 1268 float* width) const { |
| 1305 *color = DebugColors::TiledContentLayerBorderColor(); | 1269 *color = DebugColors::TiledContentLayerBorderColor(); |
| 1306 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 1270 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |
| 1307 } | 1271 } |
| 1308 | 1272 |
| 1309 void PictureLayerImpl::GetAllTilesForTracing( | 1273 void PictureLayerImpl::GetAllTilesForTracing( |
| 1310 std::set<const Tile*>* tiles) const { | 1274 std::set<const Tile*>* tiles) const { |
| 1311 if (!tilings_) | 1275 if (!tilings_) |
| 1312 return; | 1276 return; |
| 1313 | 1277 tilings_->GetAllTilesForTracing(tiles); |
| 1314 for (size_t i = 0; i < tilings_->num_tilings(); ++i) | |
| 1315 tilings_->tiling_at(i)->GetAllTilesForTracing(tiles); | |
| 1316 } | 1278 } |
| 1317 | 1279 |
| 1318 void PictureLayerImpl::AsValueInto(base::debug::TracedValue* state) const { | 1280 void PictureLayerImpl::AsValueInto(base::debug::TracedValue* state) const { |
| 1319 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1281 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
| 1320 LayerImpl::AsValueInto(state); | 1282 LayerImpl::AsValueInto(state); |
| 1321 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 1283 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
| 1322 state->SetDouble("geometry_contents_scale", MaximumTilingContentsScale()); | 1284 state->SetDouble("geometry_contents_scale", MaximumTilingContentsScale()); |
| 1323 state->BeginArray("tilings"); | 1285 state->BeginArray("tilings"); |
| 1324 tilings_->AsValueInto(state); | 1286 tilings_->AsValueInto(state); |
| 1325 state->EndArray(); | 1287 state->EndArray(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 | 1349 |
| 1388 if (!tilings_) | 1350 if (!tilings_) |
| 1389 return true; | 1351 return true; |
| 1390 | 1352 |
| 1391 if (visible_rect_for_tile_priority_.IsEmpty()) | 1353 if (visible_rect_for_tile_priority_.IsEmpty()) |
| 1392 return true; | 1354 return true; |
| 1393 | 1355 |
| 1394 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); | 1356 gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); |
| 1395 rect.Intersect(visible_rect_for_tile_priority_); | 1357 rect.Intersect(visible_rect_for_tile_priority_); |
| 1396 | 1358 |
| 1397 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 1359 // The high resolution tiling is the only tiling that can mark tiles as |
| 1398 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 1360 // requiring either draw or activation. There is an explicit check in those |
| 1399 if (tiling->resolution() != HIGH_RESOLUTION && | 1361 // callbacks to return false if they are not high resolution tilings. This |
| 1400 tiling->resolution() != LOW_RESOLUTION) | 1362 // check needs to remain since there are other callers of that function that |
| 1363 // rely on it. However, for the purposes of this function, we don't have to |
| 1364 // check other tilings. |
| 1365 PictureLayerTiling* tiling = |
| 1366 tilings_->FindTilingWithResolution(HIGH_RESOLUTION); |
| 1367 if (!tiling) |
| 1368 return true; |
| 1369 |
| 1370 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; |
| 1371 ++iter) { |
| 1372 const Tile* tile = *iter; |
| 1373 // A null tile (i.e. missing recording) can just be skipped. |
| 1374 // TODO(vmpstr): Verify this is true if we create tiles in raster |
| 1375 // iterators. |
| 1376 if (!tile) |
| 1401 continue; | 1377 continue; |
| 1402 | 1378 |
| 1403 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; | 1379 // We can't check tile->required_for_activation, because that value might |
| 1404 ++iter) { | 1380 // be out of date. It is updated in the raster/eviction iterators. |
| 1405 const Tile* tile = *iter; | 1381 // TODO(vmpstr): Remove the comment once you can't access this information |
| 1406 // A null tile (i.e. missing recording) can just be skipped. | 1382 // from the tile. |
| 1407 // TODO(vmpstr): Verify this is true if we create tiles in raster | 1383 if ((tiling->*is_tile_required_callback)(tile) && !tile->IsReadyToDraw()) { |
| 1408 // iterators. | 1384 TRACE_EVENT_INSTANT0("cc", "Tile required, but not ready to draw.", |
| 1409 if (!tile) | 1385 TRACE_EVENT_SCOPE_THREAD); |
| 1410 continue; | 1386 return false; |
| 1411 | |
| 1412 // We can't check tile->required_for_activation, because that value might | |
| 1413 // be out of date. It is updated in the raster/eviction iterators. | |
| 1414 // TODO(vmpstr): Remove the comment once you can't access this information | |
| 1415 // from the tile. | |
| 1416 if ((tiling->*is_tile_required_callback)(tile) && | |
| 1417 !tile->IsReadyToDraw()) { | |
| 1418 TRACE_EVENT_INSTANT0("cc", "Tile required, but not ready to draw.", | |
| 1419 TRACE_EVENT_SCOPE_THREAD); | |
| 1420 return false; | |
| 1421 } | |
| 1422 } | 1387 } |
| 1423 } | 1388 } |
| 1424 | 1389 |
| 1425 return true; | 1390 return true; |
| 1426 } | 1391 } |
| 1427 | 1392 |
| 1428 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | 1393 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { |
| 1429 if (!layer_tree_impl()->IsPendingTree()) | 1394 if (!layer_tree_impl()->IsPendingTree()) |
| 1430 return true; | 1395 return true; |
| 1431 | 1396 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1673 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
| 1709 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1674 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
| 1710 return tiling_range.end - 1 - current_tiling_range_offset; | 1675 return tiling_range.end - 1 - current_tiling_range_offset; |
| 1711 } | 1676 } |
| 1712 } | 1677 } |
| 1713 NOTREACHED(); | 1678 NOTREACHED(); |
| 1714 return 0; | 1679 return 0; |
| 1715 } | 1680 } |
| 1716 | 1681 |
| 1717 } // namespace cc | 1682 } // namespace cc |
| OLD | NEW |