Loading core/java/android/webkit/CacheManager.java +48 −32 Original line number Diff line number Diff line Loading @@ -351,15 +351,15 @@ public final class CacheManager { } /** * Given a URL, returns the corresponding CacheResult if it exists, or null otherwise. * * The input stream of the CacheEntry object is initialized and opened and should be closed by * the caller when access to the underlying file is no longer required. * If a non-zero value is provided for the headers map, and the cache entry needs validation, * HEADER_KEY_IFNONEMATCH or HEADER_KEY_IFMODIFIEDSINCE will be set in headers. * * @return The CacheResult for the given URL * * Gets the cache entry for the specified URL, or null if none is found. * If a non-null value is provided for the HTTP headers map, and the cache * entry needs validation, appropriate headers will be added to the map. * The input stream of the CacheEntry object should be closed by the caller * when access to the underlying file is no longer required. * @param url The URL for which a cache entry is requested * @param headers A map from HTTP header name to value, to be populated * for the returned cache entry * @return The cache entry for the specified URL * @deprecated Access to the HTTP cache will be removed in a future release. */ @Deprecated Loading @@ -368,13 +368,9 @@ public final class CacheManager { return getCacheFile(url, 0, headers); } static CacheResult getCacheFile(String url, long postIdentifier, Map<String, String> headers) { if (mDisabled) { return null; } private static CacheResult getCacheFileChromiumHttpStack(String url) { assert JniUtil.useChromiumHttpStack(); if (JniUtil.useChromiumHttpStack()) { CacheResult result = nativeGetCacheResult(url); if (result == null) { return null; Loading @@ -395,6 +391,10 @@ public final class CacheManager { return result; } private static CacheResult getCacheFileAndroidHttpStack(String url, long postIdentifier) { assert !JniUtil.useChromiumHttpStack(); String databaseKey = getDatabaseKey(url, postIdentifier); CacheResult result = mDataBase.getCache(databaseKey); if (result == null) { Loading @@ -419,6 +419,22 @@ public final class CacheManager { return null; } } return result; } static CacheResult getCacheFile(String url, long postIdentifier, Map<String, String> headers) { if (mDisabled) { return null; } CacheResult result = JniUtil.useChromiumHttpStack() ? getCacheFileChromiumHttpStack(url) : getCacheFileAndroidHttpStack(url, postIdentifier); if (result == null) { return null; } // A null value for headers is used by CACHE_MODE_CACHE_ONLY to imply // that we should provide the cache result even if it is expired. Loading Loading
core/java/android/webkit/CacheManager.java +48 −32 Original line number Diff line number Diff line Loading @@ -351,15 +351,15 @@ public final class CacheManager { } /** * Given a URL, returns the corresponding CacheResult if it exists, or null otherwise. * * The input stream of the CacheEntry object is initialized and opened and should be closed by * the caller when access to the underlying file is no longer required. * If a non-zero value is provided for the headers map, and the cache entry needs validation, * HEADER_KEY_IFNONEMATCH or HEADER_KEY_IFMODIFIEDSINCE will be set in headers. * * @return The CacheResult for the given URL * * Gets the cache entry for the specified URL, or null if none is found. * If a non-null value is provided for the HTTP headers map, and the cache * entry needs validation, appropriate headers will be added to the map. * The input stream of the CacheEntry object should be closed by the caller * when access to the underlying file is no longer required. * @param url The URL for which a cache entry is requested * @param headers A map from HTTP header name to value, to be populated * for the returned cache entry * @return The cache entry for the specified URL * @deprecated Access to the HTTP cache will be removed in a future release. */ @Deprecated Loading @@ -368,13 +368,9 @@ public final class CacheManager { return getCacheFile(url, 0, headers); } static CacheResult getCacheFile(String url, long postIdentifier, Map<String, String> headers) { if (mDisabled) { return null; } private static CacheResult getCacheFileChromiumHttpStack(String url) { assert JniUtil.useChromiumHttpStack(); if (JniUtil.useChromiumHttpStack()) { CacheResult result = nativeGetCacheResult(url); if (result == null) { return null; Loading @@ -395,6 +391,10 @@ public final class CacheManager { return result; } private static CacheResult getCacheFileAndroidHttpStack(String url, long postIdentifier) { assert !JniUtil.useChromiumHttpStack(); String databaseKey = getDatabaseKey(url, postIdentifier); CacheResult result = mDataBase.getCache(databaseKey); if (result == null) { Loading @@ -419,6 +419,22 @@ public final class CacheManager { return null; } } return result; } static CacheResult getCacheFile(String url, long postIdentifier, Map<String, String> headers) { if (mDisabled) { return null; } CacheResult result = JniUtil.useChromiumHttpStack() ? getCacheFileChromiumHttpStack(url) : getCacheFileAndroidHttpStack(url, postIdentifier); if (result == null) { return null; } // A null value for headers is used by CACHE_MODE_CACHE_ONLY to imply // that we should provide the cache result even if it is expired. Loading