lshal: clean up ListCommand::fetchBinderized
Refactor fetchBinderized. Move logic for each TableEntry to
a separate fetchBinderizedEntry function.
* Change allDebugInfos to allTableEntries to contain more information.
* Use getPidInfoCached instead of allPids for cache.
* TableEntry can be default constructed.
Test: lshal_test
Change-Id: Iceea7296b7fd4f3fa268daa74bd3b89360294124
diff --git a/cmds/lshal/TableEntry.h b/cmds/lshal/TableEntry.h
index 7a3b22e..497bedf 100644
--- a/cmds/lshal/TableEntry.h
+++ b/cmds/lshal/TableEntry.h
@@ -57,17 +57,22 @@
THREADS,
};
+enum {
+ NO_PID = -1,
+ NO_PTR = 0
+};
+
struct TableEntry {
- std::string interfaceName;
- std::string transport;
- int32_t serverPid;
- uint32_t threadUsage;
- uint32_t threadCount;
- std::string serverCmdline;
- uint64_t serverObjectAddress;
- Pids clientPids;
- std::vector<std::string> clientCmdlines;
- Architecture arch;
+ std::string interfaceName{};
+ std::string transport{};
+ int32_t serverPid{NO_PID};
+ uint32_t threadUsage{0};
+ uint32_t threadCount{0};
+ std::string serverCmdline{};
+ uint64_t serverObjectAddress{NO_PTR};
+ Pids clientPids{};
+ std::vector<std::string> clientCmdlines{};
+ Architecture arch{ARCH_UNKNOWN};
static bool sortByInterfaceName(const TableEntry &a, const TableEntry &b) {
return a.interfaceName < b.interfaceName;
@@ -129,11 +134,6 @@
std::vector<const Table*> mTables;
};
-enum {
- NO_PID = -1,
- NO_PTR = 0
-};
-
} // namespace lshal
} // namespace android