Revert "SurfaceFlinger: Share ownership of layers between State and Handle."
This reverts commit f478f9f70b544d9f93680d6734a1af45bbd7f509.
Reason for revert: Causes presubmit issues.
Change-Id: Ibe872baed863a8ee9b9da5722e1671d087ec3a9f
Bug: 118257858
Bug: 62536731
Bug: 111373437
Bug: 111297488
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index fdec0f7..e2d1178 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -345,7 +345,7 @@
virtual bool isCreatedFromMainThread() const { return false; }
- bool isRemovedFromCurrentState() const { return mRemovedFromCurrentState; }
+ bool isPendingRemoval() const { return mPendingRemoval; }
void writeToProto(LayerProto* layerInfo,
LayerVector::StateSet stateSet = LayerVector::StateSet::Drawing);
@@ -474,6 +474,12 @@
*/
void onRemovedFromCurrentState();
+ /*
+ * called with the state lock from the main thread when the layer is
+ * removed from the pending removal list
+ */
+ void onRemoved();
+
// Updates the transform hint in our SurfaceFlingerConsumer to match
// the current orientation of the display device.
void updateTransformHint(const sp<const DisplayDevice>& display) const;
@@ -588,12 +594,12 @@
*/
class LayerCleaner {
sp<SurfaceFlinger> mFlinger;
- sp<Layer> mLayer;
+ wp<Layer> mLayer;
protected:
~LayerCleaner() {
// destroy client resources
- mFlinger->onHandleDestroyed(mLayer);
+ mFlinger->onLayerDestroyed(mLayer);
}
public:
@@ -695,8 +701,6 @@
virtual PixelFormat getPixelFormat() const { return PIXEL_FORMAT_NONE; }
bool getPremultipledAlpha() const;
- bool mPendingHWCDestroy{false};
-
protected:
// -----------------------------------------------------------------------
bool usingRelativeZ(LayerVector::StateSet stateSet);
@@ -740,7 +744,7 @@
// Whether filtering is needed b/c of the drawingstate
bool mNeedsFiltering{false};
- bool mRemovedFromCurrentState{false};
+ bool mPendingRemoval{false};
// page-flip thread (currently main thread)
bool mProtectedByApp{false}; // application requires protected path to external sink