Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: cc/resources/tile_manager.cc

Issue 14230007: cc: Do GatherPixelRefs from skia at record time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed gather to iterators Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« cc/resources/picture.cc ('K') | « cc/resources/picture_pile_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 PicturePileImpl::LazyPixelRefsIterator 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 while (pixel_ref_iter) {
enne (OOO) 2013/04/22 16:47:26 subjective style nit: use a for loop for iterators
649 managed_tile_state.pending_pixel_refs.push_back(*pixel_ref_iter);
650 ++pixel_ref_iter;
651 }
648 managed_tile_state.need_to_gather_pixel_refs = false; 652 managed_tile_state.need_to_gather_pixel_refs = false;
649 base::TimeDelta duration = 653 base::TimeDelta duration =
650 rendering_stats_instrumentation_->EndRecording(start_time); 654 rendering_stats_instrumentation_->EndRecording(start_time);
651 rendering_stats_instrumentation_->AddImageGathering(duration); 655 rendering_stats_instrumentation_->AddImageGathering(duration);
652 } 656 }
653 } 657 }
654 658
655 void TileManager::DispatchImageDecodeTasksForTile(Tile* tile) { 659 void TileManager::DispatchImageDecodeTasksForTile(Tile* tile) {
656 GatherPixelRefsForTile(tile); 660 GatherPixelRefsForTile(tile);
657 std::list<skia::LazyPixelRef*>& pending_pixel_refs = 661 std::list<skia::LazyPixelRef*>& pending_pixel_refs =
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 // of this could be that this tile is no longer allowed to use gpu 811 // 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 812 // memory and in that case we need to abort initialization and free all
809 // associated resources before calling DispatchMoreTasks(). 813 // associated resources before calling DispatchMoreTasks().
810 if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_) 814 if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_)
811 AssignGpuMemoryToTiles(); 815 AssignGpuMemoryToTiles();
812 816
813 ManagedTileState& managed_tile_state = tile->managed_state(); 817 ManagedTileState& managed_tile_state = tile->managed_state();
814 818
815 // Finish resource initialization if |can_use_gpu_memory| is true. 819 // Finish resource initialization if |can_use_gpu_memory| is true.
816 if (managed_tile_state.can_use_gpu_memory) { 820 if (managed_tile_state.can_use_gpu_memory) {
817
818 // Tile resources can't be freed until upload has completed. 821 // Tile resources can't be freed until upload has completed.
819 tile->drawing_info().can_be_freed_ = false; 822 tile->drawing_info().can_be_freed_ = false;
820 823
821 resource_pool_->resource_provider()->BeginSetPixels(resource->id()); 824 resource_pool_->resource_provider()->BeginSetPixels(resource->id());
822 has_performed_uploads_since_last_flush_ = true; 825 has_performed_uploads_since_last_flush_ = true;
823 826
824 tile->drawing_info().resource_ = resource.Pass(); 827 tile->drawing_info().resource_ = resource.Pass();
825 828
826 bytes_pending_upload_ += tile->bytes_consumed_if_allocated(); 829 bytes_pending_upload_ += tile->bytes_consumed_if_allocated();
827 tiles_with_pending_upload_.push(tile); 830 tiles_with_pending_upload_.push(tile);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 skia::LazyPixelRef* pixel_ref, 979 skia::LazyPixelRef* pixel_ref,
977 RenderingStatsInstrumentation* stats_instrumentation) { 980 RenderingStatsInstrumentation* stats_instrumentation) {
978 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); 981 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask");
979 base::TimeTicks start_time = stats_instrumentation->StartRecording(); 982 base::TimeTicks start_time = stats_instrumentation->StartRecording();
980 pixel_ref->Decode(); 983 pixel_ref->Decode();
981 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); 984 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time);
982 stats_instrumentation->AddDeferredImageDecode(duration); 985 stats_instrumentation->AddDeferredImageDecode(duration);
983 } 986 }
984 987
985 } // namespace cc 988 } // namespace cc
OLDNEW
« cc/resources/picture.cc ('K') | « cc/resources/picture_pile_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698