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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 } | 674 } |
675 } | 675 } |
676 | 676 |
677 // Prepaint tiles that are far away are only processed for images. | 677 // Prepaint tiles that are far away are only processed for images. |
678 if (!tile->required_for_activation() && !tile->required_for_draw() && | 678 if (!tile->required_for_activation() && !tile->required_for_draw() && |
679 prioritized_tile.is_process_for_images_only()) { | 679 prioritized_tile.is_process_for_images_only()) { |
680 work_to_schedule.tiles_to_process_for_images.push_back(prioritized_tile); | 680 work_to_schedule.tiles_to_process_for_images.push_back(prioritized_tile); |
681 continue; | 681 continue; |
682 } | 682 } |
683 | 683 |
684 // Tiles in the raster queue should either require raster or decode for | |
685 // checker-images. If this tile does not need raster, process it only to | |
686 // build the decode queue for checkered images. | |
687 // Note that performing this check after the solif color analysis is not | |
688 // necessary for correctness. | |
689 if (!tile->draw_info().NeedsRaster()) { | |
690 DCHECK(tile->draw_info().is_checker_imaged()); | |
691 DCHECK(tile->is_image_analysis_performed()); | |
692 | |
693 work_to_schedule.checker_image_decode_queue.insert( | |
694 work_to_schedule.checker_image_decode_queue.end(), | |
695 tile->images_to_checker().begin(), tile->images_to_checker().end()); | |
696 continue; | |
697 } | |
698 | |
684 // We won't be able to schedule this tile, so break out early. | 699 // We won't be able to schedule this tile, so break out early. |
685 if (work_to_schedule.tiles_to_raster.size() >= | 700 if (work_to_schedule.tiles_to_raster.size() >= |
686 scheduled_raster_task_limit_) { | 701 scheduled_raster_task_limit_) { |
687 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; | 702 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; |
688 break; | 703 break; |
689 } | 704 } |
690 | 705 |
691 tile->scheduled_priority_ = schedule_priority++; | 706 tile->scheduled_priority_ = schedule_priority++; |
692 | 707 |
693 DCHECK(tile->draw_info().mode() == TileDrawInfo::OOM_MODE || | 708 DCHECK(tile->draw_info().mode() == TileDrawInfo::OOM_MODE || |
(...skipping 26 matching lines...) Expand all Loading... | |
720 // If we couldn't fit the tile into our current memory limit, then we're | 735 // If we couldn't fit the tile into our current memory limit, then we're |
721 // done. | 736 // done. |
722 if (!memory_usage_is_within_limit) { | 737 if (!memory_usage_is_within_limit) { |
723 if (tile_is_needed_now) | 738 if (tile_is_needed_now) |
724 had_enough_memory_to_schedule_tiles_needed_now = false; | 739 had_enough_memory_to_schedule_tiles_needed_now = false; |
725 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; | 740 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; |
726 break; | 741 break; |
727 } | 742 } |
728 | 743 |
729 memory_usage += memory_required_by_tile_to_be_scheduled; | 744 memory_usage += memory_required_by_tile_to_be_scheduled; |
745 | |
746 // If the tile has a scheduled task that will rasterize a resource with | |
747 // checker-imaged content, add those images to the decode queue. Note that | |
748 // we add all images as we process the raster priority queue to ensure that | |
749 // images are added to the decode queue in raster priority order. | |
750 if (tile->HasRasterTask()) { | |
751 DCHECK(tile->is_image_analysis_performed()); | |
752 | |
753 if (tile->raster_task_scheduled_with_checker_images()) { | |
754 work_to_schedule.checker_image_decode_queue.insert( | |
755 work_to_schedule.checker_image_decode_queue.end(), | |
756 tile->images_to_checker().begin(), tile->images_to_checker().end()); | |
757 } | |
758 } else { | |
759 // Creating the raster task here will acquire resources, but | |
760 // this resource usage has already been accounted for above. | |
761 tile->raster_task_ = | |
762 CreateRasterTask(prioritized_tile, client_->GetRasterColorSpace(), | |
763 &work_to_schedule.checker_image_decode_queue); | |
764 } | |
765 | |
730 work_to_schedule.tiles_to_raster.push_back(prioritized_tile); | 766 work_to_schedule.tiles_to_raster.push_back(prioritized_tile); |
731 } | 767 } |
732 | 768 |
733 // Note that we should try and further reduce memory in case the above loop | 769 // Note that we should try and further reduce memory in case the above loop |
734 // didn't reduce memory. This ensures that we always release as many resources | 770 // didn't reduce memory. This ensures that we always release as many resources |
735 // as possible to stay within the memory limit. | 771 // as possible to stay within the memory limit. |
736 eviction_priority_queue = FreeTileResourcesUntilUsageIsWithinLimit( | 772 eviction_priority_queue = FreeTileResourcesUntilUsageIsWithinLimit( |
737 std::move(eviction_priority_queue), hard_memory_limit, &memory_usage); | 773 std::move(eviction_priority_queue), hard_memory_limit, &memory_usage); |
738 | 774 |
775 // At this point if we still have a tile that is holding onto a resource with | |
776 // checker-imaged content, add it to the decode queue to ensure that the | |
777 // resource is eventually invalidated. | |
778 while (!raster_priority_queue->IsEmpty()) { | |
779 const PrioritizedTile& prioritized_tile = raster_priority_queue->Top(); | |
780 Tile* tile = prioritized_tile.tile(); | |
781 if (tile->draw_info().is_checker_imaged() || | |
782 tile->raster_task_scheduled_with_checker_images()) { | |
Khushal
2017/03/31 04:31:01
This part still needs to be worked out.
| |
783 std::vector<DrawImage> images_in_tile; | |
784 prioritized_tile.raster_source()->GetDiscardableImagesInRect( | |
785 tile->enclosing_layer_rect(), tile->contents_scale(), | |
786 &images_in_tile); | |
787 } | |
788 raster_priority_queue->Pop(); | |
789 } | |
790 | |
739 UMA_HISTOGRAM_BOOLEAN("TileManager.ExceededMemoryBudget", | 791 UMA_HISTOGRAM_BOOLEAN("TileManager.ExceededMemoryBudget", |
740 !had_enough_memory_to_schedule_tiles_needed_now); | 792 !had_enough_memory_to_schedule_tiles_needed_now); |
741 did_oom_on_last_assign_ = !had_enough_memory_to_schedule_tiles_needed_now; | 793 did_oom_on_last_assign_ = !had_enough_memory_to_schedule_tiles_needed_now; |
742 | 794 |
743 memory_stats_from_last_assign_.total_budget_in_bytes = | 795 memory_stats_from_last_assign_.total_budget_in_bytes = |
744 global_state_.hard_memory_limit_in_bytes; | 796 global_state_.hard_memory_limit_in_bytes; |
745 memory_stats_from_last_assign_.total_bytes_used = memory_usage.memory_bytes(); | 797 memory_stats_from_last_assign_.total_bytes_used = memory_usage.memory_bytes(); |
746 DCHECK_GE(memory_stats_from_last_assign_.total_bytes_used, 0); | 798 DCHECK_GE(memory_stats_from_last_assign_.total_bytes_used, 0); |
747 memory_stats_from_last_assign_.had_enough_memory = | 799 memory_stats_from_last_assign_.had_enough_memory = |
748 had_enough_memory_to_schedule_tiles_needed_now; | 800 had_enough_memory_to_schedule_tiles_needed_now; |
(...skipping 16 matching lines...) Expand all Loading... | |
765 } | 817 } |
766 | 818 |
767 void TileManager::FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw( | 819 void TileManager::FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw( |
768 Tile* tile) { | 820 Tile* tile) { |
769 bool was_ready_to_draw = tile->draw_info().IsReadyToDraw(); | 821 bool was_ready_to_draw = tile->draw_info().IsReadyToDraw(); |
770 FreeResourcesForTile(tile); | 822 FreeResourcesForTile(tile); |
771 if (was_ready_to_draw) | 823 if (was_ready_to_draw) |
772 client_->NotifyTileStateChanged(tile); | 824 client_->NotifyTileStateChanged(tile); |
773 } | 825 } |
774 | 826 |
827 void TileManager::EnsureImageAnalysisPerformed( | |
828 const PrioritizedTile& prioritized_tile) { | |
829 Tile* tile = prioritized_tile.tile(); | |
830 if (tile->is_image_analysis_performed()) | |
831 return; | |
832 | |
833 std::vector<DrawImage> images_in_tile; | |
834 prioritized_tile.raster_source()->GetDiscardableImagesInRect( | |
835 tile->enclosing_layer_rect(), tile->contents_scale(), &images_in_tile); | |
836 WhichTree tree = tile->tiling()->tree(); | |
837 | |
838 std::vector<DrawImage> images_to_decode_before_raster; | |
839 std::vector<sk_sp<const SkImage>> images_to_checker; | |
840 for (auto& draw_image : images_in_tile) { | |
841 if (checker_image_tracker_.ShouldCheckerImage(draw_image.image(), tree)) | |
842 images_to_checker.push_back(draw_image.image()); | |
843 else | |
844 images_to_decode_before_raster.push_back(draw_image); | |
845 } | |
846 tile->SetImageAnalysisResult(std::move(images_to_decode_before_raster), | |
847 std::move(images_to_checker)); | |
848 } | |
849 | |
775 void TileManager::ScheduleTasks( | 850 void TileManager::ScheduleTasks( |
776 const PrioritizedWorkToSchedule& work_to_schedule) { | 851 const PrioritizedWorkToSchedule& work_to_schedule) { |
777 const std::vector<PrioritizedTile>& tiles_that_need_to_be_rasterized = | 852 const std::vector<PrioritizedTile>& tiles_that_need_to_be_rasterized = |
778 work_to_schedule.tiles_to_raster; | 853 work_to_schedule.tiles_to_raster; |
779 TRACE_EVENT1("cc", "TileManager::ScheduleTasks", "count", | 854 TRACE_EVENT1("cc", "TileManager::ScheduleTasks", "count", |
780 tiles_that_need_to_be_rasterized.size()); | 855 tiles_that_need_to_be_rasterized.size()); |
781 | 856 |
782 DCHECK(did_check_for_completed_tasks_since_last_schedule_tasks_); | 857 DCHECK(did_check_for_completed_tasks_since_last_schedule_tasks_); |
783 | 858 |
784 if (!has_scheduled_tile_tasks_) { | 859 if (!has_scheduled_tile_tasks_) { |
(...skipping 29 matching lines...) Expand all Loading... | |
814 CreateTaskSetFinishedTask(&TileManager::DidFinishRunningAllTileTasks); | 889 CreateTaskSetFinishedTask(&TileManager::DidFinishRunningAllTileTasks); |
815 | 890 |
816 // Build a new task queue containing all task currently needed. Tasks | 891 // Build a new task queue containing all task currently needed. Tasks |
817 // are added in order of priority, highest priority task first. | 892 // are added in order of priority, highest priority task first. |
818 for (auto& prioritized_tile : tiles_that_need_to_be_rasterized) { | 893 for (auto& prioritized_tile : tiles_that_need_to_be_rasterized) { |
819 Tile* tile = prioritized_tile.tile(); | 894 Tile* tile = prioritized_tile.tile(); |
820 | 895 |
821 DCHECK(tile->draw_info().requires_resource()); | 896 DCHECK(tile->draw_info().requires_resource()); |
822 DCHECK(!tile->draw_info().resource()); | 897 DCHECK(!tile->draw_info().resource()); |
823 | 898 |
824 if (!tile->raster_task_) { | 899 // Raster task for these tiles should be created in AssignGpuMemoryToTiles. |
825 tile->raster_task_ = | 900 DCHECK(tile->HasRasterTask()); |
826 CreateRasterTask(prioritized_tile, raster_color_space); | |
827 } | |
828 | 901 |
829 TileTask* task = tile->raster_task_.get(); | 902 TileTask* task = tile->raster_task_.get(); |
830 | 903 |
831 DCHECK(!task->HasCompleted()); | 904 DCHECK(!task->HasCompleted()); |
832 | 905 |
833 if (tile->required_for_activation()) { | 906 if (tile->required_for_activation()) { |
834 required_for_activate_count++; | 907 required_for_activate_count++; |
835 graph_.edges.push_back( | 908 graph_.edges.push_back( |
836 TaskGraph::Edge(task, required_for_activation_done_task.get())); | 909 TaskGraph::Edge(task, required_for_activation_done_task.get())); |
837 } | 910 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
869 } | 942 } |
870 | 943 |
871 // TODO(vmpstr): SOON is misleading here, but these images can come from | 944 // TODO(vmpstr): SOON is misleading here, but these images can come from |
872 // several diffent tiles. Rethink what we actually want to trace here. Note | 945 // several diffent tiles. Rethink what we actually want to trace here. Note |
873 // that I'm using SOON, since it can't be NOW (these are prepaint). | 946 // that I'm using SOON, since it can't be NOW (these are prepaint). |
874 ImageDecodeCache::TracingInfo tracing_info(prepare_tiles_count_, | 947 ImageDecodeCache::TracingInfo tracing_info(prepare_tiles_count_, |
875 TilePriority::SOON); | 948 TilePriority::SOON); |
876 std::vector<scoped_refptr<TileTask>> new_locked_image_tasks = | 949 std::vector<scoped_refptr<TileTask>> new_locked_image_tasks = |
877 image_controller_.SetPredecodeImages(std::move(new_locked_images), | 950 image_controller_.SetPredecodeImages(std::move(new_locked_images), |
878 tracing_info); | 951 tracing_info); |
879 | |
880 for (auto& task : new_locked_image_tasks) { | 952 for (auto& task : new_locked_image_tasks) { |
881 auto decode_it = std::find_if(graph_.nodes.begin(), graph_.nodes.end(), | 953 auto decode_it = std::find_if(graph_.nodes.begin(), graph_.nodes.end(), |
882 [&task](const TaskGraph::Node& node) { | 954 [&task](const TaskGraph::Node& node) { |
883 return node.task == task.get(); | 955 return node.task == task.get(); |
884 }); | 956 }); |
885 // If this task is already in the graph, then we don't have to insert it. | 957 // If this task is already in the graph, then we don't have to insert it. |
886 if (decode_it != graph_.nodes.end()) | 958 if (decode_it != graph_.nodes.end()) |
887 continue; | 959 continue; |
888 | 960 |
889 InsertNodeForDecodeTask(&graph_, task.get(), false, priority++); | 961 InsertNodeForDecodeTask(&graph_, task.get(), false, priority++); |
(...skipping 28 matching lines...) Expand all Loading... | |
918 kAllDoneTaskPriority, all_count); | 990 kAllDoneTaskPriority, all_count); |
919 | 991 |
920 // Synchronize worker with compositor. | 992 // Synchronize worker with compositor. |
921 raster_buffer_provider_->OrderingBarrier(); | 993 raster_buffer_provider_->OrderingBarrier(); |
922 | 994 |
923 // Schedule running of |raster_queue_|. This replaces any previously | 995 // Schedule running of |raster_queue_|. This replaces any previously |
924 // scheduled tasks and effectively cancels all tasks not present | 996 // scheduled tasks and effectively cancels all tasks not present |
925 // in |raster_queue_|. | 997 // in |raster_queue_|. |
926 tile_task_manager_->ScheduleTasks(&graph_); | 998 tile_task_manager_->ScheduleTasks(&graph_); |
927 | 999 |
1000 // Schedule running of the checker-image decode queue. This replaces the | |
1001 // previously scheduled queue and effectively cancels image decodes from the | |
1002 // previous queue, if not already started. | |
1003 checker_image_tracker_.ScheduleImageDecodeQueue( | |
1004 std::move(work_to_schedule.checker_image_decode_queue)); | |
1005 | |
928 did_check_for_completed_tasks_since_last_schedule_tasks_ = false; | 1006 did_check_for_completed_tasks_since_last_schedule_tasks_ = false; |
929 | 1007 |
930 TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state", | 1008 TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state", |
931 ScheduledTasksStateAsValue()); | 1009 ScheduledTasksStateAsValue()); |
932 } | 1010 } |
933 | 1011 |
934 scoped_refptr<TileTask> TileManager::CreateRasterTask( | 1012 scoped_refptr<TileTask> TileManager::CreateRasterTask( |
935 const PrioritizedTile& prioritized_tile, | 1013 const PrioritizedTile& prioritized_tile, |
936 const gfx::ColorSpace& color_space) { | 1014 const gfx::ColorSpace& color_space, |
1015 CheckerImageTracker::ImageDecodeQueue* checker_image_decode_queue) { | |
937 Tile* tile = prioritized_tile.tile(); | 1016 Tile* tile = prioritized_tile.tile(); |
1017 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | |
1018 "TileManager::CreateRasterTask", "Tile", tile->id()); | |
938 | 1019 |
939 // Get the resource. | 1020 // Get the resource. |
940 uint64_t resource_content_id = 0; | 1021 uint64_t resource_content_id = 0; |
941 Resource* resource = nullptr; | 1022 Resource* resource = nullptr; |
942 gfx::Rect invalidated_rect = tile->invalidated_content_rect(); | 1023 gfx::Rect invalidated_rect = tile->invalidated_content_rect(); |
943 if (UsePartialRaster() && tile->invalidated_id()) { | 1024 if (UsePartialRaster() && tile->invalidated_id()) { |
944 resource = resource_pool_->TryAcquireResourceForPartialRaster( | 1025 resource = resource_pool_->TryAcquireResourceForPartialRaster( |
945 tile->id(), tile->invalidated_content_rect(), tile->invalidated_id(), | 1026 tile->id(), tile->invalidated_content_rect(), tile->invalidated_id(), |
946 &invalidated_rect); | 1027 &invalidated_rect); |
947 } | 1028 } |
948 | 1029 |
949 if (resource) { | 1030 if (resource) { |
950 resource_content_id = tile->invalidated_id(); | 1031 resource_content_id = tile->invalidated_id(); |
951 DCHECK_EQ(DetermineResourceFormat(tile), resource->format()); | 1032 DCHECK_EQ(DetermineResourceFormat(tile), resource->format()); |
952 } else { | 1033 } else { |
953 resource = resource_pool_->AcquireResource(tile->desired_texture_size(), | 1034 resource = resource_pool_->AcquireResource(tile->desired_texture_size(), |
954 DetermineResourceFormat(tile), | 1035 DetermineResourceFormat(tile), |
955 color_space); | 1036 color_space); |
956 } | 1037 } |
957 | 1038 |
958 // For LOW_RESOLUTION tiles, we don't draw or predecode images. | 1039 // For LOW_RESOLUTION tiles, we don't draw or predecode images. |
959 RasterSource::PlaybackSettings playback_settings; | 1040 RasterSource::PlaybackSettings playback_settings; |
960 playback_settings.skip_images = | 1041 playback_settings.skip_images = |
961 prioritized_tile.priority().resolution == LOW_RESOLUTION; | 1042 prioritized_tile.priority().resolution == LOW_RESOLUTION; |
962 | 1043 |
963 // Create and queue all image decode tasks that this tile depends on. | 1044 // Create and queue all image decode tasks that this tile depends on. Note |
1045 // that we need to store the images for decode tasks in | |
1046 // |scheduled_draw_images_| since the tile might have been destroyed by the | |
1047 // time the raster task finishes. | |
964 TileTask::Vector decode_tasks; | 1048 TileTask::Vector decode_tasks; |
965 std::vector<DrawImage>& images = scheduled_draw_images_[tile->id()]; | 1049 std::vector<DrawImage>& images_to_decode_for_raster = |
966 ImageIdFlatSet images_to_skip; | 1050 scheduled_draw_images_[tile->id()]; |
967 images.clear(); | 1051 images_to_decode_for_raster.clear(); |
968 if (!playback_settings.skip_images) { | 1052 if (!playback_settings.skip_images) { |
969 prioritized_tile.raster_source()->GetDiscardableImagesInRect( | 1053 EnsureImageAnalysisPerformed(prioritized_tile); |
970 tile->enclosing_layer_rect(), tile->contents_scale(), &images); | 1054 images_to_decode_for_raster = tile->images_to_decode_before_raster(); |
971 checker_image_tracker_.FilterImagesForCheckeringForTile( | 1055 for (const auto& image : tile->images_to_checker()) { |
972 &images, &images_to_skip, prioritized_tile.tile()->tiling()->tree()); | 1056 ImageId image_id = image->uniqueID(); |
1057 playback_settings.images_to_skip.insert(image_id); | |
1058 checker_image_decode_queue->push_back(image); | |
1059 } | |
973 } | 1060 } |
974 | 1061 |
975 // We can skip the image hijack canvas if we have no images, or no images to | 1062 // We can skip the image hijack canvas if we have no images, or no images to |
976 // skip during raster. | 1063 // skip during raster. |
977 playback_settings.use_image_hijack_canvas = | 1064 playback_settings.use_image_hijack_canvas = |
978 !images.empty() || !images_to_skip.empty(); | 1065 !images_to_decode_for_raster.empty() || |
979 playback_settings.images_to_skip = std::move(images_to_skip); | 1066 !playback_settings.images_to_skip.empty(); |
1067 tile->set_raster_task_scheduled_with_checker_images( | |
1068 !playback_settings.images_to_skip.empty()); | |
980 | 1069 |
981 // Get the tasks for the required images. | 1070 // Get the tasks for the required images. |
982 ImageDecodeCache::TracingInfo tracing_info( | 1071 ImageDecodeCache::TracingInfo tracing_info( |
983 prepare_tiles_count_, prioritized_tile.priority().priority_bin); | 1072 prepare_tiles_count_, prioritized_tile.priority().priority_bin); |
984 image_controller_.GetTasksForImagesAndRef(&images, &decode_tasks, | 1073 image_controller_.GetTasksForImagesAndRef(&images_to_decode_for_raster, |
985 tracing_info); | 1074 &decode_tasks, tracing_info); |
986 | 1075 |
987 std::unique_ptr<RasterBuffer> raster_buffer = | 1076 std::unique_ptr<RasterBuffer> raster_buffer = |
988 raster_buffer_provider_->AcquireBufferForRaster( | 1077 raster_buffer_provider_->AcquireBufferForRaster( |
989 resource, resource_content_id, tile->invalidated_id()); | 1078 resource, resource_content_id, tile->invalidated_id()); |
990 return make_scoped_refptr(new RasterTaskImpl( | 1079 return make_scoped_refptr(new RasterTaskImpl( |
991 this, tile, resource, prioritized_tile.raster_source(), playback_settings, | 1080 this, tile, resource, prioritized_tile.raster_source(), playback_settings, |
992 prioritized_tile.priority().resolution, invalidated_rect, | 1081 prioritized_tile.priority().resolution, invalidated_rect, |
993 prepare_tiles_count_, std::move(raster_buffer), &decode_tasks, | 1082 prepare_tiles_count_, std::move(raster_buffer), &decode_tasks, |
994 use_gpu_rasterization_)); | 1083 use_gpu_rasterization_)); |
995 } | 1084 } |
996 | 1085 |
997 void TileManager::ResetSignalsForTesting() { | 1086 void TileManager::ResetSignalsForTesting() { |
998 signals_.reset(); | 1087 signals_.reset(); |
999 } | 1088 } |
1000 | 1089 |
1001 void TileManager::OnRasterTaskCompleted( | 1090 void TileManager::OnRasterTaskCompleted( |
1002 std::unique_ptr<RasterBuffer> raster_buffer, | 1091 std::unique_ptr<RasterBuffer> raster_buffer, |
1003 Tile::Id tile_id, | 1092 Tile::Id tile_id, |
1004 Resource* resource, | 1093 Resource* resource, |
1005 bool was_canceled) { | 1094 bool was_canceled) { |
1006 raster_buffer_provider_->ReleaseBufferForRaster(std::move(raster_buffer)); | 1095 raster_buffer_provider_->ReleaseBufferForRaster(std::move(raster_buffer)); |
1007 | 1096 |
1008 auto found = tiles_.find(tile_id); | 1097 auto found = tiles_.find(tile_id); |
1009 Tile* tile = nullptr; | 1098 Tile* tile = nullptr; |
1099 bool raster_task_was_scheduled_with_checker_images = false; | |
1010 if (found != tiles_.end()) { | 1100 if (found != tiles_.end()) { |
1011 tile = found->second; | 1101 tile = found->second; |
1012 DCHECK(tile->raster_task_.get()); | 1102 DCHECK(tile->raster_task_.get()); |
1013 tile->raster_task_ = nullptr; | 1103 tile->raster_task_ = nullptr; |
1104 raster_task_was_scheduled_with_checker_images = | |
1105 tile->set_raster_task_scheduled_with_checker_images(false); | |
1014 } | 1106 } |
1015 | 1107 |
1016 // Unref all the images. | 1108 // Unref all the images. |
1017 auto images_it = scheduled_draw_images_.find(tile_id); | 1109 auto images_it = scheduled_draw_images_.find(tile_id); |
1018 image_controller_.UnrefImages(images_it->second); | 1110 image_controller_.UnrefImages(images_it->second); |
1019 scheduled_draw_images_.erase(images_it); | 1111 scheduled_draw_images_.erase(images_it); |
1020 | 1112 |
1021 if (was_canceled) { | 1113 if (was_canceled) { |
1022 ++flush_stats_.canceled_count; | 1114 ++flush_stats_.canceled_count; |
1023 resource_pool_->ReleaseResource(resource); | 1115 resource_pool_->ReleaseResource(resource); |
1024 return; | 1116 return; |
1025 } | 1117 } |
1026 | 1118 |
1027 resource_pool_->OnContentReplaced(resource->id(), tile_id); | 1119 resource_pool_->OnContentReplaced(resource->id(), tile_id); |
1028 ++flush_stats_.completed_count; | 1120 ++flush_stats_.completed_count; |
1029 | 1121 |
1030 if (!tile) { | 1122 if (!tile) { |
1031 resource_pool_->ReleaseResource(resource); | 1123 resource_pool_->ReleaseResource(resource); |
1032 return; | 1124 return; |
1033 } | 1125 } |
1034 | 1126 |
1035 TileDrawInfo& draw_info = tile->draw_info(); | 1127 TileDrawInfo& draw_info = tile->draw_info(); |
1036 draw_info.set_resource(resource); | 1128 draw_info.set_resource(resource, |
1129 raster_task_was_scheduled_with_checker_images); | |
1037 draw_info.contents_swizzled_ = DetermineResourceRequiresSwizzle(tile); | 1130 draw_info.contents_swizzled_ = DetermineResourceRequiresSwizzle(tile); |
1038 | 1131 |
1039 // In SMOOTHNESS_TAKES_PRIORITY mode, we wait for GPU work to complete for a | 1132 // In SMOOTHNESS_TAKES_PRIORITY mode, we wait for GPU work to complete for a |
1040 // tile before setting it as ready to draw. | 1133 // tile before setting it as ready to draw. |
1041 if (global_state_.tree_priority == SMOOTHNESS_TAKES_PRIORITY && | 1134 if (global_state_.tree_priority == SMOOTHNESS_TAKES_PRIORITY && |
1042 !raster_buffer_provider_->IsResourceReadyToDraw(resource->id())) { | 1135 !raster_buffer_provider_->IsResourceReadyToDraw(resource->id())) { |
1043 pending_gpu_work_tiles_.insert(tile); | 1136 pending_gpu_work_tiles_.insert(tile); |
1044 return; | 1137 return; |
1045 } | 1138 } |
1046 | 1139 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1432 all_tile_tasks_completed = false; | 1525 all_tile_tasks_completed = false; |
1433 did_notify_all_tile_tasks_completed = false; | 1526 did_notify_all_tile_tasks_completed = false; |
1434 } | 1527 } |
1435 | 1528 |
1436 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; | 1529 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; |
1437 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( | 1530 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( |
1438 PrioritizedWorkToSchedule&& other) = default; | 1531 PrioritizedWorkToSchedule&& other) = default; |
1439 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; | 1532 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; |
1440 | 1533 |
1441 } // namespace cc | 1534 } // namespace cc |
OLD | NEW |