logd: create FlushToState class
ChattyLogBuffer::FlushTo() needs an array of pid_t's to differentiate between deduplication and spam removal chatty messages, but that won't be useful to other log buffers, so it doesn't deserve its own entry in the abstruct LogBuffer::FlushTo() function. Other log buffers may need their own data stored for each reader, so we create an interface that the reader itself owns and passes to the log buffer. It uses a unique_ptr, such that the when the reader is destroyed, so will this state. FlushToState will additionally contain the start point, that it will increment itself and the log mask, which LogBuffers can use to efficiently keep track of the next elements that will be read during a call to FlushTo(). Side benefit: this allows ChattyLogBufferTests to correctly report 'identical' instead of 'expired' lines the deduplication tests. Side benefit #2: This updates LogReaderThread::start() more aggressively, which should result in readers being disconnected less often, particularly readers who read only a certain UID. Test: logging unit tests Change-Id: I969565eb2996afb1431f20e7ccaaa906fcb8f6d1
Loading
Please register or sign in to comment