Currently the renderer has one URLLoaderFactory. A lot of the tasks we've been discussing for network service effort depend on having it be-frame instead. That way if a page is using service worker or appcache, we can give just that frame and children a different URLLoaderFactory.
I was looking into the code around (partly because I wanted to get rid of Platform::CreateURLLoader for S*Workers) and see what possible paths we can take to deprecate Platform::CreateURLLoader() and make URLLoader purely per-frame/per-context. One of the ideas that looked pragmatic is following (I've very briefly talked about this with Yutaka and toyoshim@), there could be some gotchas I'm overlooking but let me dump it here too:
* Deprecate CreateURLLoader everywhere except for FetchContext’s one
* Instead WebFrameClient defines CreateURLLoaderFactory, which returns something like https://chromium-review.googlesource.com/c/chromium/src/+/551403
* WebURLLoaderFactory should be attached to and stored in each loading context, e.g. in LocalFrame for frames, or in a worker fetch context for workers. WebURLLoaderFactory internally hides the details about URLLoaderFactory selection.
* FrameFetchContext::CreateURLLoader() will be implemented like: Frame()>GetURLLoaderFactory()>CreateURLLoader()
* It feels MockURLLoader can be probably hidden / baked in this abstraction too, e.g. we can have MockWebURLLoaderFactory (ugh naming is confusing) that just returns mock’ed URLLoader when its CreateURLLoader is called, and TestWebFrameClient / MockFetchContext can internally create it and use it.
* To make the transition easier we can also have Platform::CreateDefaultURLLoaderFactory() for the time being, and replace the existing Platform::CreateURLLoader() with it. (The slight difference is that in this way we can still start using per-frame / per-context URLLoaderFactory even for such code paths)
With the change (https://chromium-review.googlesource.com/708074) now basically all the resource requests should go through per-frame or per-worker URLLoaderFactory, so let me close this. (There could be related remaining work like removing routing_id)
Comment 1 by jam@chromium.org
, Apr 19 2017