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/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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 // We won't be able to schedule this tile, so break out early. | 684 // We won't be able to schedule this tile, so break out early. |
685 if (work_to_schedule.tiles_to_raster.size() >= | 685 if (work_to_schedule.tiles_to_raster.size() >= |
686 scheduled_raster_task_limit_) { | 686 scheduled_raster_task_limit_) { |
687 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; | 687 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; |
688 break; | 688 break; |
689 } | 689 } |
690 | 690 |
691 tile->scheduled_priority_ = schedule_priority++; | 691 tile->scheduled_priority_ = schedule_priority++; |
692 | 692 |
693 DCHECK(tile->draw_info().mode() == TileDrawInfo::OOM_MODE || | 693 DCHECK(tile->draw_info().mode() == TileDrawInfo::OOM_MODE || |
694 !tile->draw_info().IsReadyToDraw()); | 694 !tile->draw_info().IsReadyToDraw() || tile->is_checker_imaged()); |
695 | 695 |
696 // If the tile already has a raster_task, then the memory used by it is | 696 // If the tile already has a raster_task, then the memory used by it is |
697 // already accounted for in memory_usage. Otherwise, we'll have to acquire | 697 // already accounted for in memory_usage. Otherwise, we'll have to acquire |
698 // more memory to create a raster task. | 698 // more memory to create a raster task. |
699 MemoryUsage memory_required_by_tile_to_be_scheduled; | 699 MemoryUsage memory_required_by_tile_to_be_scheduled; |
700 if (!tile->raster_task_.get()) { | 700 if (!tile->raster_task_.get()) { |
701 memory_required_by_tile_to_be_scheduled = MemoryUsage::FromConfig( | 701 memory_required_by_tile_to_be_scheduled = MemoryUsage::FromConfig( |
702 tile->desired_texture_size(), DetermineResourceFormat(tile)); | 702 tile->desired_texture_size(), DetermineResourceFormat(tile)); |
703 } | 703 } |
704 | 704 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 has_scheduled_tile_tasks_ = true; | 794 has_scheduled_tile_tasks_ = true; |
795 | 795 |
796 // Track the number of dependents for each *_done task. | 796 // Track the number of dependents for each *_done task. |
797 size_t required_for_activate_count = 0; | 797 size_t required_for_activate_count = 0; |
798 size_t required_for_draw_count = 0; | 798 size_t required_for_draw_count = 0; |
799 size_t all_count = 0; | 799 size_t all_count = 0; |
800 | 800 |
801 size_t priority = kTileTaskPriorityBase; | 801 size_t priority = kTileTaskPriorityBase; |
802 | 802 |
803 graph_.Reset(); | 803 graph_.Reset(); |
804 checker_image_tracker_.ResetImageDecodeQueue(); | |
804 | 805 |
805 gfx::ColorSpace target_color_space = client_->GetTileColorSpace(); | 806 gfx::ColorSpace target_color_space = client_->GetTileColorSpace(); |
806 | 807 |
807 scoped_refptr<TileTask> required_for_activation_done_task = | 808 scoped_refptr<TileTask> required_for_activation_done_task = |
808 CreateTaskSetFinishedTask( | 809 CreateTaskSetFinishedTask( |
809 &TileManager::DidFinishRunningTileTasksRequiredForActivation); | 810 &TileManager::DidFinishRunningTileTasksRequiredForActivation); |
810 scoped_refptr<TileTask> required_for_draw_done_task = | 811 scoped_refptr<TileTask> required_for_draw_done_task = |
811 CreateTaskSetFinishedTask( | 812 CreateTaskSetFinishedTask( |
812 &TileManager::DidFinishRunningTileTasksRequiredForDraw); | 813 &TileManager::DidFinishRunningTileTasksRequiredForDraw); |
813 scoped_refptr<TileTask> all_done_task = | 814 scoped_refptr<TileTask> all_done_task = |
814 CreateTaskSetFinishedTask(&TileManager::DidFinishRunningAllTileTasks); | 815 CreateTaskSetFinishedTask(&TileManager::DidFinishRunningAllTileTasks); |
815 | 816 |
816 // Build a new task queue containing all task currently needed. Tasks | 817 // Build a new task queue containing all task currently needed. Tasks |
817 // are added in order of priority, highest priority task first. | 818 // are added in order of priority, highest priority task first. |
818 for (auto& prioritized_tile : tiles_that_need_to_be_rasterized) { | 819 for (auto& prioritized_tile : tiles_that_need_to_be_rasterized) { |
819 Tile* tile = prioritized_tile.tile(); | 820 Tile* tile = prioritized_tile.tile(); |
820 | 821 |
821 DCHECK(tile->draw_info().requires_resource()); | 822 DCHECK(tile->draw_info().requires_resource()); |
822 DCHECK(!tile->draw_info().resource()); | 823 DCHECK(!tile->draw_info().resource() || tile->is_checker_imaged()); |
824 | |
825 bool process_tile_for_checker_images_only = tile->draw_info().resource(); | |
826 if (process_tile_for_checker_images_only) { | |
827 std::vector<DrawImage> images; | |
828 ImageIdFlatSet checkered_images; | |
829 prioritized_tile.raster_source()->GetDiscardableImagesInRect( | |
830 tile->enclosing_layer_rect(), tile->contents_scale(), &images); | |
831 checker_image_tracker_.FilterImagesForCheckeringForTile( | |
vmpstr
2017/03/07 19:25:08
Yeah I think filter might be a bad name since from
Khushal
2017/03/13 20:35:08
I pulled that function into the TileManager. Does
| |
832 &images, &checkered_images, tile->tiling()->tree()); | |
833 DCHECK(!checkered_images.empty()) | |
834 << "Checker-imaged state is sticky on a Tile"; | |
835 continue; | |
836 } | |
823 | 837 |
824 if (!tile->raster_task_) { | 838 if (!tile->raster_task_) { |
825 tile->raster_task_ = | 839 tile->raster_task_ = |
826 CreateRasterTask(prioritized_tile, target_color_space); | 840 CreateRasterTask(prioritized_tile, target_color_space); |
827 } | 841 } |
828 | 842 |
829 TileTask* task = tile->raster_task_.get(); | 843 TileTask* task = tile->raster_task_.get(); |
830 | 844 |
831 DCHECK(!task->HasCompleted()); | 845 DCHECK(!task->HasCompleted()); |
832 | 846 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
963 // Create and queue all image decode tasks that this tile depends on. | 977 // Create and queue all image decode tasks that this tile depends on. |
964 TileTask::Vector decode_tasks; | 978 TileTask::Vector decode_tasks; |
965 std::vector<DrawImage>& images = scheduled_draw_images_[tile->id()]; | 979 std::vector<DrawImage>& images = scheduled_draw_images_[tile->id()]; |
966 ImageIdFlatSet images_to_skip; | 980 ImageIdFlatSet images_to_skip; |
967 images.clear(); | 981 images.clear(); |
968 if (!playback_settings.skip_images) { | 982 if (!playback_settings.skip_images) { |
969 prioritized_tile.raster_source()->GetDiscardableImagesInRect( | 983 prioritized_tile.raster_source()->GetDiscardableImagesInRect( |
970 tile->enclosing_layer_rect(), tile->contents_scale(), &images); | 984 tile->enclosing_layer_rect(), tile->contents_scale(), &images); |
971 checker_image_tracker_.FilterImagesForCheckeringForTile( | 985 checker_image_tracker_.FilterImagesForCheckeringForTile( |
972 &images, &images_to_skip, prioritized_tile.tile()->tiling()->tree()); | 986 &images, &images_to_skip, prioritized_tile.tile()->tiling()->tree()); |
987 if (!images_to_skip.empty()) | |
988 tile->set_is_checker_imaged(); | |
vmpstr
2017/03/07 19:25:08
When is this flag reset?
Khushal
2017/03/13 20:35:08
Its not. If a tile is checker-imaged. It can only
| |
973 } | 989 } |
974 | 990 |
975 // We can skip the image hijack canvas if we have no images, or no images to | 991 // We can skip the image hijack canvas if we have no images, or no images to |
976 // skip during raster. | 992 // skip during raster. |
977 playback_settings.use_image_hijack_canvas = | 993 playback_settings.use_image_hijack_canvas = |
978 !images.empty() || !images_to_skip.empty(); | 994 !images.empty() || !images_to_skip.empty(); |
979 playback_settings.images_to_skip = std::move(images_to_skip); | 995 playback_settings.images_to_skip = std::move(images_to_skip); |
980 | 996 |
981 // Get the tasks for the required images. | 997 // Get the tasks for the required images. |
982 ImageDecodeCache::TracingInfo tracing_info( | 998 ImageDecodeCache::TracingInfo tracing_info( |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1432 all_tile_tasks_completed = false; | 1448 all_tile_tasks_completed = false; |
1433 did_notify_all_tile_tasks_completed = false; | 1449 did_notify_all_tile_tasks_completed = false; |
1434 } | 1450 } |
1435 | 1451 |
1436 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; | 1452 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; |
1437 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( | 1453 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( |
1438 PrioritizedWorkToSchedule&& other) = default; | 1454 PrioritizedWorkToSchedule&& other) = default; |
1439 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; | 1455 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; |
1440 | 1456 |
1441 } // namespace cc | 1457 } // namespace cc |
OLD | NEW |