Reland "Transmit the response's body datapipe in CommitNavigation()."

History:
========
 * Initial commit : https://chromium-review.googlesource.com/1100830
 * Revert         : https://chromium-review.googlesource.com/1129659
 * Take over      : https://chromium-review.googlesource.com/1172290
 * Reland (this)  : https://chromium-review.googlesource.com/1587249

Cause of revert: Several flaky tests became much more flaky.

Fix done in between the revert and the reland:
 * https://chromium-review.googlesource.com/1133261
 * https://chromium-review.googlesource.com/1133170
 * https://chromium-review.googlesource.com/1135003
 * https://chromium-review.googlesource.com/1185094
 * https://chromium-review.googlesource.com/1252141
 * https://chromium-review.googlesource.com/1261520

Another change made in this reland CL to eliminate the previous flaky tests is
to bind the mojo::URLLoaderClient interface before calling
URLLoaderClient::OnStartLoadingResponseBody in NavigationBodyLoader. Because
when NavigationImmediateResponse is enabled, reading the data from data
pipe starts at once which will postpone the method calls from the remote side
if it hasn't been bound.

In addition, support for the Network service has been added.

Original description:
=====================

When a navigation occurs, the mojo::URLLoaderClient interface is first
bound to the content::NavigationURLLoaderImpl in the browser process.
When the browser knows in which renderer process the navigation will
commit, the interface is bound to the content::URLLoaderClientImpl in
the renderer process to continue the navigation. The switching from one
to another happens when mojo::URLLoaderClient::OnReceiveResponse() is
called. This is described here: https://goo.gl/Rrrc7n

After the mojo::URLLoaderClient interface is unbound in the browser
process and bound again in the renderer process, it takes some amount of
time to receive URLLoader::OnStartLoadingResponseBody(). It may be worth
sending the data pipe with RenderFrameHostImpl::CommitNavigation() and
give it to the renderer process immediatly instead of waiting for it. It
would allow the Renderer process to get the main resource's data
earlier, especially when the renderer process is busy.

Note: It doesn't look like there are any strong reasons to make
      URLLoaderClient::OnReceiveResponse(response_head) and
      URLLoaderClient::OnStartLoadingResponseBody(response_body)
      separate messages, maybe at some point, they could be merged into:
      URLLoaderClient::OnReceiveResponse(response_head, response_body)

This CL makes the switch to happen in
URLLoaderClient::OnStartLoadingResponseBody(). The data pipe is
transmitted in CommitNavigation().

This is enabled/disabled using the NavigationImmediateResponse experiment
The goal is to look for performance improvement or regressions on
Canary.

BUG=831155

Change-Id: I179e09dbc19c76796bba5bcfef92866fd4b23dec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1587249
Commit-Queue: Minggang Wang <[email protected]>
Reviewed-by: Shakti Sahu <[email protected]>
Reviewed-by: Matt Falkenhagen <[email protected]>
Reviewed-by: Makoto Shimazu <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Cr-Commit-Position: refs/heads/master@{#673375}
diff --git a/content/browser/appcache/appcache_request_handler.h b/content/browser/appcache/appcache_request_handler.h
index 06dce93..5179daf3 100644
--- a/content/browser/appcache/appcache_request_handler.h
+++ b/content/browser/appcache/appcache_request_handler.h
@@ -83,7 +83,8 @@
   // MaybeCreateLoaderForResponse always returns synchronously.
   bool MaybeCreateLoaderForResponse(
       const network::ResourceRequest& request,
-      const network::ResourceResponseHead& response,
+      const network::ResourceResponseHead& response_head,
+      mojo::ScopedDataPipeConsumerHandle* response_body,
       network::mojom::URLLoaderPtr* loader,
       network::mojom::URLLoaderClientRequest* client_request,
       ThrottlingURLLoader* url_loader,