OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/playback/display_item_list.h" | 5 #include "cc/playback/display_item_list.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/memory/ptr_util.h" |
11 #include "cc/output/filter_operation.h" | 12 #include "cc/output/filter_operation.h" |
12 #include "cc/output/filter_operations.h" | 13 #include "cc/output/filter_operations.h" |
13 #include "cc/playback/clip_display_item.h" | 14 #include "cc/playback/clip_display_item.h" |
14 #include "cc/playback/clip_path_display_item.h" | 15 #include "cc/playback/clip_path_display_item.h" |
15 #include "cc/playback/compositing_display_item.h" | 16 #include "cc/playback/compositing_display_item.h" |
16 #include "cc/playback/display_item_list_settings.h" | 17 #include "cc/playback/display_item_list_settings.h" |
17 #include "cc/playback/drawing_display_item.h" | 18 #include "cc/playback/drawing_display_item.h" |
18 #include "cc/playback/filter_display_item.h" | 19 #include "cc/playback/filter_display_item.h" |
19 #include "cc/playback/float_clip_display_item.h" | 20 #include "cc/playback/float_clip_display_item.h" |
20 #include "cc/playback/transform_display_item.h" | 21 #include "cc/playback/transform_display_item.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 canvas->translate(offset.x(), offset.y()); | 74 canvas->translate(offset.x(), offset.y()); |
74 canvas->drawRectCoords(3.f, 3.f, 7.f, 7.f, blue_paint); | 75 canvas->drawRectCoords(3.f, 3.f, 7.f, 7.f, blue_paint); |
75 list->CreateAndAppendItem<DrawingDisplayItem>( | 76 list->CreateAndAppendItem<DrawingDisplayItem>( |
76 kVisualRect, recorder.finishRecordingAsPicture()); | 77 kVisualRect, recorder.finishRecordingAsPicture()); |
77 } | 78 } |
78 | 79 |
79 void ValidateDisplayItemListSerialization(const gfx::Size& layer_size, | 80 void ValidateDisplayItemListSerialization(const gfx::Size& layer_size, |
80 scoped_refptr<DisplayItemList> list) { | 81 scoped_refptr<DisplayItemList> list) { |
81 list->Finalize(); | 82 list->Finalize(); |
82 | 83 |
83 scoped_ptr<FakeImageSerializationProcessor> | 84 std::unique_ptr<FakeImageSerializationProcessor> |
84 fake_image_serialization_processor = | 85 fake_image_serialization_processor = |
85 make_scoped_ptr(new FakeImageSerializationProcessor); | 86 base::WrapUnique(new FakeImageSerializationProcessor); |
86 | 87 |
87 // Serialize and deserialize the DisplayItemList. | 88 // Serialize and deserialize the DisplayItemList. |
88 proto::DisplayItemList proto; | 89 proto::DisplayItemList proto; |
89 list->ToProtobuf(&proto, fake_image_serialization_processor.get()); | 90 list->ToProtobuf(&proto, fake_image_serialization_processor.get()); |
90 scoped_refptr<DisplayItemList> new_list = DisplayItemList::CreateFromProto( | 91 scoped_refptr<DisplayItemList> new_list = DisplayItemList::CreateFromProto( |
91 proto, fake_image_serialization_processor.get()); | 92 proto, fake_image_serialization_processor.get()); |
92 | 93 |
93 EXPECT_TRUE( | 94 EXPECT_TRUE( |
94 AreDisplayListDrawingResultsSame(gfx::Rect(layer_size), list, new_list)); | 95 AreDisplayListDrawingResultsSame(gfx::Rect(layer_size), list, new_list)); |
95 } | 96 } |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 | 753 |
753 value = list->AsValue(false)->ToString(); | 754 value = list->AsValue(false)->ToString(); |
754 EXPECT_EQ(value.find("\"items\":"), std::string::npos); | 755 EXPECT_EQ(value.find("\"items\":"), std::string::npos); |
755 EXPECT_NE(value.find("\"layer_rect\":[0,0,0,0]"), std::string::npos); | 756 EXPECT_NE(value.find("\"layer_rect\":[0,0,0,0]"), std::string::npos); |
756 // There should be no skp64 entry present as the items aren't included and the | 757 // There should be no skp64 entry present as the items aren't included and the |
757 // layer rect is empty. | 758 // layer rect is empty. |
758 EXPECT_EQ(value.find("\"skp64\":"), std::string::npos); | 759 EXPECT_EQ(value.find("\"skp64\":"), std::string::npos); |
759 } | 760 } |
760 | 761 |
761 } // namespace cc | 762 } // namespace cc |
OLD | NEW |