Chromium Code Reviews| 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 } | 634 } |
| 635 } | 635 } |
| 636 } | 636 } |
| 637 | 637 |
| 638 void TileManager::GatherPixelRefsForTile(Tile* tile) { | 638 void TileManager::GatherPixelRefsForTile(Tile* tile) { |
| 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( |
| 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); | |
|
reveman
2013/04/23 14:33:24
please add a TODO about removing GatherPixelRefsFo
vmpstr
2013/04/23 20:02:23
Done.
| |
| 651 ++pixel_ref_iter; | |
|
reveman
2013/04/23 14:33:24
you're already incrementing iterator in the "for"
vmpstr
2013/04/23 20:02:23
That's a pretty big whoops. Thanks for catching it
| |
| 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); |
| 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 = |
| (...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 | 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 |