blob: 45a53f9a37df85f32ff3d04bda4e0ad44e0a0820 [file] [log] [blame]
John Reck113e0822014-03-18 09:22:59 -07001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Chris Craik5e00c7c2016-07-06 16:10:09 -070016
17#pragma once
John Reck113e0822014-03-18 09:22:59 -070018
John Reck113e0822014-03-18 09:22:59 -070019#include <SkCamera.h>
20#include <SkMatrix.h>
21
John Reck113e0822014-03-18 09:22:59 -070022#include <utils/LinearAllocator.h>
23#include <utils/RefBase.h>
John Reck113e0822014-03-18 09:22:59 -070024#include <utils/String8.h>
John Reck113e0822014-03-18 09:22:59 -070025
26#include <cutils/compiler.h>
27
28#include <androidfw/ResourceTypes.h>
29
John Reck68bfe0a2014-06-24 15:34:58 -070030#include "AnimatorManager.h"
John Reck113e0822014-03-18 09:22:59 -070031#include "Debug.h"
John Reck113e0822014-03-18 09:22:59 -070032#include "DisplayList.h"
Chris Craikb565df12015-10-05 13:00:52 -070033#include "Matrix.h"
John Reck113e0822014-03-18 09:22:59 -070034#include "RenderProperties.h"
Stan Iliev021693b2016-10-17 16:26:15 -040035#include "pipeline/skia/SkiaDisplayList.h"
Stan Iliev500a0c32016-10-26 10:30:09 -040036#include "pipeline/skia/SkiaLayer.h"
John Reck2de950d2017-01-25 10:58:30 -080037#include "utils/FatVector.h"
John Reck113e0822014-03-18 09:22:59 -070038
John Reck272a6852015-07-29 16:48:58 -070039#include <vector>
40
John Reck113e0822014-03-18 09:22:59 -070041class SkBitmap;
42class SkPaint;
43class SkPath;
44class SkRegion;
Derek Sollenberger0df62092016-09-27 16:04:42 -040045class SkSurface;
John Reck113e0822014-03-18 09:22:59 -070046
47namespace android {
48namespace uirenderer {
49
Chris Craikb565df12015-10-05 13:00:52 -070050class CanvasState;
Chris Craik0b7e8242015-10-28 16:50:44 -070051class OffscreenBuffer;
Chris Craik5e00c7c2016-07-06 16:10:09 -070052class Rect;
53class SkiaShader;
Chris Craik8d1f2122015-11-24 16:40:09 -080054struct RenderNodeOp;
Chris Craik0b7e8242015-10-28 16:50:44 -070055
Tom Hudson2dc236b2014-10-15 15:46:42 -040056class TreeInfo;
John Reck44b49f02016-03-25 14:29:48 -070057class TreeObserver;
John Reck113e0822014-03-18 09:22:59 -070058
John Recke248bd12015-08-05 13:53:53 -070059namespace proto {
60class RenderNode;
61}
62
John Reck113e0822014-03-18 09:22:59 -070063/**
John Reck1bcacfd2017-11-03 10:12:19 -070064 * Primary class for storing recorded canvas commands, as well as per-View/ViewGroup display
65 * properties.
John Reck113e0822014-03-18 09:22:59 -070066 *
67 * Recording of canvas commands is somewhat similar to SkPicture, except the canvas-recording
Chris Craik5e00c7c2016-07-06 16:10:09 -070068 * functionality is split between RecordingCanvas (which manages the recording), DisplayList
69 * (which holds the actual data), and RenderNode (which holds properties used for render playback).
John Reck113e0822014-03-18 09:22:59 -070070 *
Chris Craik003cc3d2015-10-16 10:24:55 -070071 * Note that DisplayList is swapped out from beneath an individual RenderNode when a view's
72 * recorded stream of canvas operations is refreshed. The RenderNode (and its properties) stay
John Reck113e0822014-03-18 09:22:59 -070073 * attached.
74 */
John Reck087bc0c2014-04-04 16:20:08 -070075class RenderNode : public VirtualLightRefBase {
John Reck1bcacfd2017-11-03 10:12:19 -070076 friend class TestUtils; // allow TestUtils to access syncDisplayList / syncProperties
John Reck1bcacfd2017-11-03 10:12:19 -070077
John Reck113e0822014-03-18 09:22:59 -070078public:
John Reckff941dc2014-05-14 16:34:14 -070079 enum DirtyPropertyMask {
John Reck1bcacfd2017-11-03 10:12:19 -070080 GENERIC = 1 << 1,
81 TRANSLATION_X = 1 << 2,
82 TRANSLATION_Y = 1 << 3,
83 TRANSLATION_Z = 1 << 4,
84 SCALE_X = 1 << 5,
85 SCALE_Y = 1 << 6,
86 ROTATION = 1 << 7,
87 ROTATION_X = 1 << 8,
88 ROTATION_Y = 1 << 9,
89 X = 1 << 10,
90 Y = 1 << 11,
91 Z = 1 << 12,
92 ALPHA = 1 << 13,
93 DISPLAY_LIST = 1 << 14,
John Reckff941dc2014-05-14 16:34:14 -070094 };
95
John Reck113e0822014-03-18 09:22:59 -070096 ANDROID_API RenderNode();
John Recke45b1fd2014-04-15 09:50:16 -070097 ANDROID_API virtual ~RenderNode();
John Reck113e0822014-03-18 09:22:59 -070098
99 // See flags defined in DisplayList.java
John Reck1bcacfd2017-11-03 10:12:19 -0700100 enum ReplayFlag { kReplayFlag_ClipChildren = 0x1 };
John Reck113e0822014-03-18 09:22:59 -0700101
John Reck2de950d2017-01-25 10:58:30 -0800102 ANDROID_API void setStagingDisplayList(DisplayList* newData);
John Reck113e0822014-03-18 09:22:59 -0700103
sergeyvc3849aa2016-08-08 13:22:06 -0700104 ANDROID_API void output();
John Reckfe5e7b72014-05-23 17:42:28 -0700105 ANDROID_API int getDebugSize();
John Reck113e0822014-03-18 09:22:59 -0700106
John Reck1bcacfd2017-11-03 10:12:19 -0700107 bool isRenderable() const { return mDisplayList && !mDisplayList->isEmpty(); }
John Reck113e0822014-03-18 09:22:59 -0700108
John Recka447d292014-06-11 18:39:44 -0700109 bool hasProjectionReceiver() const {
Chris Craik003cc3d2015-10-16 10:24:55 -0700110 return mDisplayList && mDisplayList->projectionReceiveIndex >= 0;
John Recka447d292014-06-11 18:39:44 -0700111 }
112
John Reck1bcacfd2017-11-03 10:12:19 -0700113 const char* getName() const { return mName.string(); }
Chris Craikdefb7f32014-04-08 18:17:07 -0700114
John Reck113e0822014-03-18 09:22:59 -0700115 void setName(const char* name) {
116 if (name) {
Dan Austin71831a62016-03-24 12:03:42 -0700117 const char* lastPeriod = strrchr(name, '.');
John Reck113e0822014-03-18 09:22:59 -0700118 if (lastPeriod) {
119 mName.setTo(lastPeriod + 1);
120 } else {
121 mName.setTo(name);
122 }
123 }
124 }
125
John Reck1bcacfd2017-11-03 10:12:19 -0700126 VirtualLightRefBase* getUserContext() const { return mUserContext.get(); }
John Reck44b49f02016-03-25 14:29:48 -0700127
John Reck1bcacfd2017-11-03 10:12:19 -0700128 void setUserContext(VirtualLightRefBase* context) { mUserContext = context; }
John Reck44b49f02016-03-25 14:29:48 -0700129
John Reckff941dc2014-05-14 16:34:14 -0700130 bool isPropertyFieldDirty(DirtyPropertyMask field) const {
131 return mDirtyPropertyFields & field;
132 }
133
John Reck1bcacfd2017-11-03 10:12:19 -0700134 void setPropertyFieldsDirty(uint32_t fields) { mDirtyPropertyFields |= fields; }
John Reckff941dc2014-05-14 16:34:14 -0700135
John Reck1bcacfd2017-11-03 10:12:19 -0700136 const RenderProperties& properties() const { return mProperties; }
John Reck113e0822014-03-18 09:22:59 -0700137
John Reck1bcacfd2017-11-03 10:12:19 -0700138 RenderProperties& animatorProperties() { return mProperties; }
John Reck52244ff2014-05-01 21:27:37 -0700139
John Reck1bcacfd2017-11-03 10:12:19 -0700140 const RenderProperties& stagingProperties() { return mStagingProperties; }
John Reckd0a0b2a2014-03-20 16:28:56 -0700141
John Reck1bcacfd2017-11-03 10:12:19 -0700142 RenderProperties& mutateStagingProperties() { return mStagingProperties; }
John Reckd0a0b2a2014-03-20 16:28:56 -0700143
John Reck1bcacfd2017-11-03 10:12:19 -0700144 bool isValid() { return mValid; }
John Reck2de950d2017-01-25 10:58:30 -0800145
John Reck1bcacfd2017-11-03 10:12:19 -0700146 int getWidth() const { return properties().getWidth(); }
John Reck113e0822014-03-18 09:22:59 -0700147
John Reck1bcacfd2017-11-03 10:12:19 -0700148 int getHeight() const { return properties().getHeight(); }
John Reck113e0822014-03-18 09:22:59 -0700149
John Recke45b1fd2014-04-15 09:50:16 -0700150 ANDROID_API virtual void prepareTree(TreeInfo& info);
John Reck2de950d2017-01-25 10:58:30 -0800151 void destroyHardwareResources(TreeInfo* info = nullptr);
152 void destroyLayers();
John Recke45b1fd2014-04-15 09:50:16 -0700153
154 // UI thread only!
John Reck68bfe0a2014-06-24 15:34:58 -0700155 ANDROID_API void addAnimator(const sp<BaseRenderNodeAnimator>& animator);
Doris Liu8b083202016-02-19 21:46:06 +0000156 void removeAnimator(const sp<BaseRenderNodeAnimator>& animator);
157
158 // This can only happen during pushStaging()
159 void onAnimatorTargetChanged(BaseRenderNodeAnimator* animator) {
160 mAnimatorManager.onAnimatorTargetChanged(animator);
161 }
John Reck668f0e32014-03-26 15:10:40 -0700162
John Reck119907c2014-08-14 09:02:01 -0700163 AnimatorManager& animators() { return mAnimatorManager; }
164
Chris Craik69e5adf2014-08-14 13:34:01 -0700165 void applyViewPropertyTransforms(mat4& matrix, bool true3dTransform = false) const;
166
Chris Craikb565df12015-10-05 13:00:52 -0700167 bool nothingToDraw() const {
168 const Outline& outline = properties().getOutline();
John Reck1bcacfd2017-11-03 10:12:19 -0700169 return mDisplayList == nullptr || properties().getAlpha() <= 0 ||
170 (outline.getShouldClip() && outline.isEmpty()) || properties().getScaleX() == 0 ||
171 properties().getScaleY() == 0;
Chris Craikb565df12015-10-05 13:00:52 -0700172 }
173
John Reck1bcacfd2017-11-03 10:12:19 -0700174 const DisplayList* getDisplayList() const { return mDisplayList; }
Chris Craik0b7e8242015-10-28 16:50:44 -0700175 OffscreenBuffer* getLayer() const { return mLayer; }
John Reck1bcacfd2017-11-03 10:12:19 -0700176 OffscreenBuffer** getLayerHandle() { return &mLayer; } // ugh...
Derek Sollenberger6a21ca52016-09-28 13:39:55 -0400177 void setLayer(OffscreenBuffer* layer) { mLayer = layer; }
Chris Craikb565df12015-10-05 13:00:52 -0700178
John Reckaa6e84f2016-06-16 15:36:13 -0700179 // Note: The position callbacks are relying on the listener using
180 // the frameNumber to appropriately batch/synchronize these transactions.
181 // There is no other filtering/batching to ensure that only the "final"
182 // state called once per frame.
John Reck7b570de2016-06-27 13:27:23 -0700183 class ANDROID_API PositionListener : public VirtualLightRefBase {
John Reckf6481082016-02-02 15:18:23 -0800184 public:
185 virtual ~PositionListener() {}
John Reckaa6e84f2016-06-16 15:36:13 -0700186 // Called when the RenderNode's position changes
John Reckf6481082016-02-02 15:18:23 -0800187 virtual void onPositionUpdated(RenderNode& node, const TreeInfo& info) = 0;
John Reckaa6e84f2016-06-16 15:36:13 -0700188 // Called when the RenderNode no longer has a position. As in, it's
189 // no longer being drawn.
190 // Note, tree info might be null
191 virtual void onPositionLost(RenderNode& node, const TreeInfo* info) = 0;
John Reckf6481082016-02-02 15:18:23 -0800192 };
193
194 // Note this is not thread safe, this needs to be called
195 // before the RenderNode is used for drawing.
196 // RenderNode takes ownership of the pointer
197 ANDROID_API void setPositionListener(PositionListener* listener) {
John Reck7b570de2016-06-27 13:27:23 -0700198 mPositionListener = listener;
John Reckf6481082016-02-02 15:18:23 -0800199 }
200
John Reck44b49f02016-03-25 14:29:48 -0700201 // This is only modified in MODE_FULL, so it can be safely accessed
202 // on the UI thread.
John Reck1bcacfd2017-11-03 10:12:19 -0700203 ANDROID_API bool hasParents() { return mParentCount; }
John Reck44b49f02016-03-25 14:29:48 -0700204
John Reck2de950d2017-01-25 10:58:30 -0800205 void onRemovedFromTree(TreeInfo* info);
206
207 // Called by CanvasContext to promote a RenderNode to be a root node
John Reck1bcacfd2017-11-03 10:12:19 -0700208 void makeRoot() { incParentRefCount(); }
John Reck2de950d2017-01-25 10:58:30 -0800209
210 // Called by CanvasContext when it drops a RenderNode from being a root node
211 void clearRoot();
212
Stan Ilievd2172372017-02-09 16:59:27 -0500213 void output(std::ostream& output, uint32_t level);
214
John Reck113e0822014-03-18 09:22:59 -0700215private:
Chris Craik5e00c7c2016-07-06 16:10:09 -0700216 void computeOrderingImpl(RenderNodeOp* opState,
John Reck1bcacfd2017-11-03 10:12:19 -0700217 std::vector<RenderNodeOp*>* compositedChildrenOfProjectionSurface,
218 const mat4* transformFromProjectionSurface);
John Reck113e0822014-03-18 09:22:59 -0700219
Chris Craikb565df12015-10-05 13:00:52 -0700220 void syncProperties();
John Reck2de950d2017-01-25 10:58:30 -0800221 void syncDisplayList(TreeObserver& observer, TreeInfo* info);
Chris Craikb565df12015-10-05 13:00:52 -0700222
John Reck2de950d2017-01-25 10:58:30 -0800223 void prepareTreeImpl(TreeObserver& observer, TreeInfo& info, bool functorsNeedLayer);
John Reck25fbb3f2014-06-12 13:46:45 -0700224 void pushStagingPropertiesChanges(TreeInfo& info);
John Reck2de950d2017-01-25 10:58:30 -0800225 void pushStagingDisplayListChanges(TreeObserver& observer, TreeInfo& info);
John Recka7c2ea22014-08-08 13:21:00 -0700226 void prepareLayer(TreeInfo& info, uint32_t dirtyMask);
John Reck25fbb3f2014-06-12 13:46:45 -0700227 void pushLayerUpdate(TreeInfo& info);
John Reck2de950d2017-01-25 10:58:30 -0800228 void deleteDisplayList(TreeObserver& observer, TreeInfo* info = nullptr);
John Reck0a973302014-07-16 13:29:45 -0700229 void damageSelf(TreeInfo& info);
John Reckdcba6722014-07-08 13:59:49 -0700230
231 void incParentRefCount() { mParentCount++; }
John Reck2de950d2017-01-25 10:58:30 -0800232 void decParentRefCount(TreeObserver& observer, TreeInfo* info = nullptr);
John Reck8de65a82014-04-09 15:23:38 -0700233
John Reck113e0822014-03-18 09:22:59 -0700234 String8 mName;
John Reck44b49f02016-03-25 14:29:48 -0700235 sp<VirtualLightRefBase> mUserContext;
John Reck113e0822014-03-18 09:22:59 -0700236
John Reckff941dc2014-05-14 16:34:14 -0700237 uint32_t mDirtyPropertyFields;
John Reck113e0822014-03-18 09:22:59 -0700238 RenderProperties mProperties;
John Reckd0a0b2a2014-03-20 16:28:56 -0700239 RenderProperties mStagingProperties;
240
John Reck2de950d2017-01-25 10:58:30 -0800241 // Owned by UI. Set when DL is set, cleared when DL cleared or when node detached
242 // (likely by parent re-record/removal)
243 bool mValid = false;
244
Chris Craik003cc3d2015-10-16 10:24:55 -0700245 bool mNeedsDisplayListSync;
246 // WARNING: Do not delete this directly, you must go through deleteDisplayList()!
247 DisplayList* mDisplayList;
248 DisplayList* mStagingDisplayList;
John Reck113e0822014-03-18 09:22:59 -0700249
John Reck68bfe0a2014-06-24 15:34:58 -0700250 friend class AnimatorManager;
251 AnimatorManager mAnimatorManager;
John Recke45b1fd2014-04-15 09:50:16 -0700252
John Reck25fbb3f2014-06-12 13:46:45 -0700253 // Owned by RT. Lifecycle is managed by prepareTree(), with the exception
254 // being in ~RenderNode() which may happen on any thread.
Chris Craik5e00c7c2016-07-06 16:10:09 -0700255 OffscreenBuffer* mLayer = nullptr;
John Reck25fbb3f2014-06-12 13:46:45 -0700256
John Reck113e0822014-03-18 09:22:59 -0700257 /**
258 * Draw time state - these properties are only set and used during rendering
259 */
260
261 // for projection surfaces, contains a list of all children items
Chris Craik5e00c7c2016-07-06 16:10:09 -0700262 std::vector<RenderNodeOp*> mProjectedNodes;
John Reckdcba6722014-07-08 13:59:49 -0700263
264 // How many references our parent(s) have to us. Typically this should alternate
265 // between 2 and 1 (when a staging push happens we inc first then dec)
266 // When this hits 0 we are no longer in the tree, so any hardware resources
267 // (specifically Layers) should be released.
268 // This is *NOT* thread-safe, and should therefore only be tracking
Chris Craik003cc3d2015-10-16 10:24:55 -0700269 // mDisplayList, not mStagingDisplayList.
John Reckdcba6722014-07-08 13:59:49 -0700270 uint32_t mParentCount;
John Reckf6481082016-02-02 15:18:23 -0800271
John Reck7b570de2016-06-27 13:27:23 -0700272 sp<PositionListener> mPositionListener;
Derek Sollenberger0df62092016-09-27 16:04:42 -0400273
John Reck1bcacfd2017-11-03 10:12:19 -0700274 // METHODS & FIELDS ONLY USED BY THE SKIA RENDERER
Derek Sollenberger0df62092016-09-27 16:04:42 -0400275public:
276 /**
277 * Detach and transfer ownership of an already allocated displayList for use
278 * in recording updated content for this renderNode
279 */
Stan Iliev021693b2016-10-17 16:26:15 -0400280 std::unique_ptr<skiapipeline::SkiaDisplayList> detachAvailableList() {
Derek Sollenberger0df62092016-09-27 16:04:42 -0400281 return std::move(mAvailableDisplayList);
282 }
283
284 /**
285 * Attach unused displayList to this node for potential future reuse.
286 */
Stan Iliev021693b2016-10-17 16:26:15 -0400287 void attachAvailableList(skiapipeline::SkiaDisplayList* skiaDisplayList) {
Derek Sollenberger0df62092016-09-27 16:04:42 -0400288 mAvailableDisplayList.reset(skiaDisplayList);
289 }
290
291 /**
292 * Returns true if an offscreen layer from any renderPipeline is attached
293 * to this node.
294 */
Stan Iliev500a0c32016-10-26 10:30:09 -0400295 bool hasLayer() const { return mLayer || mSkiaLayer.get(); }
Derek Sollenberger0df62092016-09-27 16:04:42 -0400296
297 /**
298 * Used by the RenderPipeline to attach an offscreen surface to the RenderNode.
299 * The surface is then will be used to store the contents of a layer.
300 */
Stan Iliev500a0c32016-10-26 10:30:09 -0400301 void setLayerSurface(sk_sp<SkSurface> layer) {
302 if (layer.get()) {
303 if (!mSkiaLayer.get()) {
304 mSkiaLayer = std::make_unique<skiapipeline::SkiaLayer>();
305 }
306 mSkiaLayer->layerSurface = std::move(layer);
307 mSkiaLayer->inverseTransformInWindow.loadIdentity();
308 } else {
309 mSkiaLayer.reset();
310 }
311 }
Derek Sollenberger0df62092016-09-27 16:04:42 -0400312
313 /**
314 * If the RenderNode is of type LayerType::RenderLayer then this method will
315 * return the an offscreen rendering surface that is used to both render into
316 * the layer and composite the layer into its parent. If the type is not
317 * LayerType::RenderLayer then it will return a nullptr.
318 *
319 * NOTE: this function is only guaranteed to return accurate results after
320 * prepareTree has been run for this RenderNode
321 */
Stan Iliev500a0c32016-10-26 10:30:09 -0400322 SkSurface* getLayerSurface() const {
323 return mSkiaLayer.get() ? mSkiaLayer->layerSurface.get() : nullptr;
324 }
325
John Reck1bcacfd2017-11-03 10:12:19 -0700326 skiapipeline::SkiaLayer* getSkiaLayer() const { return mSkiaLayer.get(); }
Derek Sollenberger0df62092016-09-27 16:04:42 -0400327
Derek Sollenberger579317d2017-08-29 16:33:49 -0400328 /**
329 * Returns the path that represents the outline of RenderNode intersected with
330 * the provided rect. This call will internally cache the resulting path in
331 * order to potentially return that path for subsequent calls to this method.
332 * By reusing the same path we get better performance on the GPU backends since
333 * those resources are cached in the hardware based on the path's genID.
334 *
335 * The returned path is only guaranteed to be valid until this function is called
336 * again or the RenderNode's outline is mutated.
337 */
338 const SkPath* getClippedOutline(const SkRect& clipRect) const;
John Reck1bcacfd2017-11-03 10:12:19 -0700339
Derek Sollenberger0df62092016-09-27 16:04:42 -0400340private:
341 /**
342 * If this RenderNode has been used in a previous frame then the SkiaDisplayList
343 * from that frame is cached here until one of the following conditions is met:
344 * 1) The RenderNode is deleted (causing this to be deleted)
345 * 2) It is replaced with the displayList from the next completed frame
346 * 3) It is detached and used to to record a new displayList for a later frame
347 */
Stan Iliev021693b2016-10-17 16:26:15 -0400348 std::unique_ptr<skiapipeline::SkiaDisplayList> mAvailableDisplayList;
Derek Sollenberger0df62092016-09-27 16:04:42 -0400349
350 /**
351 * An offscreen rendering target used to contain the contents this RenderNode
352 * when it has been set to draw as a LayerType::RenderLayer.
353 */
Stan Iliev500a0c32016-10-26 10:30:09 -0400354 std::unique_ptr<skiapipeline::SkiaLayer> mSkiaLayer;
Derek Sollenberger579317d2017-08-29 16:33:49 -0400355
356 struct ClippedOutlineCache {
357 // keys
358 uint32_t outlineID = 0;
359 SkRect clipRect;
360
361 // value
362 SkPath clippedOutline;
363 };
364 mutable ClippedOutlineCache mClippedOutlineCache;
John Reck1bcacfd2017-11-03 10:12:19 -0700365}; // class RenderNode
John Reck113e0822014-03-18 09:22:59 -0700366
John Reck2de950d2017-01-25 10:58:30 -0800367class MarkAndSweepRemoved : public TreeObserver {
John Reck1bcacfd2017-11-03 10:12:19 -0700368 PREVENT_COPY_AND_ASSIGN(MarkAndSweepRemoved);
John Reck2de950d2017-01-25 10:58:30 -0800369
370public:
371 explicit MarkAndSweepRemoved(TreeInfo* info) : mTreeInfo(info) {}
372
John Reck1bcacfd2017-11-03 10:12:19 -0700373 void onMaybeRemovedFromTree(RenderNode* node) override { mMarked.emplace_back(node); }
John Reck2de950d2017-01-25 10:58:30 -0800374
375 ~MarkAndSweepRemoved() {
376 for (auto& node : mMarked) {
377 if (!node->hasParents()) {
378 node->onRemovedFromTree(mTreeInfo);
379 }
380 }
381 }
382
383private:
384 FatVector<sp<RenderNode>, 10> mMarked;
385 TreeInfo* mTreeInfo;
386};
387
John Reck113e0822014-03-18 09:22:59 -0700388} /* namespace uirenderer */
389} /* namespace android */