Refactor trace writing into a different class

In preperation for flushing the trace entries off thread move trace
writer logic into a different class. This is a pure refactoring and
doesn't (shouldn't) change any behaviour.

Bug: 259258187
Test: art/test.py --trace, art/test.py --trace --stream

Change-Id: I7b3aba83148da3d670a43a33c1540188c41ad34d
5 files changed