Commit fd8358ea authored by Fernando Serboncini's avatar Fernando Serboncini Committed by Commit Bot

Prevent dirty rect calculation every frame

Bug: 1044993
Change-Id: I14c8c09b04aba9c2e81f76792f6f9f9a8e7fbd35
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2017042
Commit-Queue: Fernando Serboncini <fserb@chromium.org>
Reviewed-by: default avatarJuanmi Huertas <juanmihd@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Auto-Submit: Fernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734564}
parent 4ed79bef
......@@ -641,8 +641,14 @@ void Canvas2DLayerBridge::FlushRecording() {
// Sample one out of every kRasterMetricProbability frames to time
// If the canvas is accelerated, we also need access to the raster_interface
bool measure_raster_metric = (raster_interface || !IsAccelerated()) &&
bernoulli_distribution_(random_generator_);
// We are using @dont_use_idle_scheduling_for_testing_ temporarily to always
// measure while testing.
const bool will_measure = dont_use_idle_scheduling_for_testing_ ||
bernoulli_distribution_(random_generator_);
const bool measure_raster_metric =
(raster_interface || !IsAccelerated()) && will_measure;
RasterTimer rasterTimer;
base::Optional<base::ElapsedTimer> timer;
// Start Recording the raster duration
......@@ -662,7 +668,9 @@ void Canvas2DLayerBridge::FlushRecording() {
SkScalar canvas_height = canvas->getLocalClipBounds().height();
DCHECK_GE(canvas_width, size_.Width());
DCHECK_GE(canvas_height, size_.Height());
CalculateDirtyRegion(canvas_width, canvas_height);
if (will_measure) {
CalculateDirtyRegion(canvas_width, canvas_height);
}
canvas->drawPicture(last_recording_);
last_record_tainted_by_write_pixels_ = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment