summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorenne <enne@chromium.org>2015-12-02 18:30:00 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-03 02:30:48 +0000
commit252e4b70d06a3a469f5fb53db6ecf194be8c5751 (patch)
treec7eb41c50fcc6336ee94a0dc4e9b6cc4373e75cf /cc
parent72c7269d9fbd31b4dc1aaf5fa0c29a893fde0fc1 (diff)
downloadchromium_src-252e4b70d06a3a469f5fb53db6ecf194be8c5751.zip
chromium_src-252e4b70d06a3a469f5fb53db6ecf194be8c5751.tar.gz
chromium_src-252e4b70d06a3a469f5fb53db6ecf194be8c5751.tar.bz2
cc: Fix serialization of display item lists
Display item lists currently don't support serializing flattened pictures. The tests magically got around this by waiting to "finalize" the list until after serialization (which would have cleared the display items) and never having enough items serialized to cause on-the-fly flattening (which also would have cleared). This patch moves the finalization to the place where this bug would have been exposed and just dchecks that if somebody tries to serialize a display item list that the display items have been retained, and updates the unit tests to all do that so they pass. R=dtrainor@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1494673003 Cr-Commit-Position: refs/heads/master@{#362870}
Diffstat (limited to 'cc')
-rw-r--r--cc/playback/display_item_list.cc4
-rw-r--r--cc/playback/display_item_list_unittest.cc10
2 files changed, 6 insertions, 8 deletions
diff --git a/cc/playback/display_item_list.cc b/cc/playback/display_item_list.cc
index 5b0009a..a1a9cdb 100644
--- a/cc/playback/display_item_list.cc
+++ b/cc/playback/display_item_list.cc
@@ -99,6 +99,10 @@ DisplayItemList::~DisplayItemList() {
}
void DisplayItemList::ToProtobuf(proto::DisplayItemList* proto) {
+ // The flattened SkPicture approach is going away, and the proto
+ // doesn't currently support serializing that flattened picture.
+ DCHECK(retain_individual_display_items_);
+
RectToProto(layer_rect_, proto->mutable_layer_rect());
settings_.ToProtobuf(proto->mutable_settings());
diff --git a/cc/playback/display_item_list_unittest.cc b/cc/playback/display_item_list_unittest.cc
index c2d2b43..b29baa3 100644
--- a/cc/playback/display_item_list_unittest.cc
+++ b/cc/playback/display_item_list_unittest.cc
@@ -76,6 +76,8 @@ void AppendSecondSerializationTestPicture(scoped_refptr<DisplayItemList> list,
void ValidateDisplayItemListSerialization(const gfx::Size& layer_size,
scoped_refptr<DisplayItemList> list) {
+ list->Finalize();
+
// Serialize and deserialize the DisplayItemList.
proto::DisplayItemList proto;
list->ToProtobuf(&proto);
@@ -83,7 +85,6 @@ void ValidateDisplayItemListSerialization(const gfx::Size& layer_size,
DisplayItemList::CreateFromProto(proto);
// Finalize the DisplayItemLists to perform raster.
- list->Finalize();
new_list->Finalize();
const int pixel_size = 4 * layer_size.GetArea();
@@ -127,7 +128,6 @@ TEST(DisplayItemListTest, SerializeSingleDrawingItem) {
gfx::Size layer_size(10, 10);
DisplayItemListSettings settings;
- settings.use_cached_picture = true;
scoped_refptr<DisplayItemList> list =
DisplayItemList::Create(gfx::Rect(layer_size), settings);
@@ -141,7 +141,6 @@ TEST(DisplayItemListTest, SerializeClipItem) {
gfx::Size layer_size(10, 10);
DisplayItemListSettings settings;
- settings.use_cached_picture = true;
scoped_refptr<DisplayItemList> list =
DisplayItemList::Create(gfx::Rect(layer_size), settings);
@@ -168,7 +167,6 @@ TEST(DisplayItemListTest, SerializeClipPathItem) {
gfx::Size layer_size(10, 10);
DisplayItemListSettings settings;
- settings.use_cached_picture = true;
scoped_refptr<DisplayItemList> list =
DisplayItemList::Create(gfx::Rect(layer_size), settings);
@@ -194,7 +192,6 @@ TEST(DisplayItemListTest, SerializeCompositingItem) {
gfx::Size layer_size(10, 10);
DisplayItemListSettings settings;
- settings.use_cached_picture = true;
scoped_refptr<DisplayItemList> list =
DisplayItemList::Create(gfx::Rect(layer_size), settings);
@@ -220,7 +217,6 @@ TEST(DisplayItemListTest, SerializeFloatClipItem) {
gfx::Size layer_size(10, 10);
DisplayItemListSettings settings;
- settings.use_cached_picture = true;
scoped_refptr<DisplayItemList> list =
DisplayItemList::Create(gfx::Rect(layer_size), settings);
@@ -245,7 +241,6 @@ TEST(DisplayItemListTest, SerializeTransformItem) {
gfx::Size layer_size(10, 10);
DisplayItemListSettings settings;
- settings.use_cached_picture = true;
scoped_refptr<DisplayItemList> list =
DisplayItemList::Create(gfx::Rect(layer_size), settings);
@@ -279,7 +274,6 @@ TEST(DisplayItemListTest, SingleDrawingItem) {
red_paint.setColor(SK_ColorRED);
unsigned char pixels[4 * 100 * 100] = {0};
DisplayItemListSettings settings;
- settings.use_cached_picture = true;
scoped_refptr<DisplayItemList> list =
DisplayItemList::Create(layer_rect, settings);