| Index: cc/tile_manager.cc
|
| diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc
|
| index 580759f7b10521a578edd93fa7cc495a42da1f60..cbcce7150ba0b82f3918361cf5909011597b52f0 100644
|
| --- a/cc/tile_manager.cc
|
| +++ b/cc/tile_manager.cc
|
| @@ -176,7 +176,8 @@ TileManager::TileManager(
|
| TileManagerClient* client,
|
| ResourceProvider* resource_provider,
|
| size_t num_raster_threads,
|
| - bool use_cheapness_estimator)
|
| + bool use_cheapness_estimator,
|
| + bool solid_color_benchmarking)
|
| : client_(client),
|
| resource_pool_(ResourcePool::Create(resource_provider)),
|
| raster_worker_pool_(RasterWorkerPool::Create(this, num_raster_threads)),
|
| @@ -188,7 +189,8 @@ TileManager::TileManager(
|
| record_rendering_stats_(false),
|
| use_cheapness_estimator_(use_cheapness_estimator),
|
| allow_cheap_tasks_(true),
|
| - did_schedule_cheap_tasks_(false) {
|
| + did_schedule_cheap_tasks_(false),
|
| + solid_color_benchmarking_(solid_color_benchmarking) {
|
| for (int i = 0; i < NUM_STATES; ++i) {
|
| for (int j = 0; j < NUM_TREES; ++j) {
|
| for (int k = 0; k < NUM_BINS; ++k)
|
| @@ -817,6 +819,7 @@ TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata(
|
| RasterTaskMetadata metadata;
|
| const ManagedTileState& mts = tile.managed_state();
|
| metadata.use_cheapness_estimator = use_cheapness_estimator_;
|
| + metadata.solid_color_benchmarking = solid_color_benchmarking_;
|
| metadata.is_tile_in_pending_tree_now_bin =
|
| mts.tree_bin[PENDING_TREE] == NOW_BIN;
|
| metadata.tile_resolution = mts.resolution;
|
| @@ -939,7 +942,6 @@ void TileManager::RunRasterTask(uint8* buffer,
|
| int64 total_pixels_rasterized = 0;
|
| picture_pile->Raster(&canvas, rect, contents_scale,
|
| &total_pixels_rasterized);
|
| -
|
| if (stats) {
|
| stats->totalPixelsRasterized += total_pixels_rasterized;
|
|
|
| @@ -957,11 +959,22 @@ void TileManager::RunRasterTask(uint8* buffer,
|
|
|
| if (metadata.use_cheapness_estimator) {
|
| bool is_predicted_cheap =
|
| - picture_pile->IsCheapInRect(rect, contents_scale);
|
| + picture_pile->IsCheapInRect(rect, contents_scale);
|
| bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f;
|
| RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap);
|
| }
|
| }
|
| +
|
| + if (metadata.solid_color_benchmarking) {
|
| + SkColor solid_color;
|
| + bool is_predicted_solid =
|
| + picture_pile->GetColorIfSolidInRect(rect, contents_scale, &solid_color);
|
| +
|
| + RecordSolidColorPredictorResults(buffer,
|
| + rect.width() * rect.height(),
|
| + is_predicted_solid,
|
| + solid_color);
|
| + }
|
| }
|
|
|
| // static
|
| @@ -976,6 +989,48 @@ void TileManager::RecordCheapnessPredictorResults(bool is_predicted_cheap,
|
| is_predicted_cheap == is_actually_cheap);
|
| }
|
|
|
| +//static
|
| +void TileManager::RecordSolidColorPredictorResults(uint8* actual_bytes,
|
| + size_t pixel_count,
|
| + bool is_predicted_solid,
|
| + SkColor predicted_color) {
|
| + CHECK(pixel_count > 0);
|
| +
|
| + bool is_actually_solid = true;
|
| + SkColor actual_color = SkColorSetARGB(actual_bytes[3],
|
| + actual_bytes[2],
|
| + actual_bytes[1],
|
| + actual_bytes[0]);
|
| + for (int i = (pixel_count-1)*4; i >= 0; i -= 4) {
|
| + SkColor current_color = SkColorSetARGB(actual_bytes[i+3],
|
| + actual_bytes[i+2],
|
| + actual_bytes[i+1],
|
| + actual_bytes[i]);
|
| + if (current_color != actual_color) {
|
| + is_actually_solid = false;
|
| + break;
|
| + }
|
| + }
|
| +
|
| + if (is_predicted_solid && !is_actually_solid)
|
| + UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualNotSolid", true);
|
| + else if (is_predicted_solid &&
|
| + is_actually_solid &&
|
| + predicted_color != actual_color)
|
| + UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongColor", true);
|
| + else if(!is_predicted_solid && is_actually_solid)
|
| + UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualSolid", true);
|
| +
|
| + bool correct_guess = (is_predicted_solid && is_actually_solid &&
|
| + predicted_color == actual_color) ||
|
| + (!is_predicted_solid && !is_actually_solid);
|
| + UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.Accuracy", correct_guess);
|
| +
|
| + if (correct_guess)
|
| + UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsCorrectSolid",
|
| + is_predicted_solid);
|
| +}
|
| +
|
| // static
|
| void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref,
|
| RenderingStats* stats) {
|
|
|