diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-07-10 01:17:51 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-07-10 01:17:51 (GMT) |
commit | 9c13caa3c99af01a9b4c3ff6e178e7dadb61741f (patch) | |
tree | b69df0a23c4628359fc3740e09958980eda7478e /src/3rdparty/webkit/WebCore/loader/CachedResource.cpp | |
parent | bb1bdcab28e4c52dcea37dfaaa435045b1985eeb (diff) | |
parent | 883da42f7c75775502c818aa456c8576d8457ff8 (diff) | |
download | Qt-9c13caa3c99af01a9b4c3ff6e178e7dadb61741f.zip Qt-9c13caa3c99af01a9b4c3ff6e178e7dadb61741f.tar.gz Qt-9c13caa3c99af01a9b4c3ff6e178e7dadb61741f.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui-gv
Conflicts:
examples/itemviews/frozencolumn/main.cpp
src/declarative/canvas/qsimplecanvas.cpp
src/declarative/canvas/qsimplecanvas_p.h
src/declarative/canvas/qsimplecanvasitem.h
src/declarative/extra/qfxparticles.cpp
src/declarative/fx/fx.pri
src/declarative/fx/qfxblurfilter.h
src/declarative/fx/qfxcontentwrapper.cpp
src/declarative/fx/qfxflickable.cpp
src/declarative/fx/qfxfocuspanel.h
src/declarative/fx/qfxfocusrealm.h
src/declarative/fx/qfxhighlightfilter.cpp
src/declarative/fx/qfxhighlightfilter.h
src/declarative/fx/qfximage.cpp
src/declarative/fx/qfxitem.cpp
src/declarative/fx/qfxitem.h
src/declarative/fx/qfxrect.cpp
src/declarative/fx/qfxreflectionfilter.h
src/declarative/fx/qfxshadowfilter.cpp
src/declarative/fx/qfxshadowfilter.h
src/declarative/fx/qfxtext.cpp
src/declarative/fx/qfxtext.h
src/declarative/fx/qfxtextedit.cpp
src/declarative/opengl/glbasicshaders.h
src/declarative/test/qfxtestengine.cpp
src/declarative/test/qfxtestengine.h
src/declarative/test/qfxtestobjects.cpp
src/declarative/test/qfxtestobjects.h
src/declarative/test/qfxtestview.h
src/declarative/util/qfxglobal.h
src/declarative/util/qfxview.cpp
src/gui/graphicsview/qgraphicsitem_p.h
tools/qmlviewer/qmlviewer.cpp
Diffstat (limited to 'src/3rdparty/webkit/WebCore/loader/CachedResource.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/loader/CachedResource.cpp | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp b/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp index dceeec0..478873f 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp +++ b/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp @@ -35,6 +35,7 @@ #include <wtf/CurrentTime.h> #include <wtf/MathExtras.h> #include <wtf/RefCountedLeakCounter.h> +#include <wtf/StdLibExtras.h> #include <wtf/Vector.h> using namespace WTF; @@ -172,7 +173,13 @@ void CachedResource::setRequest(Request* request) delete this; } -void CachedResource::addClient(CachedResourceClient *c) +void CachedResource::addClient(CachedResourceClient* client) +{ + addClientToSet(client); + didAddClient(client); +} + +void CachedResource::addClientToSet(CachedResourceClient* client) { ASSERT(!isPurgeable()); @@ -186,21 +193,28 @@ void CachedResource::addClient(CachedResourceClient *c) } if (!hasClients() && inCache()) cache()->addToLiveResourcesSize(this); - m_clients.add(c); + m_clients.add(client); } -void CachedResource::removeClient(CachedResourceClient *c) +void CachedResource::removeClient(CachedResourceClient* client) { - ASSERT(m_clients.contains(c)); - m_clients.remove(c); + ASSERT(m_clients.contains(client)); + m_clients.remove(client); + if (canDelete() && !inCache()) delete this; else if (!hasClients() && inCache()) { cache()->removeFromLiveResourcesSize(this); cache()->removeFromLiveDecodedResourcesList(this); allClientsRemoved(); - cache()->prune(); + if (response().cacheControlContainsNoStore()) { + // RFC2616 14.9.2: + // "no-store: ...MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible" + cache()->remove(this); + } else + cache()->prune(); } + // This object may be dead here. } void CachedResource::deleteIfPossible() @@ -329,10 +343,15 @@ void CachedResource::switchClientsToRevalidatedResource() } // Equivalent of calling removeClient() for all clients m_clients.clear(); - + unsigned moveCount = clientsToMove.size(); for (unsigned n = 0; n < moveCount; ++n) - m_resourceToRevalidate->addClient(clientsToMove[n]); + m_resourceToRevalidate->addClientToSet(clientsToMove[n]); + for (unsigned n = 0; n < moveCount; ++n) { + // Calling didAddClient for a client may end up removing another client. In that case it won't be in the set anymore. + if (m_resourceToRevalidate->m_clients.contains(clientsToMove[n])) + m_resourceToRevalidate->didAddClient(clientsToMove[n]); + } } void CachedResource::updateResponseAfterRevalidation(const ResourceResponse& validatingResponse) @@ -354,18 +373,32 @@ void CachedResource::updateResponseAfterRevalidation(const ResourceResponse& val bool CachedResource::canUseCacheValidator() const { - return !m_loading && (!m_response.httpHeaderField("Last-Modified").isEmpty() || !m_response.httpHeaderField("ETag").isEmpty()); + if (m_loading || m_errorOccurred) + return false; + + if (m_response.cacheControlContainsNoStore()) + return false; + + DEFINE_STATIC_LOCAL(const AtomicString, lastModifiedHeader, ("last-modified")); + DEFINE_STATIC_LOCAL(const AtomicString, eTagHeader, ("etag")); + return !m_response.httpHeaderField(lastModifiedHeader).isEmpty() || !m_response.httpHeaderField(eTagHeader).isEmpty(); } bool CachedResource::mustRevalidate(CachePolicy cachePolicy) const { + if (m_errorOccurred) + return true; + if (m_loading) return false; + + if (m_response.cacheControlContainsNoCache() || m_response.cacheControlContainsNoStore()) + return true; if (cachePolicy == CachePolicyCache) - return m_response.cacheControlContainsNoCache() || (isExpired() && m_response.cacheControlContainsMustRevalidate()); + return m_response.cacheControlContainsMustRevalidate() && isExpired(); - return isExpired() || m_response.cacheControlContainsNoCache(); + return isExpired(); } bool CachedResource::isSafeToMakePurgeable() const |