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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 tile->drawing_info().set_solid_color( | 628 tile->drawing_info().set_solid_color( |
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) { |
reveman
2013/04/22 19:56:06
How about we get rid of this function completely n
vmpstr
2013/04/22 22:38:16
Let's leave that as a follow-up. I would prefer th
| |
639 TRACE_EVENT0("cc", "TileManager::GatherPixelRefsForTile"); | 639 TRACE_EVENT0("cc", "TileManager::GatherPixelRefsForTile"); |
640 ManagedTileState& managed_tile_state = tile->managed_state(); | 640 ManagedTileState& managed_tile_state = tile->managed_state(); |
641 if (managed_tile_state.need_to_gather_pixel_refs) { | 641 if (managed_tile_state.need_to_gather_pixel_refs) { |
642 base::TimeTicks start_time = | 642 base::TimeTicks start_time = |
643 rendering_stats_instrumentation_->StartRecording(); | 643 rendering_stats_instrumentation_->StartRecording(); |
644 tile->picture_pile()->GatherPixelRefs( | 644 for (PicturePileImpl::LazyPixelRefIterator pixel_ref_iter( |
enne (OOO)
2013/04/22 19:10:56
Looks fine to me. I think I generally indent 5 sp
| |
645 tile->content_rect_, | 645 tile->content_rect(), |
646 tile->contents_scale_, | 646 tile->contents_scale(), |
647 managed_tile_state.pending_pixel_refs); | 647 tile->picture_pile()); |
648 pixel_ref_iter; | |
649 ++pixel_ref_iter) { | |
650 managed_tile_state.pending_pixel_refs.push_back(*pixel_ref_iter); | |
651 ++pixel_ref_iter; | |
652 } | |
648 managed_tile_state.need_to_gather_pixel_refs = false; | 653 managed_tile_state.need_to_gather_pixel_refs = false; |
649 base::TimeDelta duration = | 654 base::TimeDelta duration = |
650 rendering_stats_instrumentation_->EndRecording(start_time); | 655 rendering_stats_instrumentation_->EndRecording(start_time); |
651 rendering_stats_instrumentation_->AddImageGathering(duration); | 656 rendering_stats_instrumentation_->AddImageGathering(duration); |
reveman
2013/04/22 19:56:06
These stats should now be collected in Picture::Ga
vmpstr
2013/04/22 22:38:16
I'm not sure. It depends what we want to gather. I
reveman
2013/04/23 14:33:23
a trace event is enough to check that this is quic
| |
652 } | 657 } |
653 } | 658 } |
654 | 659 |
655 void TileManager::DispatchImageDecodeTasksForTile(Tile* tile) { | 660 void TileManager::DispatchImageDecodeTasksForTile(Tile* tile) { |
656 GatherPixelRefsForTile(tile); | 661 GatherPixelRefsForTile(tile); |
657 std::list<skia::LazyPixelRef*>& pending_pixel_refs = | 662 std::list<skia::LazyPixelRef*>& pending_pixel_refs = |
658 tile->managed_state().pending_pixel_refs; | 663 tile->managed_state().pending_pixel_refs; |
659 std::list<skia::LazyPixelRef*>::iterator it = pending_pixel_refs.begin(); | 664 std::list<skia::LazyPixelRef*>::iterator it = pending_pixel_refs.begin(); |
660 while (it != pending_pixel_refs.end()) { | 665 while (it != pending_pixel_refs.end()) { |
661 if (pending_decode_tasks_.end() != pending_decode_tasks_.find( | 666 if (pending_decode_tasks_.end() != pending_decode_tasks_.find( |
(...skipping 145 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 | 812 // 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 | 813 // memory and in that case we need to abort initialization and free all |
809 // associated resources before calling DispatchMoreTasks(). | 814 // associated resources before calling DispatchMoreTasks(). |
810 if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_) | 815 if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_) |
811 AssignGpuMemoryToTiles(); | 816 AssignGpuMemoryToTiles(); |
812 | 817 |
813 ManagedTileState& managed_tile_state = tile->managed_state(); | 818 ManagedTileState& managed_tile_state = tile->managed_state(); |
814 | 819 |
815 // Finish resource initialization if |can_use_gpu_memory| is true. | 820 // Finish resource initialization if |can_use_gpu_memory| is true. |
816 if (managed_tile_state.can_use_gpu_memory) { | 821 if (managed_tile_state.can_use_gpu_memory) { |
817 | |
818 // Tile resources can't be freed until upload has completed. | 822 // Tile resources can't be freed until upload has completed. |
819 tile->drawing_info().can_be_freed_ = false; | 823 tile->drawing_info().can_be_freed_ = false; |
820 | 824 |
821 resource_pool_->resource_provider()->BeginSetPixels(resource->id()); | 825 resource_pool_->resource_provider()->BeginSetPixels(resource->id()); |
822 has_performed_uploads_since_last_flush_ = true; | 826 has_performed_uploads_since_last_flush_ = true; |
823 | 827 |
824 tile->drawing_info().resource_ = resource.Pass(); | 828 tile->drawing_info().resource_ = resource.Pass(); |
825 | 829 |
826 bytes_pending_upload_ += tile->bytes_consumed_if_allocated(); | 830 bytes_pending_upload_ += tile->bytes_consumed_if_allocated(); |
827 tiles_with_pending_upload_.push(tile); | 831 tiles_with_pending_upload_.push(tile); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
976 skia::LazyPixelRef* pixel_ref, | 980 skia::LazyPixelRef* pixel_ref, |
977 RenderingStatsInstrumentation* stats_instrumentation) { | 981 RenderingStatsInstrumentation* stats_instrumentation) { |
978 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); | 982 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
979 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 983 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
980 pixel_ref->Decode(); | 984 pixel_ref->Decode(); |
981 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); | 985 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
982 stats_instrumentation->AddDeferredImageDecode(duration); | 986 stats_instrumentation->AddDeferredImageDecode(duration); |
983 } | 987 } |
984 | 988 |
985 } // namespace cc | 989 } // namespace cc |
OLD | NEW |