SurfaceFlinger: Use traversal functions to iterate LayerList.
In preparation for the Layer hierarchy. There we will need
to use such a style to traverse the tree of layers.
Test: Just a refactoring. SurfaceFlinger still works.
Change-Id: I84dcd82e713f1bdbe911658793ce11460267a956
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index bb44a36..d573f1a 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -55,6 +55,7 @@
#include "DisplayDevice.h"
#include "DispSync.h"
#include "FrameTracker.h"
+#include "LayerVector.h"
#include "MessageQueue.h"
#include "SurfaceInterceptor.h"
@@ -168,16 +169,13 @@
* Internal data structures
*/
- class LayerVector : public SortedVector< sp<Layer> > {
+ class State {
public:
- LayerVector();
- LayerVector(const LayerVector& rhs);
- virtual int do_compare(const void* lhs, const void* rhs) const;
- };
-
- struct State {
LayerVector layersSortedByZ;
DefaultKeyedVector< wp<IBinder>, DisplayDeviceState> displays;
+
+ void traverseInZOrder(const std::function<void(Layer*)>& consume) const;
+ void traverseInReverseZOrder(const std::function<void(Layer*)>& consume) const;
};
/* ------------------------------------------------------------------------
@@ -397,8 +395,7 @@
* Compositing
*/
void invalidateHwcGeometry();
- static void computeVisibleRegions(
- const LayerVector& currentLayers, uint32_t layerStack,
+ void computeVisibleRegions(uint32_t layerStack,
Region& dirtyRegion, Region& opaqueRegion);
void preComposition(nsecs_t refreshStartTime);