(summarizing discussion with Ananta and Yuzhu)
When adding support for AppCache:
https://codereview.chromium.org/2891773002/diff/40001/content/browser/appcache/appcache_url_loader_factory.cc#newcode89
it turns out that even when not using appcache, if the appcache factory is the one that created the network service, it still has to stay alive as it's the one that implements mojom::URLLoader. It can not pass the URLLoaderRequest pointer to the next factory, as currently URLLoaderFactory is using associated interfaces.
bug 724322 will fix this because we will stop using URLLoaderFactory objects in the browser and just use C++ to create the URLLoader.
However talking further, it seems the existing URLLoaderFactory interface is not a good fit for the network service. We don't need a separate sync xhr method, as Yuzhu discovered that for safe browsing we will have to implement sync xhr manually through a nested message loop and async calls to CreateLoaderAndStart (see https://docs.google.com/document/d/1AyW5oF3h6QaihAGWYASPn-XPrz2a1P9fv9T8EAuMqY0/edit for more background). The renderer also doesn't need to use associated interfaces, as there's no ordering guarantees with the network service relative to other browser IPCs.
Summary: after 724322 is done, we can create
interface URLLoaderFactory2 {
CreateLoaderAndStart(URLLoader& loader,
int32 routing_id,
int32 request_id,
uint32 options,
URLRequest request,
URLLoaderClient client);
}
that is used by the network service related code.
Comment 1 by kinuko@chromium.org
, May 22 2017