logd: track SerializedFlushToState instances within SerializedLogChunk

Previously, NotifyReadersOfPrune() would iterate through the list of
reader_threads_ to find SerializedFlushToState instances, but that
misses some instances, which leads to violating important CHECK()'s.

This change 'attaches' a SerializedFlushToState instance to a
SerializedLogChunk instance when it begins reading from it and
'detaches' it when it has finished with it.  This allows a new
SerializedLogChunk::NotifyReadersOfPrune() function to notify exactly
those SerializedFlushToState instances that are currently 'attached'
to it.

Bug: 169736426
Bug: 172279637
Test: logging unit tests
Change-Id: I0ab4979c8fe2b84a0e23fc5ea5fb6dd54fadc691
7 files changed
tree: d0f0978a36ba04732cbd43c9b28345dfc7a8284a
  1. liblog/
  2. logcat/
  3. logd/
  4. logwrapper/
  5. OWNERS
  6. PREUPLOAD.cfg
  7. TEST_MAPPING