Refactoring: Simplify DocumentWriter by reorganizing its lifetime.

This change simplifies DocumentWriter by

1. Letting its lifetime match to the actual "writing" process:
   It is now created when actual data is arrived to be parsed,
   and is discarded once all the data is loaded.
   Then we no longer neeed DocumentWriter::m_state.

2. Moving most of its Frame dependency to DocumentLoader.
   DocumentWriter::begin() is factored to DocumentLoader::createWriter(), and
   DocumentWriter::replaceDocument is factored to DocumentLoader::replaceDocument()
   and DocumentWriter::appendReplacingData(). DocumentWriter::m_frame is now
   able to be replaced by DocumentWriter::m_documnet. This narrows the dependency surface.
   (Also it makes more sense because it is "document" writer after all.)

3. Making TextResourceDecoderBuilder an immutable object by stripping
   its setters out.

Note that (2) and (3) become possible because of (1).

Key observations here are that

- DocumentWriter had longer lifetime just because it stored mimetype and encoding.
  However, these can be computed on the fly in DocumentLoader when it starts
  actual writing. See ensureWriter() callsites.

- Some of extra states in DocumentWriter was needed because it had to "reset" itself.
  Once its lifetime aligns the single loading/parsing, we no longer need such reset thing.

- The main reason of dependency from DocumentWriter to Frame was DocumentWriter::begin(),
  which did connect the fresh, to-be-built Document and given Frame. This should be part
  of the DocumentWriter creation process and doesn't need to be in DocumentWriter itself.
  This change factors such setup into DocumentLoader::createWriter factory method.

BUG=none
TEST=none
R=abarth@chromium.org

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=153115

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=153125

Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=153216

Review URL: https://codereview.chromium.org/17640007

git-svn-id: svn://svn.chromium.org/blink/trunk@153318 bbb929c8-8fbe-4397-9dbb-9b2b20218538