summaryrefslogtreecommitdiffstats
path: root/WebCore/loader/CachedResource.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/loader/CachedResource.h')
-rw-r--r--WebCore/loader/CachedResource.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/WebCore/loader/CachedResource.h b/WebCore/loader/CachedResource.h
index 63c250b..16cce26 100644
--- a/WebCore/loader/CachedResource.h
+++ b/WebCore/loader/CachedResource.h
@@ -82,6 +82,7 @@ public:
virtual String encoding() const { return String(); }
virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived) = 0;
virtual void error() = 0;
+ virtual void httpStatusCodeError() { error(); } // Images keep loading in spite of HTTP errors (for legacy compat with <img>, etc.).
const String &url() const { return m_url; }
Type type() const { return m_type; }
@@ -126,7 +127,8 @@ public:
// Called by the cache if the object has been removed from the cache
// while still being referenced. This means the object should delete itself
// if the number of clients observing it ever drops to 0.
- void setInCache(bool b) { m_inCache = b; }
+ // The resource can be brought back to cache after successful revalidation.
+ void setInCache(bool b) { m_inCache = b; if (b) m_isBeingRevalidated = false; }
bool inCache() const { return m_inCache; }
void setInLiveDecodedResourcesList(bool b) { m_inLiveDecodedResourcesList = b; }
@@ -162,7 +164,7 @@ public:
void decreasePreloadCount() { ASSERT(m_preloadCount); --m_preloadCount; }
void registerHandle(CachedResourceHandleBase* h) { ++m_handleCount; if (m_resourceToRevalidate) m_handlesToRevalidate.add(h); }
- void unregisterHandle(CachedResourceHandleBase* h) { --m_handleCount; if (m_resourceToRevalidate) m_handlesToRevalidate.remove(h); if (!m_handleCount) deleteIfPossible(); }
+ void unregisterHandle(CachedResourceHandleBase* h) { ASSERT(m_handleCount > 0); --m_handleCount; if (m_resourceToRevalidate) m_handlesToRevalidate.remove(h); if (!m_handleCount) deleteIfPossible(); }
bool canUseCacheValidator() const;
bool mustRevalidate(CachePolicy) const;
@@ -172,12 +174,16 @@ public:
bool isPurgeable() const;
bool wasPurged() const;
+ // This is used by the archive machinery to get at a purged resource without
+ // triggering a load. We should make it protected again if we can find a
+ // better way to handle the archive case.
+ bool makePurgeable(bool purgeable);
+
protected:
void setEncodedSize(unsigned);
void setDecodedSize(unsigned);
void didAccessDecodedData(double timeStamp);
- bool makePurgeable(bool purgeable);
bool isSafeToMakePurgeable() const;
HashCountedSet<CachedResourceClient*> m_clients;
@@ -187,6 +193,8 @@ protected:
Request* m_request;
ResourceResponse m_response;
+ double m_responseTimestamp;
+
RefPtr<SharedBuffer> m_data;
OwnPtr<PurgeableBuffer> m_purgeableData;
@@ -200,7 +208,10 @@ private:
void setResourceToRevalidate(CachedResource*);
void switchClientsToRevalidatedResource();
void clearResourceToRevalidate();
- void setExpirationDate(time_t expirationDate) { m_expirationDate = expirationDate; }
+ void updateResponseAfterRevalidation(const ResourceResponse& validatingResponse);
+
+ double currentAge() const;
+ double freshnessLifetime() const;
unsigned m_encodedSize;
unsigned m_decodedSize;
@@ -217,7 +228,6 @@ private:
protected:
bool m_inCache;
bool m_loading;
- bool m_expireDateChanged;
#ifndef NDEBUG
bool m_deleted;
unsigned m_lruIndex;
@@ -241,8 +251,6 @@ private:
bool m_isBeingRevalidated;
// These handles will need to be updated to point to the m_resourceToRevalidate in case we get 304 response.
HashSet<CachedResourceHandleBase*> m_handlesToRevalidate;
-
- time_t m_expirationDate;
};
}