Commit a3d5f1de authored by Brian Smith's avatar Brian Smith
Browse files

Bug 742610 - Remove opportunistic caching support from nsHttpChannel, r=honzab

--HG--
extra : source : 8b98023b89ddef6e7b0bbed25463c68142877d8e
parent 46beb691
Loading
Loading
Loading
Loading
+3 −31
Original line number Diff line number Diff line
@@ -135,7 +135,6 @@ nsHttpChannel::nsHttpChannel()
    , mResuming(false)
    , mInitedCacheEntry(false)
    , mCacheForOfflineUse(false)
    , mCachingOpportunistically(false)
    , mFallbackChannel(false)
    , mCustomConditionalRequest(false)
    , mFallingBack(false)
@@ -2073,8 +2072,8 @@ nsHttpChannel::ProcessFallback(bool *waitingForRedirectCallback)
    NS_ASSERTION(fallbackEntryType & nsIApplicationCache::ITEM_FALLBACK,
                 "Fallback entry not marked correctly!");

    // Kill any opportunistic cache entry, and disable opportunistic
    // caching for the fallback.
    // Kill any offline cache entry, and disable offline caching for the
    // fallback.
    if (mOfflineCacheEntry) {
        mOfflineCacheEntry->Doom();
        mOfflineCacheEntry = 0;
@@ -2082,7 +2081,6 @@ nsHttpChannel::ProcessFallback(bool *waitingForRedirectCallback)
    }

    mCacheForOfflineUse = false;
    mCachingOpportunistically = false;
    mOfflineCacheClientID.Truncate();
    mOfflineCacheEntry = 0;
    mOfflineCacheAccess = 0;
@@ -2335,12 +2333,10 @@ nsHttpChannel::OnOfflineCacheEntryAvailable(nsICacheEntryDescriptor *aEntry,
            NS_FAILED(namespaceEntry->GetItemType(&namespaceType)) ||
            (namespaceType &
             (nsIApplicationCacheNamespace::NAMESPACE_FALLBACK |
              nsIApplicationCacheNamespace::NAMESPACE_OPPORTUNISTIC |
              nsIApplicationCacheNamespace::NAMESPACE_BYPASS)) == 0) {
            // When loading from an application cache, only items
            // on the whitelist or matching a
            // fallback/opportunistic namespace should hit the
            // network...
            // fallback namespace should hit the network...
            mLoadFlags |= LOAD_ONLY_FROM_CACHE;

            // ... and if there were an application cache entry,
@@ -2353,19 +2349,6 @@ nsHttpChannel::OnOfflineCacheEntryAvailable(nsICacheEntryDescriptor *aEntry,
            rv = namespaceEntry->GetData(mFallbackKey);
            NS_ENSURE_SUCCESS(rv, rv);
        }

        if ((namespaceType &
             nsIApplicationCacheNamespace::NAMESPACE_OPPORTUNISTIC) &&
            mLoadFlags & LOAD_DOCUMENT_URI) {
            // Document loads for items in an opportunistic namespace
            // should be placed in the offline cache.
            nsCString clientID;
            mApplicationCache->GetClientID(clientID);

            mCacheForOfflineUse = !clientID.IsEmpty();
            SetOfflineCacheClientID(clientID);
            mCachingOpportunistically = true;
        }
    }

    return OpenNormalCacheEntry();
@@ -3105,17 +3088,6 @@ nsHttpChannel::CloseOfflineCacheEntry()

    mOfflineCacheEntry = 0;
    mOfflineCacheAccess = 0;

    if (mCachingOpportunistically) {
        nsCOMPtr<nsIApplicationCacheService> appCacheService =
            do_GetService(NS_APPLICATIONCACHESERVICE_CONTRACTID);
        if (appCacheService) {
            nsCAutoString cacheKey;
            GenerateCacheKey(mPostID, cacheKey);
            appCacheService->CacheOpportunistically(mApplicationCache,
                                                    cacheKey);
        }
    }
}


+0 −3
Original line number Diff line number Diff line
@@ -337,9 +337,6 @@ private:
    PRUint32                          mResuming                 : 1;
    PRUint32                          mInitedCacheEntry         : 1;
    PRUint32                          mCacheForOfflineUse       : 1;
    // True if mCacheForOfflineUse was set because we were caching
    // opportunistically.
    PRUint32                          mCachingOpportunistically : 1;
    // True if we are loading a fallback cache entry from the
    // application cache.
    PRUint32                          mFallbackChannel          : 1;