Revert "Redo how extra emit code flushing operates"

This reverts commit 9b8181b05a84e7dd24234c46c87d0bb2c73a7c08.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Redo how extra emit code flushing operates
> 
> The previous implementation of flushEmittedCode(), that flushed on
> demand when a process() was encountered, was brittle and susceptible to
> mangling the expected sksl when fOut was modified outside of its
> control. Given that writeFunction() and generateCode() in the parent
> class all do this, it's possible to generate a simple SkSL snippet that
> would generate a CPP file that builds invalid final SkSL:
> 
> ```
> in fragmentProcessor child;
> bool someGlobalVar = ...;
> void main() {
>     if (someGlobalVar) {
>         sk_OutColor = process(child, sk_InColor);
>     } else {
>         sk_OutColor = half4(1);
>     }
> }
> ```
> 
> The CPP generated code *should* insert 'bool someGlobalVar' at the start
> but because of the early flush from the child process and because of
> how fOut was overwritten, someGlobalVar's declaration is put into a
> stream that is not visible to the flush and ends up being inserted into
> the output sksl in an incorrect location (namely after the if condition
> that depends on it).
> 
> This CL updates the extra emitted code logic to support multiple blocks
> of extra CPP code. When a flush point occurs in SkSL writing, a special
> token is inserted into the SkSL and a new CPP code buffer is associated
> with that token. Then once all of the SkSL is accumulated into the root
> output stream, it is processed into sections for each extra CPP block.
> Special logic is done so that the SkSL that is emitted before the next
> CPP block terminates at the end of the last valid statement before the
> special token.
> 
> A unit test demonstrating this failure condition is added to SkSLFPTest
> and the CL properly passes. Since this bug did not trigger on existing
> .fp files, the updated generator does not modify the generated FPs.
> 
> Bug: skia:
> Change-Id: Ib74911942080f1b964159807a06805bc52898789
> Reviewed-on: https://skia-review.googlesource.com/152321
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

TBR=ethannicholas@google.com,michaelludwig@google.com

Change-Id: Id0f908453b596873f43b86a1c14eed48b2474a76
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/152660
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
3 files changed