Get main frame and subframe AppCache loads to work.
The latest iteration of this patch now has AppCache working for the main frame and
subframe. Subresource loads will be addressed in a later patchset. With this change
the w3schools.com AppCache sample here https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_html_manifest
works.
This has been integrated with kinuko's patch, i.e. we implement the URLLoaderRequestHandler interface to
validate if the request can be serviced via the AppCache.
The URLLoaderFactory for AppCache is now instantiated as needed.
Changes in this patch include the following:
1. The AppCacheRequestHandler class now implements the URLLoaderRequestHandler interface. The handler then initializes
the AppCacheURLLoader job which allows us to determine if the request would be serviced via the AppCache. If yes
we return the URLLoaderFactory for the AppCache in the callback or pass null to the callback.
2. We call the AppCacheRequestHandler::InitializeForNavigationNetworkService() function from
NavigationURLLoaderNetworkService::URLLoaderRequestController::Start() for AppCache.
3. Use the AppCacheResponseReader and AppCacheResponseInfo classes in AppCacheURLLoaderJob to read data from the AppCache.
The job invokes methods on the URLLoaderClient when it reads the response/data, etc.
The data from the AppCache is written to a mojo data pipe and passed to the client.
4. I reverted portions of the previous change to the AppCacheURLLoaderRequest class, which was to hold on to a
unique_ptr for the ResourceRequest. We now hold on to a copy of the request. The CreateLoaderAndStart() method on the factory gives us a
copy of the request.
5. Moved some of the methods like IsWaiting/IsDeliveringAppCacheResponse/IsDeliveringNetworkResponse/IsDeliveringErrorResponse/IsCacheEntryNotFound to the
AppCacheJob base class as these implementations could be shared between the URLRequest and URLLoader versions of the subclasses. I also moved the
member variables used by these methods to the base class.
6. Add WeakPtrFactory to the AppCacheStorage class and provide a getter to return a weak pointer reference to the instance.
BUG=715632
Review-Url: https://codereview.chromium.org/2902653002
Cr-Commit-Position: refs/heads/master@{#478459}
diff --git a/content/browser/url_loader_factory_getter.h b/content/browser/url_loader_factory_getter.h
index 0af16fd..1ea7281 100644
--- a/content/browser/url_loader_factory_getter.h
+++ b/content/browser/url_loader_factory_getter.h
@@ -13,7 +13,6 @@
namespace content {
-class ChromeAppCacheService;
class StoragePartitionImpl;
// Holds on to URLLoaderFactory for a given StoragePartition and allows code
@@ -43,25 +42,18 @@
CONTENT_EXPORT void SetNetworkFactoryForTesting(
mojom::URLLoaderFactoryPtr test_factory);
- // Called on the IO thread to get the URLLoaderFactory for AppCache. The
- // pointer should not be cached.
- mojom::URLLoaderFactoryPtr* GetAppCacheFactory();
-
private:
friend class base::DeleteHelper<URLLoaderFactoryGetter>;
friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
CONTENT_EXPORT ~URLLoaderFactoryGetter();
- void InitializeOnIOThread(
- mojom::URLLoaderFactoryPtrInfo network_factory,
- mojom::URLLoaderFactoryPtrInfo blob_factory,
- scoped_refptr<ChromeAppCacheService> appcache_service);
+ void InitializeOnIOThread(mojom::URLLoaderFactoryPtrInfo network_factory,
+ mojom::URLLoaderFactoryPtrInfo blob_factory);
void SetTestNetworkFactoryOnIOThread(
mojom::URLLoaderFactoryPtrInfo test_factory);
// Only accessed on IO thread.
mojom::URLLoaderFactoryPtr network_factory_;
- mojom::URLLoaderFactoryPtr appcache_factory_;
mojom::URLLoaderFactoryPtr blob_factory_;
mojom::URLLoaderFactoryPtr test_factory_;