summaryrefslogtreecommitdiff
path: root/libs/hwui/FrameInfo.h
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2025-02-18 11:35:58 -0800
committer Siarhei Vishniakou <svv@google.com> 2025-02-18 19:39:07 +0000
commitaed2282953df1ed812f45ee401c7277bde4c3cfd (patch)
treedcb50293f672ed35685a627be6fa62d647f4b89d /libs/hwui/FrameInfo.h
parent6dd107ab7db5296496aba54ad06c60831b3e67c8 (diff)
Pass metrics buffer as std::array
Before this change, metrics were passed around as a raw array, without clear guidance of how big the array was or how to use it. The callers had to look into the implementation to understand that to use this array, "FrameInfo.h" needed to be included, and that the array size and indices were there. With the current refactor, it will become slightly easier to use these metrics. Bug: 376713684 Change-Id: Iecc04a0a215a7913ca8f49e4611fb104e1cacb8e Test: compile only Flag: EXEMPT refactor
Diffstat (limited to 'libs/hwui/FrameInfo.h')
-rw-r--r--libs/hwui/FrameInfo.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/hwui/FrameInfo.h b/libs/hwui/FrameInfo.h
index 61c30b803b00..8b486cd49e24 100644
--- a/libs/hwui/FrameInfo.h
+++ b/libs/hwui/FrameInfo.h
@@ -84,6 +84,8 @@ enum {
};
};
+using FrameInfoBuffer = std::array<int64_t, static_cast<size_t>(FrameInfoIndex::NumIndexes)>;
+
class UiFrameInfoBuilder {
public:
static constexpr int64_t INVALID_VSYNC_ID = -1;
@@ -152,7 +154,7 @@ public:
set(FrameInfoIndex::Flags) |= static_cast<uint64_t>(frameInfoFlag);
}
- const int64_t* data() const { return mFrameInfo; }
+ const FrameInfoBuffer& data() const { return mFrameInfo; }
inline int64_t operator[](FrameInfoIndex index) const { return get(index); }
@@ -201,7 +203,7 @@ public:
}
private:
- int64_t mFrameInfo[static_cast<int>(FrameInfoIndex::NumIndexes)];
+ FrameInfoBuffer mFrameInfo;
std::optional<SkippedFrameReason> mSkippedFrameReason;
};