resourceloader: Simplify addEmbeddedCSS by using object refs
* Previously, the same function was used both for adding to the buffer,
and flushing the buffer (via self-calling alternate signatures).
The flushing logic was split off to a flushCssBuffer function.
* Previously, when encountering an '@import' statement, it performed a
synchronous flush, instead of the usual asynchronous ones. There was
no reason for this, other than my laziness. I suspect because I was
using strings, which can't be passed by reference, and I didn't
think of another way.
I'm now storing the string in an object, which can be passed by
reference to the flush function. This means, as before, we can
keep appending to its string after the flush is scheduled. But,
unlike before, it also means we can reset our local reference and
start a new buffer at any time and schedule that one, too.
Bug: T202703
Change-Id: Ifc6dd59e9e8885d65ba425bc579ecbfb09f2ac64