Convert DisplayList to a value-type wrapper
Make DisplayList its own type instead of an alias,
pushing the Skia aspect behind it mostly. Removes a bunch
of manual memory management and opens the door to DisplayList
being a union type with multiple implementations
Test: builds (somehow), boots, hwuiunit passes, CtsUiRendering passes
Change-Id: I1d7806aa3afc5d9ece08b06959920078a5814c59
diff --git a/libs/hwui/tests/common/TestUtils.h b/libs/hwui/tests/common/TestUtils.h
index c1d8b76..81cc6a9 100644
--- a/libs/hwui/tests/common/TestUtils.h
+++ b/libs/hwui/tests/common/TestUtils.h
@@ -212,7 +212,8 @@
int left, int top, int right, int bottom,
std::function<void(RenderProperties& props, skiapipeline::SkiaRecordingCanvas& canvas)>
setup,
- const char* name = nullptr, skiapipeline::SkiaDisplayList* displayList = nullptr) {
+ const char* name = nullptr,
+ std::unique_ptr<skiapipeline::SkiaDisplayList> displayList = nullptr) {
sp<RenderNode> node = new RenderNode();
if (name) {
node->setName(name);
@@ -220,7 +221,7 @@
RenderProperties& props = node->mutateStagingProperties();
props.setLeftTopRightBottom(left, top, right, bottom);
if (displayList) {
- node->setStagingDisplayList(displayList);
+ node->setStagingDisplayList(DisplayList(std::move(displayList)));
}
if (setup) {
std::unique_ptr<skiapipeline::SkiaRecordingCanvas> canvas(
@@ -348,13 +349,11 @@
node->mNeedsDisplayListSync = false;
node->syncDisplayList(observer, nullptr);
}
- auto displayList = node->getDisplayList();
+ auto& displayList = node->getDisplayList();
if (displayList) {
- for (auto&& childDr :
- static_cast<skiapipeline::SkiaDisplayList*>(const_cast<DisplayList*>(displayList))
- ->mChildNodes) {
- syncHierarchyPropertiesAndDisplayListImpl(childDr.getRenderNode());
- }
+ displayList.updateChildren([](RenderNode* child) {
+ syncHierarchyPropertiesAndDisplayListImpl(child);
+ });
}
}