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

Side by Side Diff: cc/tiles/tile_manager.cc

Issue 2857923004: cc: Keep PaintImage in DrawImage. (Closed)
Patch Set: .. Created 3 years, 7 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
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | 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/tiles/tile_manager.h" 5 #include "cc/tiles/tile_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 bool was_ready_to_draw = tile->draw_info().IsReadyToDraw(); 844 bool was_ready_to_draw = tile->draw_info().IsReadyToDraw();
845 FreeResourcesForTile(tile); 845 FreeResourcesForTile(tile);
846 if (was_ready_to_draw) 846 if (was_ready_to_draw)
847 client_->NotifyTileStateChanged(tile); 847 client_->NotifyTileStateChanged(tile);
848 } 848 }
849 849
850 void TileManager::PartitionImagesForCheckering( 850 void TileManager::PartitionImagesForCheckering(
851 const PrioritizedTile& prioritized_tile, 851 const PrioritizedTile& prioritized_tile,
852 const gfx::ColorSpace& raster_color_space, 852 const gfx::ColorSpace& raster_color_space,
853 std::vector<DrawImage>* sync_decoded_images, 853 std::vector<DrawImage>* sync_decoded_images,
854 std::vector<sk_sp<const SkImage>>* checkered_images) { 854 std::vector<PaintImage>* checkered_images) {
855 Tile* tile = prioritized_tile.tile(); 855 Tile* tile = prioritized_tile.tile();
856 std::vector<DrawImage> images_in_tile; 856 std::vector<DrawImage> images_in_tile;
857 prioritized_tile.raster_source()->GetDiscardableImagesInRect( 857 prioritized_tile.raster_source()->GetDiscardableImagesInRect(
858 tile->enclosing_layer_rect(), tile->raster_transform().scale(), 858 tile->enclosing_layer_rect(), tile->raster_transform().scale(),
859 raster_color_space, &images_in_tile); 859 raster_color_space, &images_in_tile);
860 WhichTree tree = tile->tiling()->tree(); 860 WhichTree tree = tile->tiling()->tree();
861 861
862 for (auto& draw_image : images_in_tile) { 862 for (auto& draw_image : images_in_tile) {
863 if (checker_image_tracker_.ShouldCheckerImage(draw_image.image(), tree)) 863 if (checker_image_tracker_.ShouldCheckerImage(draw_image.paint_image(),
864 checkered_images->push_back(draw_image.image()); 864 tree))
865 checkered_images->push_back(draw_image.paint_image());
865 else 866 else
866 sync_decoded_images->push_back(draw_image); 867 sync_decoded_images->push_back(draw_image);
867 } 868 }
868 } 869 }
869 870
870 void TileManager::AddCheckeredImagesToDecodeQueue( 871 void TileManager::AddCheckeredImagesToDecodeQueue(
871 const PrioritizedTile& prioritized_tile, 872 const PrioritizedTile& prioritized_tile,
872 const gfx::ColorSpace& raster_color_space, 873 const gfx::ColorSpace& raster_color_space,
873 CheckerImageTracker::ImageDecodeQueue* image_decode_queue) { 874 CheckerImageTracker::ImageDecodeQueue* image_decode_queue) {
874 Tile* tile = prioritized_tile.tile(); 875 Tile* tile = prioritized_tile.tile();
875 std::vector<DrawImage> images_in_tile; 876 std::vector<DrawImage> images_in_tile;
876 prioritized_tile.raster_source()->GetDiscardableImagesInRect( 877 prioritized_tile.raster_source()->GetDiscardableImagesInRect(
877 tile->enclosing_layer_rect(), tile->raster_transform().scale(), 878 tile->enclosing_layer_rect(), tile->raster_transform().scale(),
878 raster_color_space, &images_in_tile); 879 raster_color_space, &images_in_tile);
879 WhichTree tree = tile->tiling()->tree(); 880 WhichTree tree = tile->tiling()->tree();
880 881
881 for (auto& draw_image : images_in_tile) { 882 for (auto& draw_image : images_in_tile) {
882 if (checker_image_tracker_.ShouldCheckerImage(draw_image.image(), tree)) 883 if (checker_image_tracker_.ShouldCheckerImage(draw_image.paint_image(),
883 image_decode_queue->push_back(draw_image.image()); 884 tree))
885 image_decode_queue->push_back(draw_image.paint_image());
884 } 886 }
885 } 887 }
886 888
887 void TileManager::ScheduleTasks( 889 void TileManager::ScheduleTasks(
888 const PrioritizedWorkToSchedule& work_to_schedule) { 890 const PrioritizedWorkToSchedule& work_to_schedule) {
889 const std::vector<PrioritizedTile>& tiles_that_need_to_be_rasterized = 891 const std::vector<PrioritizedTile>& tiles_that_need_to_be_rasterized =
890 work_to_schedule.tiles_to_raster; 892 work_to_schedule.tiles_to_raster;
891 TRACE_EVENT1("cc", "TileManager::ScheduleTasks", "count", 893 TRACE_EVENT1("cc", "TileManager::ScheduleTasks", "count",
892 tiles_that_need_to_be_rasterized.size()); 894 tiles_that_need_to_be_rasterized.size());
893 895
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 1083
1082 // Create and queue all image decode tasks that this tile depends on. Note 1084 // Create and queue all image decode tasks that this tile depends on. Note
1083 // that we need to store the images for decode tasks in 1085 // that we need to store the images for decode tasks in
1084 // |scheduled_draw_images_| since the tile might have been destroyed by the 1086 // |scheduled_draw_images_| since the tile might have been destroyed by the
1085 // time the raster task finishes. 1087 // time the raster task finishes.
1086 TileTask::Vector decode_tasks; 1088 TileTask::Vector decode_tasks;
1087 std::vector<DrawImage>& sync_decoded_images = 1089 std::vector<DrawImage>& sync_decoded_images =
1088 scheduled_draw_images_[tile->id()]; 1090 scheduled_draw_images_[tile->id()];
1089 sync_decoded_images.clear(); 1091 sync_decoded_images.clear();
1090 if (!playback_settings.skip_images) { 1092 if (!playback_settings.skip_images) {
1091 std::vector<sk_sp<const SkImage>> checkered_images; 1093 std::vector<PaintImage> checkered_images;
1092 PartitionImagesForCheckering(prioritized_tile, color_space, 1094 PartitionImagesForCheckering(prioritized_tile, color_space,
1093 &sync_decoded_images, &checkered_images); 1095 &sync_decoded_images, &checkered_images);
1094 for (const auto& image : checkered_images) { 1096 for (const auto& image : checkered_images) {
1095 ImageId image_id = image->uniqueID(); 1097 playback_settings.images_to_skip.insert(image.sk_image()->uniqueID());
1096 playback_settings.images_to_skip.insert(image_id);
1097 1098
1098 // This can be the case for tiles on the active tree that will be replaced 1099 // This can be the case for tiles on the active tree that will be replaced
1099 // or are occluded on the pending tree. While we still need to continue 1100 // or are occluded on the pending tree. While we still need to continue
1100 // skipping images for these tiles, we don't need to decode them since 1101 // skipping images for these tiles, we don't need to decode them since
1101 // they will not be required on the next active tree. 1102 // they will not be required on the next active tree.
1102 if (prioritized_tile.should_decode_checkered_images_for_tile()) 1103 if (prioritized_tile.should_decode_checkered_images_for_tile())
1103 checker_image_decode_queue->push_back(image); 1104 checker_image_decode_queue->push_back(image);
1104 } 1105 }
1105 } 1106 }
1106 1107
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 // Mark required tiles as OOM so that we can activate/draw without them. 1381 // Mark required tiles as OOM so that we can activate/draw without them.
1381 for (; !queue->IsEmpty(); queue->Pop()) { 1382 for (; !queue->IsEmpty(); queue->Pop()) {
1382 Tile* tile = queue->Top().tile(); 1383 Tile* tile = queue->Top().tile();
1383 if (tile->draw_info().IsReadyToDraw()) 1384 if (tile->draw_info().IsReadyToDraw())
1384 continue; 1385 continue;
1385 tile->draw_info().set_oom(); 1386 tile->draw_info().set_oom();
1386 client_->NotifyTileStateChanged(tile); 1387 client_->NotifyTileStateChanged(tile);
1387 } 1388 }
1388 } 1389 }
1389 1390
1390 const ImageIdFlatSet& TileManager::TakeImagesToInvalidateOnSyncTree() { 1391 const PaintImageIdFlatSet& TileManager::TakeImagesToInvalidateOnSyncTree() {
1391 return checker_image_tracker_.TakeImagesToInvalidateOnSyncTree(); 1392 return checker_image_tracker_.TakeImagesToInvalidateOnSyncTree();
1392 } 1393 }
1393 1394
1394 void TileManager::DidActivateSyncTree() { 1395 void TileManager::DidActivateSyncTree() {
1395 checker_image_tracker_.DidActivateSyncTree(); 1396 checker_image_tracker_.DidActivateSyncTree();
1396 } 1397 }
1397 1398
1398 void TileManager::ClearCheckerImageTracking( 1399 void TileManager::ClearCheckerImageTracking(
1399 bool can_clear_decode_policy_tracking) { 1400 bool can_clear_decode_policy_tracking) {
1400 checker_image_tracker_.ClearTracker(can_clear_decode_policy_tracking); 1401 checker_image_tracker_.ClearTracker(can_clear_decode_policy_tracking);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 all_tile_tasks_completed = false; 1647 all_tile_tasks_completed = false;
1647 did_notify_all_tile_tasks_completed = false; 1648 did_notify_all_tile_tasks_completed = false;
1648 } 1649 }
1649 1650
1650 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; 1651 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default;
1651 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( 1652 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule(
1652 PrioritizedWorkToSchedule&& other) = default; 1653 PrioritizedWorkToSchedule&& other) = default;
1653 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; 1654 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default;
1654 1655
1655 } // namespace cc 1656 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698