surfaceflinger: use std::queue for mPendingEvents
Replace Vector by std::queue for mPendingEvents. It is used for
pending hotplug events, which happen rarely and are consumed one by
one quickly by an RT thread. std::queue is likely no better than
std::vector in that scenario, but is more expressive.
Bug: 115738279
Test: boots
Change-Id: Ia906a7f08ecbe6d5534cd6ec42e5af2ac865a911
diff --git a/services/surfaceflinger/Scheduler/EventThread.h b/services/surfaceflinger/Scheduler/EventThread.h
index 127891e..3879ae4 100644
--- a/services/surfaceflinger/Scheduler/EventThread.h
+++ b/services/surfaceflinger/Scheduler/EventThread.h
@@ -22,6 +22,7 @@
#include <condition_variable>
#include <cstdint>
#include <mutex>
+#include <queue>
#include <thread>
#include <android-base/thread_annotations.h>
@@ -168,7 +169,7 @@
// protected by mLock
SortedVector<wp<Connection>> mDisplayEventConnections GUARDED_BY(mMutex);
- Vector<DisplayEventReceiver::Event> mPendingEvents GUARDED_BY(mMutex);
+ std::queue<DisplayEventReceiver::Event> mPendingEvents GUARDED_BY(mMutex);
std::array<DisplayEventReceiver::Event, 2> mVSyncEvent GUARDED_BY(mMutex);
bool mUseSoftwareVSync GUARDED_BY(mMutex) = false;
bool mVsyncEnabled GUARDED_BY(mMutex) = false;