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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 protected: | 89 protected: |
90 ~RasterTaskImpl() override { DCHECK(!raster_buffer_); } | 90 ~RasterTaskImpl() override { DCHECK(!raster_buffer_); } |
91 | 91 |
92 private: | 92 private: |
93 void Analyze(const RasterSource* raster_source) { | 93 void Analyze(const RasterSource* raster_source) { |
94 frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task( | 94 frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task( |
95 tile_id_, tile_resolution_, source_frame_number_, layer_id_); | 95 tile_id_, tile_resolution_, source_frame_number_, layer_id_); |
96 | 96 |
97 DCHECK(raster_source); | 97 DCHECK(raster_source); |
98 | 98 |
99 raster_source->PerformSolidColorAnalysis( | 99 raster_source->PerformSolidColorAnalysis(content_rect_, contents_scale_, |
100 content_rect_, contents_scale_, &analysis_, rendering_stats_); | 100 &analysis_); |
101 | 101 |
102 // Record the solid color prediction. | 102 // Record the solid color prediction. |
103 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", | 103 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", |
104 analysis_.is_solid_color); | 104 analysis_.is_solid_color); |
105 | 105 |
106 // Clear the flag if we're not using the estimator. | 106 // Clear the flag if we're not using the estimator. |
107 analysis_.is_solid_color &= kUseColorEstimator; | 107 analysis_.is_solid_color &= kUseColorEstimator; |
108 } | 108 } |
109 | 109 |
110 void Raster(const RasterSource* raster_source) { | 110 void Raster(const RasterSource* raster_source) { |
111 frame_viewer_instrumentation::ScopedRasterTask raster_task( | 111 frame_viewer_instrumentation::ScopedRasterTask raster_task( |
112 tile_id_, tile_resolution_, source_frame_number_, layer_id_); | 112 tile_id_, tile_resolution_, source_frame_number_, layer_id_); |
113 devtools_instrumentation::ScopedLayerTask layer_task( | 113 devtools_instrumentation::ScopedLayerTask layer_task( |
114 devtools_instrumentation::kRasterTask, layer_id_); | 114 devtools_instrumentation::kRasterTask, layer_id_); |
115 | 115 |
116 base::TimeDelta prev_rasterize_time = | |
117 rendering_stats_->impl_thread_rendering_stats().rasterize_time; | |
118 | |
119 // Only record rasterization time for highres tiles, because | |
120 // lowres tiles are not required for activation and therefore | |
121 // introduce noise in the measurement (sometimes they get rasterized | |
122 // before we draw and sometimes they aren't) | |
123 RenderingStatsInstrumentation* stats = | |
124 tile_resolution_ == HIGH_RESOLUTION ? rendering_stats_ : NULL; | |
125 DCHECK(raster_source); | 116 DCHECK(raster_source); |
126 | 117 |
127 raster_buffer_->Playback( | 118 raster_buffer_->Playback(raster_source_.get(), content_rect_, |
128 raster_source_.get(), content_rect_, contents_scale_, stats); | 119 contents_scale_); |
129 | |
130 if (rendering_stats_->record_rendering_stats()) { | |
131 base::TimeDelta current_rasterize_time = | |
132 rendering_stats_->impl_thread_rendering_stats().rasterize_time; | |
133 LOCAL_HISTOGRAM_CUSTOM_COUNTS( | |
134 "Renderer4.PictureRasterTimeUS", | |
135 (current_rasterize_time - prev_rasterize_time).InMicroseconds(), | |
136 0, | |
137 100000, | |
138 100); | |
139 } | |
140 } | 120 } |
141 | 121 |
142 RasterSource::SolidColorAnalysis analysis_; | 122 RasterSource::SolidColorAnalysis analysis_; |
143 scoped_refptr<RasterSource> raster_source_; | 123 scoped_refptr<RasterSource> raster_source_; |
144 gfx::Rect content_rect_; | 124 gfx::Rect content_rect_; |
145 float contents_scale_; | 125 float contents_scale_; |
146 TileResolution tile_resolution_; | 126 TileResolution tile_resolution_; |
147 int layer_id_; | 127 int layer_id_; |
148 const void* tile_id_; | 128 const void* tile_id_; |
149 int source_frame_number_; | 129 int source_frame_number_; |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 result -= other; | 902 result -= other; |
923 return result; | 903 return result; |
924 } | 904 } |
925 | 905 |
926 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 906 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
927 return memory_bytes_ > limit.memory_bytes_ || | 907 return memory_bytes_ > limit.memory_bytes_ || |
928 resource_count_ > limit.resource_count_; | 908 resource_count_ > limit.resource_count_; |
929 } | 909 } |
930 | 910 |
931 } // namespace cc | 911 } // namespace cc |
OLD | NEW |