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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 managed_tile_state.picture_pile_analysis.solid_color); | 629 managed_tile_state.picture_pile_analysis.solid_color); |
630 DidFinishTileInitialization(tile); | 630 DidFinishTileInitialization(tile); |
631 } else if (managed_tile_state.picture_pile_analysis.is_transparent) { | 631 } else if (managed_tile_state.picture_pile_analysis.is_transparent) { |
632 tile->drawing_info().set_transparent(); | 632 tile->drawing_info().set_transparent(); |
633 DidFinishTileInitialization(tile); | 633 DidFinishTileInitialization(tile); |
634 } | 634 } |
635 } | 635 } |
636 } | 636 } |
637 | 637 |
638 void TileManager::GatherPixelRefsForTile(Tile* tile) { | 638 void TileManager::GatherPixelRefsForTile(Tile* tile) { |
| 639 // TODO(vmpstr): Remove this function and pending_pixel_refs |
| 640 // when reveman's improvements to worker pool go in. |
639 TRACE_EVENT0("cc", "TileManager::GatherPixelRefsForTile"); | 641 TRACE_EVENT0("cc", "TileManager::GatherPixelRefsForTile"); |
640 ManagedTileState& managed_tile_state = tile->managed_state(); | 642 ManagedTileState& managed_tile_state = tile->managed_state(); |
641 if (managed_tile_state.need_to_gather_pixel_refs) { | 643 if (managed_tile_state.need_to_gather_pixel_refs) { |
642 base::TimeTicks start_time = | 644 base::TimeTicks start_time = |
643 rendering_stats_instrumentation_->StartRecording(); | 645 rendering_stats_instrumentation_->StartRecording(); |
644 tile->picture_pile()->GatherPixelRefs( | 646 for (PicturePileImpl::PixelRefIterator pixel_ref_iter( |
645 tile->content_rect_, | 647 tile->content_rect(), |
646 tile->contents_scale_, | 648 tile->contents_scale(), |
647 managed_tile_state.pending_pixel_refs); | 649 tile->picture_pile()); |
| 650 pixel_ref_iter; |
| 651 ++pixel_ref_iter) { |
| 652 managed_tile_state.pending_pixel_refs.push_back(*pixel_ref_iter); |
| 653 } |
648 managed_tile_state.need_to_gather_pixel_refs = false; | 654 managed_tile_state.need_to_gather_pixel_refs = false; |
649 base::TimeDelta duration = | 655 base::TimeDelta duration = |
650 rendering_stats_instrumentation_->EndRecording(start_time); | 656 rendering_stats_instrumentation_->EndRecording(start_time); |
651 rendering_stats_instrumentation_->AddImageGathering(duration); | 657 rendering_stats_instrumentation_->AddImageGathering(duration); |
652 } | 658 } |
653 } | 659 } |
654 | 660 |
655 void TileManager::DispatchImageDecodeTasksForTile(Tile* tile) { | 661 void TileManager::DispatchImageDecodeTasksForTile(Tile* tile) { |
656 GatherPixelRefsForTile(tile); | 662 GatherPixelRefsForTile(tile); |
657 std::list<skia::LazyPixelRef*>& pending_pixel_refs = | 663 std::list<skia::LazyPixelRef*>& pending_pixel_refs = |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 // of this could be that this tile is no longer allowed to use gpu | 813 // of this could be that this tile is no longer allowed to use gpu |
808 // memory and in that case we need to abort initialization and free all | 814 // memory and in that case we need to abort initialization and free all |
809 // associated resources before calling DispatchMoreTasks(). | 815 // associated resources before calling DispatchMoreTasks(). |
810 if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_) | 816 if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_) |
811 AssignGpuMemoryToTiles(); | 817 AssignGpuMemoryToTiles(); |
812 | 818 |
813 ManagedTileState& managed_tile_state = tile->managed_state(); | 819 ManagedTileState& managed_tile_state = tile->managed_state(); |
814 | 820 |
815 // Finish resource initialization if |can_use_gpu_memory| is true. | 821 // Finish resource initialization if |can_use_gpu_memory| is true. |
816 if (managed_tile_state.can_use_gpu_memory) { | 822 if (managed_tile_state.can_use_gpu_memory) { |
817 | |
818 // Tile resources can't be freed until upload has completed. | 823 // Tile resources can't be freed until upload has completed. |
819 tile->drawing_info().can_be_freed_ = false; | 824 tile->drawing_info().can_be_freed_ = false; |
820 | 825 |
821 resource_pool_->resource_provider()->BeginSetPixels(resource->id()); | 826 resource_pool_->resource_provider()->BeginSetPixels(resource->id()); |
822 has_performed_uploads_since_last_flush_ = true; | 827 has_performed_uploads_since_last_flush_ = true; |
823 | 828 |
824 tile->drawing_info().resource_ = resource.Pass(); | 829 tile->drawing_info().resource_ = resource.Pass(); |
825 | 830 |
826 bytes_pending_upload_ += tile->bytes_consumed_if_allocated(); | 831 bytes_pending_upload_ += tile->bytes_consumed_if_allocated(); |
827 tiles_with_pending_upload_.push(tile); | 832 tiles_with_pending_upload_.push(tile); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 skia::LazyPixelRef* pixel_ref, | 981 skia::LazyPixelRef* pixel_ref, |
977 RenderingStatsInstrumentation* stats_instrumentation) { | 982 RenderingStatsInstrumentation* stats_instrumentation) { |
978 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); | 983 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
979 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 984 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
980 pixel_ref->Decode(); | 985 pixel_ref->Decode(); |
981 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); | 986 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
982 stats_instrumentation->AddDeferredImageDecode(duration); | 987 stats_instrumentation->AddDeferredImageDecode(duration); |
983 } | 988 } |
984 | 989 |
985 } // namespace cc | 990 } // namespace cc |
OLD | NEW |