summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/ClientCache.cpp
diff options
context:
space:
mode:
author Dominik Laskowski <domlaskowski@google.com> 2021-02-09 18:51:25 -0800
committer Dominik Laskowski <domlaskowski@google.com> 2021-09-09 12:35:48 -0700
commit7578845a3480cb4237f28729994e19a09caceb55 (patch)
tree05830c1a55e5ab6b4ca3c901c61ac78fc15d61b1 /services/surfaceflinger/ClientCache.cpp
parent7be9eaacb54dbdfaf9522f93b104dd0469a0b543 (diff)
FTL: Extend enum utilities imported from IF
Generalize compile-time and run-time lookup of enumerator names by recognizing ftl_first and ftl_last to customize the range. Add enum_range<E>() for iteration using range-based `for` loop. Bug: 185536303 Test: Check assembly for small LUT in .rodata, and unrolled loops. Test: ftl_test, libinput_tests, inputflinger_tests Test: m libinputflinger Change-Id: I0581611f4cfcf5837b0293867cb323742afb2c87
Diffstat (limited to 'services/surfaceflinger/ClientCache.cpp')
-rw-r--r--services/surfaceflinger/ClientCache.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/services/surfaceflinger/ClientCache.cpp b/services/surfaceflinger/ClientCache.cpp
index f310738423..1ef8f78894 100644
--- a/services/surfaceflinger/ClientCache.cpp
+++ b/services/surfaceflinger/ClientCache.cpp
@@ -21,12 +21,12 @@
#include <cinttypes>
+#include <android-base/stringprintf.h>
+
#include "ClientCache.h"
namespace android {
-using base::StringAppendF;
-
ANDROID_SINGLETON_STATIC_INSTANCE(ClientCache);
ClientCache::ClientCache() : mDeathRecipient(new CacheDeathRecipient) {}
@@ -212,16 +212,15 @@ void ClientCache::CacheDeathRecipient::binderDied(const wp<IBinder>& who) {
void ClientCache::dump(std::string& result) {
std::lock_guard lock(mMutex);
- for (auto i : mBuffers) {
- const sp<IBinder>& cacheOwner = i.second.first;
- StringAppendF(&result," Cache owner: %p\n", cacheOwner.get());
- auto &buffers = i.second.second;
- for (auto& [id, clientCacheBuffer] : buffers) {
- StringAppendF(&result, "\t ID: %d, Width/Height: %d,%d\n", (int)id,
- (int)clientCacheBuffer.buffer->getBuffer()->getWidth(),
- (int)clientCacheBuffer.buffer->getBuffer()->getHeight());
+ for (const auto& [_, cache] : mBuffers) {
+ base::StringAppendF(&result, " Cache owner: %p\n", cache.first.get());
+
+ for (const auto& [id, entry] : cache.second) {
+ const auto& buffer = entry.buffer->getBuffer();
+ base::StringAppendF(&result, "\tID: %" PRIu64 ", size: %ux%u\n", id, buffer->getWidth(),
+ buffer->getHeight());
}
}
}
-}; // namespace android
+} // namespace android