logd: separate PruneList from LogBuffer
logd needs a pointer to PruneList, but it should not own it and it
should not have initPrune() or formatPrune() functions.
Test: logging unit tests
Change-Id: Id1668c26d07eb5d1e4cf267f5748c20a79f711ae
diff --git a/logd/LogBuffer.h b/logd/LogBuffer.h
index b8e64d0..cf93c23 100644
--- a/logd/LogBuffer.h
+++ b/logd/LogBuffer.h
@@ -80,7 +80,6 @@
LogStatistics stats;
- PruneList mPrune;
// Keeps track of the iterator to the oldest log message of a given log type, as an
// optimization when pruning logs. Use GetOldest() to retrieve.
std::optional<LogBufferElementCollection::iterator> mOldest[LOG_ID_MAX];
@@ -104,7 +103,7 @@
public:
LastLogTimes& mTimes;
- LogBuffer(LastLogTimes* times, LogTags* tags);
+ LogBuffer(LastLogTimes* times, LogTags* tags, PruneList* prune);
~LogBuffer();
void init();
bool isMonotonic() {
@@ -133,13 +132,6 @@
stats.enableStatistics();
}
- int initPrune(const char* cp) {
- return mPrune.init(cp);
- }
- std::string formatPrune() {
- return mPrune.format();
- }
-
// helper must be protected directly or implicitly by wrlock()/unlock()
const char* pidToName(pid_t pid) {
return stats.pidToName(pid);
@@ -174,4 +166,5 @@
LogBufferElementCollection::iterator GetOldest(log_id_t log_id);
LogTags* tags_;
+ PruneList* prune_;
};