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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 if (record_rendering_stats_ == record_rendering_stats) | 498 if (record_rendering_stats_ == record_rendering_stats) |
| 499 return; | 499 return; |
| 500 | 500 |
| 501 record_rendering_stats_ = record_rendering_stats; | 501 record_rendering_stats_ = record_rendering_stats; |
| 502 raster_worker_pool_->SetRecordRenderingStats(record_rendering_stats); | 502 raster_worker_pool_->SetRecordRenderingStats(record_rendering_stats); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void TileManager::GetRenderingStats(RenderingStats* stats) { | 505 void TileManager::GetRenderingStats(RenderingStats* stats) { |
| 506 CHECK(record_rendering_stats_); | 506 CHECK(record_rendering_stats_); |
| 507 raster_worker_pool_->GetRenderingStats(stats); | 507 raster_worker_pool_->GetRenderingStats(stats); |
| 508 stats->totalDeferredImageCacheHitCount = | 508 stats->total_deferred_image_cache_hit_count = |
| 509 rendering_stats_.totalDeferredImageCacheHitCount; | 509 rendering_stats_.total_deferred_image_cache_hit_count; |
| 510 stats->totalImageGatheringCount = rendering_stats_.totalImageGatheringCount; | 510 stats->total_image_gathering_count = rendering_stats_.total_image_gathering_co unt; |
|
danakj
2013/03/20 19:00:43
80 col
| |
| 511 stats->totalImageGatheringTime = | 511 stats->total_image_gathering_time = |
| 512 rendering_stats_.totalImageGatheringTime; | 512 rendering_stats_.total_image_gathering_time; |
| 513 } | 513 } |
| 514 | 514 |
| 515 bool TileManager::HasPendingWorkScheduled(WhichTree tree) const { | 515 bool TileManager::HasPendingWorkScheduled(WhichTree tree) const { |
| 516 // Always true when ManageTiles() call is pending. | 516 // Always true when ManageTiles() call is pending. |
| 517 if (manage_tiles_pending_) | 517 if (manage_tiles_pending_) |
| 518 return true; | 518 return true; |
| 519 | 519 |
| 520 for (int i = 0; i < NUM_STATES; ++i) { | 520 for (int i = 0; i < NUM_STATES; ++i) { |
| 521 switch (i) { | 521 switch (i) { |
| 522 case WAITING_FOR_RASTER_STATE: | 522 case WAITING_FOR_RASTER_STATE: |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 if (managed_tile_state.need_to_gather_pixel_refs) { | 740 if (managed_tile_state.need_to_gather_pixel_refs) { |
| 741 base::TimeTicks gather_begin_time; | 741 base::TimeTicks gather_begin_time; |
| 742 if (record_rendering_stats_) | 742 if (record_rendering_stats_) |
| 743 gather_begin_time = base::TimeTicks::HighResNow(); | 743 gather_begin_time = base::TimeTicks::HighResNow(); |
| 744 tile->picture_pile()->GatherPixelRefs( | 744 tile->picture_pile()->GatherPixelRefs( |
| 745 tile->content_rect_, | 745 tile->content_rect_, |
| 746 tile->contents_scale_, | 746 tile->contents_scale_, |
| 747 managed_tile_state.pending_pixel_refs); | 747 managed_tile_state.pending_pixel_refs); |
| 748 managed_tile_state.need_to_gather_pixel_refs = false; | 748 managed_tile_state.need_to_gather_pixel_refs = false; |
| 749 if (record_rendering_stats_) { | 749 if (record_rendering_stats_) { |
| 750 rendering_stats_.totalImageGatheringCount++; | 750 rendering_stats_.total_image_gathering_count++; |
| 751 rendering_stats_.totalImageGatheringTime += | 751 rendering_stats_.total_image_gathering_time += |
| 752 base::TimeTicks::HighResNow() - gather_begin_time; | 752 base::TimeTicks::HighResNow() - gather_begin_time; |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 } | 755 } |
| 756 | 756 |
| 757 void TileManager::DispatchImageDecodeTasksForTile(Tile* tile) { | 757 void TileManager::DispatchImageDecodeTasksForTile(Tile* tile) { |
| 758 GatherPixelRefsForTile(tile); | 758 GatherPixelRefsForTile(tile); |
| 759 std::list<skia::LazyPixelRef*>& pending_pixel_refs = | 759 std::list<skia::LazyPixelRef*>& pending_pixel_refs = |
| 760 tile->managed_state().pending_pixel_refs; | 760 tile->managed_state().pending_pixel_refs; |
| 761 std::list<skia::LazyPixelRef*>::iterator it = pending_pixel_refs.begin(); | 761 std::list<skia::LazyPixelRef*>::iterator it = pending_pixel_refs.begin(); |
| 762 while (it != pending_pixel_refs.end()) { | 762 while (it != pending_pixel_refs.end()) { |
| 763 if (pending_decode_tasks_.end() != pending_decode_tasks_.find( | 763 if (pending_decode_tasks_.end() != pending_decode_tasks_.find( |
| 764 (*it)->getGenerationID())) { | 764 (*it)->getGenerationID())) { |
| 765 ++it; | 765 ++it; |
| 766 continue; | 766 continue; |
| 767 } | 767 } |
| 768 // TODO(qinmin): passing correct image size to PrepareToDecode(). | 768 // TODO(qinmin): passing correct image size to PrepareToDecode(). |
| 769 if ((*it)->PrepareToDecode(skia::LazyPixelRef::PrepareParams())) { | 769 if ((*it)->PrepareToDecode(skia::LazyPixelRef::PrepareParams())) { |
| 770 rendering_stats_.totalDeferredImageCacheHitCount++; | 770 rendering_stats_.total_deferred_image_cache_hit_count++; |
| 771 pending_pixel_refs.erase(it++); | 771 pending_pixel_refs.erase(it++); |
| 772 } else { | 772 } else { |
| 773 if (pending_tasks_ >= max_pending_tasks_) | 773 if (pending_tasks_ >= max_pending_tasks_) |
| 774 return; | 774 return; |
| 775 DispatchOneImageDecodeTask(tile, *it); | 775 DispatchOneImageDecodeTask(tile, *it); |
| 776 ++it; | 776 ++it; |
| 777 } | 777 } |
| 778 } | 778 } |
| 779 } | 779 } |
| 780 | 780 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 997 | 997 |
| 998 base::TimeTicks begin_time; | 998 base::TimeTicks begin_time; |
| 999 if (stats) | 999 if (stats) |
| 1000 begin_time = base::TimeTicks::HighResNow(); | 1000 begin_time = base::TimeTicks::HighResNow(); |
| 1001 | 1001 |
| 1002 int64 total_pixels_rasterized = 0; | 1002 int64 total_pixels_rasterized = 0; |
| 1003 picture_pile->Raster(&canvas, rect, contents_scale, | 1003 picture_pile->Raster(&canvas, rect, contents_scale, |
| 1004 &total_pixels_rasterized); | 1004 &total_pixels_rasterized); |
| 1005 | 1005 |
| 1006 if (stats) { | 1006 if (stats) { |
| 1007 stats->totalPixelsRasterized += total_pixels_rasterized; | 1007 stats->total_pixels_rasterized += total_pixels_rasterized; |
| 1008 | 1008 |
| 1009 base::TimeTicks end_time = base::TimeTicks::HighResNow(); | 1009 base::TimeTicks end_time = base::TimeTicks::HighResNow(); |
| 1010 base::TimeDelta duration = end_time - begin_time; | 1010 base::TimeDelta duration = end_time - begin_time; |
| 1011 stats->totalRasterizeTime += duration; | 1011 stats->total_rasterize_time += duration; |
| 1012 if (metadata.is_tile_in_pending_tree_now_bin) | 1012 if (metadata.is_tile_in_pending_tree_now_bin) |
| 1013 stats->totalRasterizeTimeForNowBinsOnPendingTree += duration; | 1013 stats->total_rasterize_time_for_now_bins_on_pending_tree += duration; |
| 1014 | 1014 |
| 1015 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeMS", | 1015 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeMS", |
| 1016 duration.InMilliseconds(), | 1016 duration.InMilliseconds(), |
| 1017 0, | 1017 0, |
| 1018 10, | 1018 10, |
| 1019 10); | 1019 10); |
| 1020 | 1020 |
| 1021 if (metadata.prediction_benchmarking) { | 1021 if (metadata.prediction_benchmarking) { |
| 1022 PicturePileImpl::Analysis analysis; | 1022 PicturePileImpl::Analysis analysis; |
| 1023 picture_pile->AnalyzeInRect(rect, contents_scale, &analysis); | 1023 picture_pile->AnalyzeInRect(rect, contents_scale, &analysis); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1104 | 1104 |
| 1105 // static | 1105 // static |
| 1106 void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, | 1106 void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, |
| 1107 RenderingStats* stats) { | 1107 RenderingStats* stats) { |
| 1108 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); | 1108 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
| 1109 base::TimeTicks decode_begin_time; | 1109 base::TimeTicks decode_begin_time; |
| 1110 if (stats) | 1110 if (stats) |
| 1111 decode_begin_time = base::TimeTicks::HighResNow(); | 1111 decode_begin_time = base::TimeTicks::HighResNow(); |
| 1112 pixel_ref->Decode(); | 1112 pixel_ref->Decode(); |
| 1113 if (stats) { | 1113 if (stats) { |
| 1114 stats->totalDeferredImageDecodeCount++; | 1114 stats->total_deferred_image_decode_count++; |
| 1115 stats->totalDeferredImageDecodeTime += | 1115 stats->total_deferred_image_decode_time += |
| 1116 base::TimeTicks::HighResNow() - decode_begin_time; | 1116 base::TimeTicks::HighResNow() - decode_begin_time; |
| 1117 } | 1117 } |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 } // namespace cc | 1120 } // namespace cc |
| OLD | NEW |