summaryrefslogtreecommitdiff
path: root/libs/hwui/RenderNode.h
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2016-06-27 13:27:23 -0700
committerJohn Reck <jreck@google.com>2016-06-27 13:35:13 -0700
commit7b570deea65bc7ac417a26ce3e4103bcef30e957 (patch)
tree6e19b0c299e7bf7da395cddbe5f0d2384af5b28a /libs/hwui/RenderNode.h
parent157c6811de9bec883dfc802481bd07e64ca7ce59 (diff)
Fix SurfaceViewPositionListener race bugs
Bug: 29628138 1: Make windowPositionLost synchronous as that's what the Java side was expecting 2: Make the listener ref counted as otherwise there's a race condition with the GC, which could end up with use-after-frees 3: Ensure that all position updates are invoked prior to frame completion Change-Id: Iedbc017f611ba2878a49b4586612f79249ca2fe3
Diffstat (limited to 'libs/hwui/RenderNode.h')
-rw-r--r--libs/hwui/RenderNode.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index f80be5ec9ae9..47fef6da355c 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -232,7 +232,7 @@ public:
// the frameNumber to appropriately batch/synchronize these transactions.
// There is no other filtering/batching to ensure that only the "final"
// state called once per frame.
- class ANDROID_API PositionListener {
+ class ANDROID_API PositionListener : public VirtualLightRefBase {
public:
virtual ~PositionListener() {}
// Called when the RenderNode's position changes
@@ -247,7 +247,7 @@ public:
// before the RenderNode is used for drawing.
// RenderNode takes ownership of the pointer
ANDROID_API void setPositionListener(PositionListener* listener) {
- mPositionListener.reset(listener);
+ mPositionListener = listener;
}
// This is only modified in MODE_FULL, so it can be safely accessed
@@ -366,7 +366,7 @@ private:
// mDisplayList, not mStagingDisplayList.
uint32_t mParentCount;
- std::unique_ptr<PositionListener> mPositionListener;
+ sp<PositionListener> mPositionListener;
}; // class RenderNode
} /* namespace uirenderer */