From 44b49f070aafe8ad44efae87341121cce49ff11c Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 25 Mar 2016 14:29:48 -0700 Subject: Add a callback for rendernode parentcount=0 Bug: 27709981 Fixes: 22565656 Change-Id: I1cb4461baf9069dc4e7ca6de10d5862578c107f4 --- libs/hwui/TreeInfo.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libs/hwui/TreeInfo.h') diff --git a/libs/hwui/TreeInfo.h b/libs/hwui/TreeInfo.h index accd3038cb9c..a43e544b4507 100644 --- a/libs/hwui/TreeInfo.h +++ b/libs/hwui/TreeInfo.h @@ -32,6 +32,7 @@ class CanvasContext; class DamageAccumulator; class LayerUpdateQueue; class OpenGLRenderer; +class RenderNode; class RenderState; class ErrorHandler { @@ -41,6 +42,17 @@ protected: ~ErrorHandler() {} }; +class TreeObserver { +public: + // Called when a RenderNode's parent count hits 0. + // Due to the unordered nature of tree pushes, once prepareTree + // is finished it is possible that the node was "resurrected" and has + // a non-zero parent count. + virtual void onMaybeRemovedFromTree(RenderNode* node) {} +protected: + ~TreeObserver() {} +}; + // This would be a struct, but we want to PREVENT_COPY_AND_ASSIGN class TreeInfo { PREVENT_COPY_AND_ASSIGN(TreeInfo); @@ -86,6 +98,10 @@ public: #endif ErrorHandler* errorHandler = nullptr; + // Optional, may be nullptr. Used to allow things to observe interesting + // tree state changes + TreeObserver* observer = nullptr; + // Frame number for use with synchronized surfaceview position updating int64_t frameNumber = -1; int32_t windowInsetLeft = 0; -- cgit v1.2.3-59-g8ed1b