Commit 3752fb81 authored by andersca@apple.com's avatar andersca@apple.com
Browse files

2008-04-17 Anders Carlsson <andersca@apple.com>

        Reviewed by Sam.
        
        Add plumbing for associating document loaders with application caches.
        
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::DocumentLoader):
        (WebCore::DocumentLoader::~DocumentLoader):
        (WebCore::DocumentLoader::originalURL):
        (WebCore::DocumentLoader::requestURL):
        (WebCore::DocumentLoader::responseURL):
        (WebCore::DocumentLoader::responseMIMEType):
        (WebCore::DocumentLoader::setCandidateApplicationCacheGroup):
        (WebCore::DocumentLoader::setApplicationCache):
        (WebCore::DocumentLoader::toplevelApplicationCache):
        * loader/DocumentLoader.h:
        (WebCore::DocumentLoader::candidateApplicationCacheGroup):
        (WebCore::DocumentLoader::applicationCache):
        * loader/appcache/ApplicationCacheGroup.h:
        (WebCore::ApplicationCacheGroup::documentLoaderDestroyed):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c32ab617
2008-04-17 Anders Carlsson <andersca@apple.com>
Reviewed by Sam.
Add plumbing for associating document loaders with application caches.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::DocumentLoader):
(WebCore::DocumentLoader::~DocumentLoader):
(WebCore::DocumentLoader::originalURL):
(WebCore::DocumentLoader::requestURL):
(WebCore::DocumentLoader::responseURL):
(WebCore::DocumentLoader::responseMIMEType):
(WebCore::DocumentLoader::setCandidateApplicationCacheGroup):
(WebCore::DocumentLoader::setApplicationCache):
(WebCore::DocumentLoader::toplevelApplicationCache):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::candidateApplicationCacheGroup):
(WebCore::DocumentLoader::applicationCache):
* loader/appcache/ApplicationCacheGroup.h:
(WebCore::ApplicationCacheGroup::documentLoaderDestroyed):
2008-04-17 Adam Roben <aroben@apple.com>
 
Fix Bug 18544: REGRESSION (r31951): Two fast/xsl tests crash
......@@ -29,6 +29,8 @@
#include "config.h"
#include "DocumentLoader.h"
#include "ApplicationCache.h"
#include "ApplicationCacheGroup.h"
#include "ArchiveResourceCollection.h"
#include "CachedPage.h"
#include "DocLoader.h"
......@@ -144,6 +146,9 @@ DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData&
, m_loadingFromCachedPage(false)
, m_stopRecordingResponses(false)
, m_substituteResourceDeliveryTimer(this, &DocumentLoader::substituteResourceDeliveryTimerFired)
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
, m_candidateApplicationCacheGroup(0)
#endif
{
}
......@@ -157,6 +162,13 @@ FrameLoader* DocumentLoader::frameLoader() const
DocumentLoader::~DocumentLoader()
{
ASSERT(!m_frame || frameLoader()->activeDocumentLoader() != this || !frameLoader()->isLoading());
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
if (m_applicationCache)
m_applicationCache->group()->documentLoaderDestroyed(this);
else if (m_candidateApplicationCacheGroup)
m_candidateApplicationCacheGroup->documentLoaderDestroyed(this);
#endif
}
PassRefPtr<SharedBuffer> DocumentLoader::mainResourceData() const
......@@ -652,22 +664,22 @@ void DocumentLoader::loadFromCachedPage(PassRefPtr<CachedPage> cachedPage)
frameLoader()->commitProvisionalLoad(cachedPage);
}
KURL DocumentLoader::originalURL() const
const KURL& DocumentLoader::originalURL() const
{
return m_originalRequestCopy.url();
}
KURL DocumentLoader::requestURL() const
const KURL& DocumentLoader::requestURL() const
{
return request().url();
}
KURL DocumentLoader::responseURL() const
const KURL& DocumentLoader::responseURL() const
{
return m_response.url();
}
String DocumentLoader::responseMIMEType() const
const String& DocumentLoader::responseMIMEType() const
{
return m_response.mimeType();
}
......@@ -784,4 +796,36 @@ void DocumentLoader::iconLoadDecisionAvailable()
m_frame->loader()->iconLoadDecisionAvailable();
}
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
void DocumentLoader::setCandidateApplicationCacheGroup(ApplicationCacheGroup* group)
{
ASSERT(!m_applicationCache);
m_candidateApplicationCacheGroup = group;
}
void DocumentLoader::setApplicationCache(PassRefPtr<ApplicationCache> applicationCache)
{
if (m_candidateApplicationCacheGroup) {
ASSERT(!m_applicationCache);
m_candidateApplicationCacheGroup = 0;
}
m_applicationCache = applicationCache;
}
ApplicationCache* DocumentLoader::toplevelApplicationCache() const
{
if (!m_frame)
return 0;
if (m_applicationCache)
return m_applicationCache.get();
if (Page* page = m_frame->page())
return page->mainFrame()->loader()->documentLoader()->applicationCache();
return 0;
}
#endif
}
......@@ -43,6 +43,10 @@
namespace WebCore {
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
class ApplicationCache;
class ApplicationCacheGroup;
#endif
class Archive;
class ArchiveResource;
class ArchiveResourceCollection;
......@@ -88,10 +92,10 @@ namespace WebCore {
const KURL& url() const;
const KURL& unreachableURL() const;
KURL originalURL() const;
KURL requestURL() const;
KURL responseURL() const;
String responseMIMEType() const;
const KURL& originalURL() const;
const KURL& requestURL() const;
const KURL& responseURL() const;
const String& responseMIMEType() const;
void replaceRequestURLForAnchorScroll(const KURL&);
bool isStopping() const { return m_isStopping; }
......@@ -184,6 +188,16 @@ namespace WebCore {
void subresourceLoaderFinishedLoadingOnePart(ResourceLoader*);
bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; }
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
void setCandidateApplicationCacheGroup(ApplicationCacheGroup* group);
ApplicationCacheGroup* candidateApplicationCacheGroup() const { return m_candidateApplicationCacheGroup; }
void setApplicationCache(PassRefPtr<ApplicationCache> applicationCache);
ApplicationCache* applicationCache() const { return m_applicationCache.get(); }
ApplicationCache* toplevelApplicationCache() const;
#endif
protected:
bool m_deferMainResourceDataLoad;
......@@ -262,6 +276,15 @@ namespace WebCore {
OwnPtr<ArchiveResourceCollection> m_archiveResourceCollection;
RefPtr<SharedBuffer> m_parsedArchiveData;
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
// The application cache that the document loader is associated with (if any).
RefPtr<ApplicationCache> m_applicationCache;
// Before an application cache has finished loading, this will be the candidate application
// group that the document loader is associated with.
ApplicationCacheGroup* m_candidateApplicationCacheGroup;
#endif
};
}
......
......@@ -33,6 +33,7 @@
namespace WebCore {
class ApplicationCache;
class DocumentLoader;
class ApplicationCacheGroup {
public:
......@@ -40,6 +41,7 @@ public:
void cacheDestroyed(ApplicationCache*) { }
void documentLoaderDestroyed(DocumentLoader*) { }
private:
KURL m_manifestURL;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment