summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschenney <schenney@chromium.org>2015-04-23 11:31:08 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-23 18:31:18 +0000
commit68d12cfa87a2aeffba0caa2e31e99e5c80744780 (patch)
tree13ee78a0afc6bf516766670a2b6f5cd0bb98d0c4
parente771ecf956c01834866e5c1caaad97977ca6fda4 (diff)
downloadchromium_src-68d12cfa87a2aeffba0caa2e31e99e5c80744780.zip
chromium_src-68d12cfa87a2aeffba0caa2e31e99e5c80744780.tar.gz
chromium_src-68d12cfa87a2aeffba0caa2e31e99e5c80744780.tar.bz2
Add support for painting disabled mode for Slimming Paint
Plumb the "painting disabled" mode through to disable the GraphicsContext in Slimming Paint perf testing. This mode causes Graphics Context to do no work, producing empty SkPictures for all drawing display items. This seems the best interpretation of "painting disabled". The perf results lines for slimming_paint record_time_null_canvas will go to zero after this patch, and the record_time_construction_disabled result will start appearing and be zero for non slimming paint. R=sullivan,skyostil,enne,ajuma BUG=471348 Review URL: https://codereview.chromium.org/1104433005 Cr-Commit-Position: refs/heads/master@{#326586}
-rw-r--r--cc/blink/web_content_layer_impl.cc2
-rw-r--r--cc/debug/rasterize_and_record_benchmark.cc24
-rw-r--r--cc/layers/content_layer_client.h3
-rw-r--r--cc/resources/display_list_recording_source.cc14
-rw-r--r--cc/resources/picture.cc4
-rw-r--r--cc/resources/picture_unittest.cc6
-rw-r--r--cc/resources/recording_source.h3
-rw-r--r--tools/perf/measurements/rasterize_and_record_micro.py13
8 files changed, 47 insertions, 22 deletions
diff --git a/cc/blink/web_content_layer_impl.cc b/cc/blink/web_content_layer_impl.cc
index 90d7f9b..a480a06 100644
--- a/cc/blink/web_content_layer_impl.cc
+++ b/cc/blink/web_content_layer_impl.cc
@@ -29,6 +29,8 @@ PaintingControlToWeb(
return blink::WebContentLayerClient::DisplayListConstructionDisabled;
case cc::ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED:
return blink::WebContentLayerClient::DisplayListCachingDisabled;
+ case cc::ContentLayerClient::DISPLAY_LIST_PAINTING_DISABLED:
+ return blink::WebContentLayerClient::DisplayListPaintingDisabled;
}
NOTREACHED();
return blink::WebContentLayerClient::PaintDefaultBehavior;
diff --git a/cc/debug/rasterize_and_record_benchmark.cc b/cc/debug/rasterize_and_record_benchmark.cc
index f9a48c9..4b98dfa 100644
--- a/cc/debug/rasterize_and_record_benchmark.cc
+++ b/cc/debug/rasterize_and_record_benchmark.cc
@@ -34,8 +34,12 @@ const int kTimeLimitMillis = 1;
const int kWarmupRuns = 0;
const int kTimeCheckInterval = 1;
-const char* kModeSuffixes[RecordingSource::RECORDING_MODE_COUNT] =
- {"", "_sk_null_canvas", "_painting_disabled", "_caching_disabled"};
+const char* kModeSuffixes[RecordingSource::RECORDING_MODE_COUNT] = {
+ "",
+ "_sk_null_canvas",
+ "_painting_disabled",
+ "_caching_disabled",
+ "_construction_disabled"};
} // namespace
@@ -129,6 +133,11 @@ void RasterizeAndRecordBenchmark::RunOnPictureLayer(
mode_index++) {
RecordingSource::RecordingMode mode =
static_cast<RecordingSource::RecordingMode>(mode_index);
+
+ // Not supported for SkPicture recording.
+ if (mode == RecordingSource::RECORD_WITH_CONSTRUCTION_DISABLED)
+ continue;
+
base::TimeDelta min_time = base::TimeDelta::Max();
size_t memory_used = 0;
@@ -182,15 +191,18 @@ void RasterizeAndRecordBenchmark::RunOnDisplayListLayer(
// Already setup for normal recording.
break;
case RecordingSource::RECORD_WITH_SK_NULL_CANVAS:
- // TODO(schenney): Remove this when DisplayList recording is the only
- // option. For now, fall through and disable construction.
+ // Not supported for Display List recording.
+ continue;
case RecordingSource::RECORD_WITH_PAINTING_DISABLED:
- painting_control =
- ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED;
+ painting_control = ContentLayerClient::DISPLAY_LIST_PAINTING_DISABLED;
break;
case RecordingSource::RECORD_WITH_CACHING_DISABLED:
painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED;
break;
+ case RecordingSource::RECORD_WITH_CONSTRUCTION_DISABLED:
+ painting_control =
+ ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED;
+ break;
default:
NOTREACHED();
}
diff --git a/cc/layers/content_layer_client.h b/cc/layers/content_layer_client.h
index 3a82136..86b5264 100644
--- a/cc/layers/content_layer_client.h
+++ b/cc/layers/content_layer_client.h
@@ -22,7 +22,8 @@ class CC_EXPORT ContentLayerClient {
enum PaintingControlSetting {
PAINTING_BEHAVIOR_NORMAL,
DISPLAY_LIST_CONSTRUCTION_DISABLED,
- DISPLAY_LIST_CACHING_DISABLED
+ DISPLAY_LIST_CACHING_DISABLED,
+ DISPLAY_LIST_PAINTING_DISABLED
};
virtual void PaintContents(SkCanvas* canvas,
diff --git a/cc/resources/display_list_recording_source.cc b/cc/resources/display_list_recording_source.cc
index 701db9b..1c16aca 100644
--- a/cc/resources/display_list_recording_source.cc
+++ b/cc/resources/display_list_recording_source.cc
@@ -97,26 +97,24 @@ bool DisplayListRecordingSource::UpdateAndExpandInvalidation(
case RECORD_NORMALLY:
// Already setup for normal recording.
break;
- case RECORD_WITH_SK_NULL_CANVAS:
- // TODO(schenney): Remove this when DisplayList recording is the only
- // option. For now, fall through and disable construction.
case RECORD_WITH_PAINTING_DISABLED:
- painting_control = ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED;
+ painting_control = ContentLayerClient::DISPLAY_LIST_PAINTING_DISABLED;
break;
case RECORD_WITH_CACHING_DISABLED:
painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED;
break;
+ case RECORD_WITH_CONSTRUCTION_DISABLED:
+ painting_control = ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED;
+ break;
default:
+ // case RecordingSource::RECORD_WITH_SK_NULL_CANVAS should not be reached
NOTREACHED();
}
int repeat_count = 1;
if (slow_down_raster_scale_factor_for_debug_ > 1) {
repeat_count = slow_down_raster_scale_factor_for_debug_;
- if (painting_control !=
- ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED) {
- painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED;
- }
+ painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED;
}
for (int i = 0; i < repeat_count; ++i) {
const bool use_cached_picture = true;
diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc
index 9375d7e..cd46505 100644
--- a/cc/resources/picture.cc
+++ b/cc/resources/picture.cc
@@ -199,13 +199,15 @@ void Picture::Record(ContentLayerClient* painter,
// prevent the Blink GraphicsContext object from consuming any compute
// time.
canvas = skia::AdoptRef(SkCreateNullCanvas());
- painting_control = ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED;
+ painting_control = ContentLayerClient::DISPLAY_LIST_PAINTING_DISABLED;
break;
case RecordingSource::RECORD_WITH_CACHING_DISABLED:
// This mode should give the same results as RECORD_NORMALLY.
painting_control = ContentLayerClient::DISPLAY_LIST_CACHING_DISABLED;
break;
default:
+ // case RecordingSource::RECORD_WITH_CONSTRUCTION_DISABLED should
+ // not be reached
NOTREACHED();
}
diff --git a/cc/resources/picture_unittest.cc b/cc/resources/picture_unittest.cc
index b53765c..488d7bf 100644
--- a/cc/resources/picture_unittest.cc
+++ b/cc/resources/picture_unittest.cc
@@ -160,7 +160,7 @@ TEST(PictureTest, RecordingModes) {
Picture::Create(layer_rect, &content_layer_client, tile_grid_size, false,
RecordingSource::RECORD_WITH_PAINTING_DISABLED);
EXPECT_TRUE(content_layer_client.last_canvas() != NULL);
- EXPECT_EQ(ContentLayerClient::DISPLAY_LIST_CONSTRUCTION_DISABLED,
+ EXPECT_EQ(ContentLayerClient::DISPLAY_LIST_PAINTING_DISABLED,
content_layer_client.last_painting_control());
EXPECT_TRUE(picture.get());
@@ -172,7 +172,9 @@ TEST(PictureTest, RecordingModes) {
content_layer_client.last_painting_control());
EXPECT_TRUE(picture.get());
- EXPECT_EQ(4, RecordingSource::RECORDING_MODE_COUNT);
+ // RECORD_WITH_CONSTRUCTION_DISABLED is not supported for Picture.
+
+ EXPECT_EQ(5, RecordingSource::RECORDING_MODE_COUNT);
}
} // namespace
diff --git a/cc/resources/recording_source.h b/cc/resources/recording_source.h
index ef8c033..a95ba73 100644
--- a/cc/resources/recording_source.h
+++ b/cc/resources/recording_source.h
@@ -18,11 +18,14 @@ class RasterSource;
class CC_EXPORT RecordingSource {
public:
+ // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer
+ // support a non-Slimming Paint path.
enum RecordingMode {
RECORD_NORMALLY,
RECORD_WITH_SK_NULL_CANVAS,
RECORD_WITH_PAINTING_DISABLED,
RECORD_WITH_CACHING_DISABLED,
+ RECORD_WITH_CONSTRUCTION_DISABLED,
RECORDING_MODE_COUNT, // Must be the last entry.
};
diff --git a/tools/perf/measurements/rasterize_and_record_micro.py b/tools/perf/measurements/rasterize_and_record_micro.py
index 412e263..131cc5e 100644
--- a/tools/perf/measurements/rasterize_and_record_micro.py
+++ b/tools/perf/measurements/rasterize_and_record_micro.py
@@ -87,10 +87,12 @@ class RasterizeAndRecordMicro(page_test.PageTest):
record_time_painting_disabled = data['record_time_painting_disabled_ms']
# TODO(schenney): Remove this workaround when reference builds get past
# the change that adds this comment.
- if ('record_time_caching_disabled_ms' in data):
- record_time_caching_disabled = data['record_time_caching_disabled_ms']
- else:
- record_time_caching_disabled = 0
+ record_time_caching_disabled = \
+ data.get('record_time_caching_disabled_ms', 0)
+ # TODO(schenney): Remove this workaround when reference builds get past
+ # the change that adds this comment.
+ record_time_construction_disabled = \
+ data.get('record_time_construction_disabled_ms', 0)
results.AddValue(scalar.ScalarValue(
results.current_page, 'record_time_sk_null_canvas', 'ms',
record_time_sk_null_canvas))
@@ -100,6 +102,9 @@ class RasterizeAndRecordMicro(page_test.PageTest):
results.AddValue(scalar.ScalarValue(
results.current_page, 'record_time_caching_disabled', 'ms',
record_time_caching_disabled))
+ results.AddValue(scalar.ScalarValue(
+ results.current_page, 'record_time_construction_disabled', 'ms',
+ record_time_construction_disabled))
if self._report_detailed_results:
pixels_rasterized_with_non_solid_color = \