Reland "Fix various issues in RedirectToFileResourceHandler."

It got reverted due to ASan issues. Fix child_id registration in
ResourceDispatcherHostTests so that they happen on ForwardingFilter creation,
rather than ad-hoc on a per-request basis.

Original description:

> - Handle errors in creating temporary files.
> - Cancel on write failure instead of resuming. This used to work, but got
>   lost in some refactoring in r142108.
> - Fix the OnResponseCompleted resume logic to account for partial writes.
> - Don't lose write errors which occur after OnResponseCompleted is received.
> - WeakPtrFactory goes after other members.
> - OnWillStart was never forwarded to downstream handlers.
> - Make sure the file is closed before deleting it.
>
> Also add a lot of machinery so we can better unit test this stack.

Original Review URL: https://codereview.chromium.org/82273002

BUG=316634,347663
TEST=ResourceDispatcherHostTest.DownloadToFile
     ResourceDispatcherHostTest.RegisterDownloadedTempFile
     ResourceLoaderRedirectToFileTest.*
     TemporaryFileStreamTest.Basic

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257147 0039d316-1c4b-4281-b951-d872f2087c98
17 files changed