summaryrefslogtreecommitdiff
path: root/libs/hwui/FrameMetricsReporter.h
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2021-03-23 20:33:04 +0000
committerScott Lobdell <slobdell@google.com>2021-03-24 02:40:01 +0000
commit757dbb836469bbdd7eb8312deaf584fe0c99c17d (patch)
treea678b33ad5f0f024d0f942f127b91665f0616193 /libs/hwui/FrameMetricsReporter.h
parent7710a95746be8dba8c6ffe7172f9c01334a2ca81 (diff)
parentf022dd1e6827ebf7c52b06aa40f2059a3f0f5cad (diff)
Merge SP1A.210311.001
Change-Id: Id1a205bf3f0609c0b13e4bea377056c3b06299fa
Diffstat (limited to 'libs/hwui/FrameMetricsReporter.h')
-rw-r--r--libs/hwui/FrameMetricsReporter.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/libs/hwui/FrameMetricsReporter.h b/libs/hwui/FrameMetricsReporter.h
index 0643e790d00b..3f2dc1244085 100644
--- a/libs/hwui/FrameMetricsReporter.h
+++ b/libs/hwui/FrameMetricsReporter.h
@@ -55,13 +55,24 @@ public:
return mObservers.size() > 0;
}
- void reportFrameMetrics(const int64_t* stats) {
+ /**
+ * Notify observers about the metrics contained in 'stats'.
+ * If an observer is waiting for present time, notify when 'stats' has present time.
+ *
+ * If an observer does not want present time, only notify when 'hasPresentTime' is false.
+ * Never notify both types of observers from the same callback, because the callback with
+ * 'hasPresentTime' is sent at a different time than the one without.
+ */
+ void reportFrameMetrics(const int64_t* stats, bool hasPresentTime) {
FatVector<sp<FrameMetricsObserver>, 10> copy;
{
std::lock_guard lock(mObserversLock);
copy.reserve(mObservers.size());
for (size_t i = 0; i < mObservers.size(); i++) {
- copy.push_back(mObservers[i]);
+ const bool wantsPresentTime = mObservers[i]->waitForPresentTime();
+ if (hasPresentTime == wantsPresentTime) {
+ copy.push_back(mObservers[i]);
+ }
}
}
for (size_t i = 0; i < copy.size(); i++) {