| 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 <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 DCHECK(canvas); | 118 DCHECK(canvas); |
| 119 | 119 |
| 120 base::TimeDelta prev_rasterize_time = | 120 base::TimeDelta prev_rasterize_time = |
| 121 rendering_stats_->impl_thread_rendering_stats().rasterize_time; | 121 rendering_stats_->impl_thread_rendering_stats().rasterize_time; |
| 122 | 122 |
| 123 // Only record rasterization time for highres tiles, because | 123 // Only record rasterization time for highres tiles, because |
| 124 // lowres tiles are not required for activation and therefore | 124 // lowres tiles are not required for activation and therefore |
| 125 // introduce noise in the measurement (sometimes they get rasterized | 125 // introduce noise in the measurement (sometimes they get rasterized |
| 126 // before we draw and sometimes they aren't) | 126 // before we draw and sometimes they aren't) |
| 127 RenderingStatsInstrumentation* stats = | 127 RenderingStatsInstrumentation* stats = |
| 128 tile_resolution_ == HIGH_RESOLUTION ? rendering_stats_ : NULL; | 128 tile_resolution_ == HIGH_RESOLUTION ? rendering_stats_ : nullptr; |
| 129 DCHECK(picture_pile); | 129 DCHECK(picture_pile); |
| 130 picture_pile->RasterToBitmap( | 130 picture_pile->RasterToBitmap( |
| 131 canvas.get(), content_rect_, contents_scale_, stats); | 131 canvas.get(), content_rect_, contents_scale_, stats); |
| 132 | 132 |
| 133 if (rendering_stats_->record_rendering_stats()) { | 133 if (rendering_stats_->record_rendering_stats()) { |
| 134 base::TimeDelta current_rasterize_time = | 134 base::TimeDelta current_rasterize_time = |
| 135 rendering_stats_->impl_thread_rendering_stats().rasterize_time; | 135 rendering_stats_->impl_thread_rendering_stats().rasterize_time; |
| 136 LOCAL_HISTOGRAM_CUSTOM_COUNTS( | 136 LOCAL_HISTOGRAM_CUSTOM_COUNTS( |
| 137 "Renderer4.PictureRasterTimeUS", | 137 "Renderer4.PictureRasterTimeUS", |
| 138 (current_rasterize_time - prev_rasterize_time).InMicroseconds(), | 138 (current_rasterize_time - prev_rasterize_time).InMicroseconds(), |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 Tile::Id tile_id, | 783 Tile::Id tile_id, |
| 784 scoped_ptr<ScopedResource> resource, | 784 scoped_ptr<ScopedResource> resource, |
| 785 const PicturePileImpl::Analysis& analysis, | 785 const PicturePileImpl::Analysis& analysis, |
| 786 bool was_canceled) { | 786 bool was_canceled) { |
| 787 DCHECK(tiles_.find(tile_id) != tiles_.end()); | 787 DCHECK(tiles_.find(tile_id) != tiles_.end()); |
| 788 | 788 |
| 789 Tile* tile = tiles_[tile_id]; | 789 Tile* tile = tiles_[tile_id]; |
| 790 ManagedTileState& mts = tile->managed_state(); | 790 ManagedTileState& mts = tile->managed_state(); |
| 791 DCHECK(mts.raster_task.get()); | 791 DCHECK(mts.raster_task.get()); |
| 792 orphan_raster_tasks_.push_back(mts.raster_task); | 792 orphan_raster_tasks_.push_back(mts.raster_task); |
| 793 mts.raster_task = NULL; | 793 mts.raster_task = nullptr; |
| 794 | 794 |
| 795 if (was_canceled) { | 795 if (was_canceled) { |
| 796 ++update_visible_tiles_stats_.canceled_count; | 796 ++update_visible_tiles_stats_.canceled_count; |
| 797 resource_pool_->ReleaseResource(resource.Pass()); | 797 resource_pool_->ReleaseResource(resource.Pass()); |
| 798 return; | 798 return; |
| 799 } | 799 } |
| 800 | 800 |
| 801 ++update_visible_tiles_stats_.completed_count; | 801 ++update_visible_tiles_stats_.completed_count; |
| 802 | 802 |
| 803 if (analysis.is_solid_color) { | 803 if (analysis.is_solid_color) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 result -= other; | 908 result -= other; |
| 909 return result; | 909 return result; |
| 910 } | 910 } |
| 911 | 911 |
| 912 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 912 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
| 913 return memory_bytes_ > limit.memory_bytes_ || | 913 return memory_bytes_ > limit.memory_bytes_ || |
| 914 resource_count_ > limit.resource_count_; | 914 resource_count_ > limit.resource_count_; |
| 915 } | 915 } |
| 916 | 916 |
| 917 } // namespace cc | 917 } // namespace cc |
| OLD | NEW |