• horo's avatar
    Implement FetchEvent.navigationPreload · 11160121
    horo authored
    This CL depends on https://codereview.chromium.org/2410333006/
    
    FetchEvent.navigationPreload will be implemented in the following steps.
    [1/4] Introduce FetchEventPreloadHandle to pass the preload response to FetchEvent.
          https://codereview.chromium.org/2417793002/
    [2/4] Implement ServiceWorkerFetchDispatcher::MaybeStartNavigationPreload().
          https://codereview.chromium.org/2410333006/
    [3/4] Implement FetchEvent.navigationPreload.
          https://codereview.chromium.org/2416843002/ This CL.
    [4/4] Add browser tests for NavigationPreload.
          https://codereview.chromium.org/2413643005/
    
    If ServiceWorkerContextClient::FetchEventDispatcherImpl receives preload_handle,
    it creates a PreloadRequest. This PreloadRequest is a mojom::URLLoaderClient
    owning mojom::URLLoader.
    
    ServiceWorkerContextClient::DispatchFetchEvent() stores the PreloadRequest to
    |context_| and calls ServiceWorkerGlobalScopeProxy::dispatchFetchEvent() with
    |navigationPreloadSent| flag set.
    
    If the flag is set, ServiceWorkerGlobalScopeProxy::dispatchFetchEvent() calls
    FetchEvent::createPreloadResponseCallback() to create
    WebServiceWorkerPreloadResponseCallbacks and calls registerPreloadResponseCallback
    to pass the callback to ServiceWorkerContextClient.
    
    ServiceWorkerContextClient::registerPreloadResponseCallback() calls
    PreloadRequest::RegisterCallback() and the callback will be called when
    OnStartLoadingResponseBody() is called or OnComplete() is called with an error.
    
    BUG=649558
    
    Review-Url: https://codereview.chromium.org/2416843002
    Cr-Commit-Position: refs/heads/master@{#427303}
    11160121
ServiceWorkerGlobalScopeProxy.h 7.14 KB