summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/loader/cache
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/loader/cache')
-rw-r--r--Source/WebCore/loader/cache/CachedFont.cpp4
-rw-r--r--Source/WebCore/loader/cache/CachedFont.h3
-rw-r--r--Source/WebCore/loader/cache/CachedImage.cpp10
-rw-r--r--Source/WebCore/loader/cache/CachedImage.h2
-rw-r--r--Source/WebCore/loader/cache/CachedResource.cpp33
-rw-r--r--Source/WebCore/loader/cache/CachedResource.h7
-rw-r--r--Source/WebCore/loader/cache/CachedResourceLoader.cpp32
-rw-r--r--Source/WebCore/loader/cache/CachedResourceLoader.h3
-rw-r--r--Source/WebCore/loader/cache/CachedScript.cpp14
-rw-r--r--Source/WebCore/loader/cache/CachedScript.h2
10 files changed, 47 insertions, 63 deletions
diff --git a/Source/WebCore/loader/cache/CachedFont.cpp b/Source/WebCore/loader/cache/CachedFont.cpp
index 19eb3ba..ea2ee14 100644
--- a/Source/WebCore/loader/cache/CachedFont.cpp
+++ b/Source/WebCore/loader/cache/CachedFont.cpp
@@ -117,7 +117,7 @@ bool CachedFont::ensureCustomFontData()
return m_fontData;
}
-FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)
+FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation orientation, TextOrientation textOrientation, FontWidthVariant widthVariant, FontRenderingMode renderingMode)
{
#if ENABLE(SVG_FONTS)
if (m_externalSVGDocument)
@@ -125,7 +125,7 @@ FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, b
#endif
#ifdef STORE_FONT_CUSTOM_PLATFORM_DATA
ASSERT(m_fontData);
- return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant, renderingMode);
+ return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, textOrientation, widthVariant, renderingMode);
#else
return FontPlatformData();
#endif
diff --git a/Source/WebCore/loader/cache/CachedFont.h b/Source/WebCore/loader/cache/CachedFont.h
index cdc32ba..d677f7b 100644
--- a/Source/WebCore/loader/cache/CachedFont.h
+++ b/Source/WebCore/loader/cache/CachedFont.h
@@ -30,6 +30,7 @@
#include "FontOrientation.h"
#include "FontRenderingMode.h"
#include "FontWidthVariant.h"
+#include "TextOrientation.h"
#include <wtf/Vector.h>
#if ENABLE(SVG_FONTS)
@@ -64,7 +65,7 @@ public:
void beginLoadIfNeeded(CachedResourceLoader* dl);
bool ensureCustomFontData();
- FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
+ FontPlatformData platformDataFromCustomData(float size, bool bold, bool italic, FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight, FontWidthVariant = RegularWidth, FontRenderingMode = NormalRenderingMode);
#if ENABLE(SVG_FONTS)
bool isSVGFont() const { return m_isSVGFont; }
diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp
index b309ae6..cc49415 100644
--- a/Source/WebCore/loader/cache/CachedImage.cpp
+++ b/Source/WebCore/loader/cache/CachedImage.cpp
@@ -325,16 +325,6 @@ void CachedImage::error(CachedResource::Status status)
checkNotify();
}
-void CachedImage::checkNotify()
-{
- if (isLoading())
- return;
-
- CachedResourceClientWalker w(m_clients);
- while (CachedResourceClient* c = w.next())
- c->notifyFinished(this);
-}
-
void CachedImage::destroyDecodedData()
{
bool canDeleteImage = !m_image || (m_image->hasOneRef() && m_image->isBitmapImage());
diff --git a/Source/WebCore/loader/cache/CachedImage.h b/Source/WebCore/loader/cache/CachedImage.h
index 3242409..42c7814 100644
--- a/Source/WebCore/loader/cache/CachedImage.h
+++ b/Source/WebCore/loader/cache/CachedImage.h
@@ -71,8 +71,6 @@ public:
// For compatibility, images keep loading even if there are HTTP errors.
virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return true; }
- void checkNotify();
-
virtual bool isImage() const { return true; }
void clear();
diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp
index 0f9ff45..9413472 100644
--- a/Source/WebCore/loader/cache/CachedResource.cpp
+++ b/Source/WebCore/loader/cache/CachedResource.cpp
@@ -93,8 +93,8 @@ CachedResource::CachedResource(const String& url, Type type)
, m_loading(false)
, m_type(type)
, m_status(Pending)
- , m_deleted(false)
#ifndef NDEBUG
+ , m_deleted(false)
, m_lruIndex(0)
#endif
, m_nextInAllResourcesList(0)
@@ -118,13 +118,8 @@ CachedResource::~CachedResource()
ASSERT(!m_deleted);
ASSERT(url().isNull() || memoryCache()->resourceForURL(KURL(ParsedURLString, url())) != this);
- if (m_deleted) {
- // FIXME: Remove when http://webkit.org/b/53045 is fixed.
- CRASH();
- }
-
- m_deleted = true;
#ifndef NDEBUG
+ m_deleted = true;
cachedResourceLeakCounter.decrement();
#endif
@@ -139,15 +134,33 @@ void CachedResource::load(CachedResourceLoader* cachedResourceLoader, bool incre
m_loading = true;
}
+void CachedResource::checkNotify()
+{
+ if (isLoading())
+ return;
+
+ CachedResourceClientWalker w(m_clients);
+ while (CachedResourceClient* c = w.next())
+ c->notifyFinished(this);
+}
+
void CachedResource::data(PassRefPtr<SharedBuffer>, bool allDataReceived)
{
if (!allDataReceived)
return;
setLoading(false);
- CachedResourceClientWalker w(m_clients);
- while (CachedResourceClient* c = w.next())
- c->notifyFinished(this);
+ checkNotify();
+}
+
+void CachedResource::error(CachedResource::Status status)
+{
+ setStatus(status);
+ ASSERT(errorOccurred());
+ m_data.clear();
+
+ setLoading(false);
+ checkNotify();
}
void CachedResource::finish()
diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h
index 3379f8c..16920a5 100644
--- a/Source/WebCore/loader/cache/CachedResource.h
+++ b/Source/WebCore/loader/cache/CachedResource.h
@@ -86,7 +86,7 @@ public:
virtual void setEncoding(const String&) { }
virtual String encoding() const { return String(); }
virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived);
- virtual void error(CachedResource::Status) { }
+ virtual void error(CachedResource::Status);
virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return false; }
@@ -217,6 +217,8 @@ public:
void updateResponseAfterRevalidation(const ResourceResponse& validatingResponse);
protected:
+ void checkNotify();
+
void setEncodedSize(unsigned);
void setDecodedSize(unsigned);
void didAccessDecodedData(double timeStamp);
@@ -266,9 +268,8 @@ private:
unsigned m_type : 3; // Type
unsigned m_status : 3; // Status
- // FIXME: Move m_deleted back inside NDEBUG when http://webkit.org/b/53045 is fixed.
- bool m_deleted;
#ifndef NDEBUG
+ bool m_deleted;
unsigned m_lruIndex;
#endif
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
index 56715c6..3b6a0b2 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
@@ -34,6 +34,7 @@
#include "CachedScript.h"
#include "CachedXSLStyleSheet.h"
#include "Console.h"
+#include "ContentSecurityPolicy.h"
#include "DOMWindow.h"
#include "Document.h"
#include "Frame.h"
@@ -41,7 +42,6 @@
#include "FrameLoaderClient.h"
#include "HTMLElement.h"
#include "Logging.h"
-#include "NestingLevelIncrementer.h"
#include "MemoryCache.h"
#include "PingLoader.h"
#include "ResourceLoadScheduler.h"
@@ -85,21 +85,18 @@ CachedResourceLoader::CachedResourceLoader(Document* document)
, m_autoLoadImages(true)
, m_loadFinishing(false)
, m_allowStaleResources(false)
+<<<<<<< HEAD
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
, m_blockNetworkImage(false)
#endif
, m_isInMethod(0)
+=======
+>>>>>>> webkit.org at r82507
{
}
CachedResourceLoader::~CachedResourceLoader()
{
- // Try to catch https://bugs.webkit.org/show_bug.cgi?id=54486
- // Crashes under CachedResourceLoader::revalidateResource
- // FIXME: Remove this and the related code when it has served its purpose.
- if (m_isInMethod)
- CRASH();
-
m_document = 0;
cancelRequests();
@@ -131,7 +128,6 @@ Frame* CachedResourceLoader::frame() const
CachedImage* CachedResourceLoader::requestImage(const String& url)
{
- NestingLevelIncrementer debugIncrementer(m_isInMethod);
if (Frame* f = frame()) {
Settings* settings = f->settings();
if (!f->loader()->client()->allowImages(!settings || settings->areImagesEnabled()))
@@ -169,7 +165,6 @@ CachedCSSStyleSheet* CachedResourceLoader::requestCSSStyleSheet(const String& ur
CachedCSSStyleSheet* CachedResourceLoader::requestUserCSSStyleSheet(const String& requestURL, const String& charset)
{
- NestingLevelIncrementer debugIncrementer(m_isInMethod);
KURL url = MemoryCache::removeFragmentIdentifierIfNeeded(KURL(KURL(), requestURL));
if (CachedResource* existing = memoryCache()->resourceForURL(url)) {
@@ -235,9 +230,6 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url
}
break;
#endif
- default:
- ASSERT_NOT_REACHED();
- break;
}
// Given that the load is allowed by the same-origin policy, we should
@@ -271,17 +263,17 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url
// Prefetch cannot affect the current document.
break;
#endif
- default:
- ASSERT_NOT_REACHED();
- break;
}
// FIXME: Consider letting the embedder block mixed content loads.
+
+ if (type == CachedResource::Script && !m_document->contentSecurityPolicy()->allowScriptFromSource(url))
+ return false;
+
return true;
}
CachedResource* CachedResourceLoader::requestResource(CachedResource::Type type, const String& resourceURL, const String& charset, ResourceLoadPriority priority, bool forPreload)
{
- NestingLevelIncrementer debugIncrementer(m_isInMethod);
KURL url = m_document->completeURL(resourceURL);
LOG(ResourceLoading, "CachedResourceLoader::requestResource '%s', charset '%s', priority=%d, forPreload=%u", url.string().latin1().data(), charset.latin1().data(), priority, forPreload);
@@ -348,7 +340,8 @@ CachedResource* CachedResourceLoader::revalidateResource(CachedResource* resourc
ASSERT(resource->canUseCacheValidator());
ASSERT(!resource->resourceToRevalidate());
- const String& url = resource->url();
+ // Copy the URL out of the resource to be revalidated in case it gets deleted by the remove() call below.
+ String url = resource->url();
CachedResource* newResource = createResource(resource->type(), KURL(ParsedURLString, url), resource->encoding());
LOG(ResourceLoading, "Resource %p created to revalidate %p", newResource, resource);
@@ -489,7 +482,6 @@ void CachedResourceLoader::printAccessDeniedMessage(const KURL& url) const
void CachedResourceLoader::setAutoLoadImages(bool enable)
{
- NestingLevelIncrementer debugIncrementer(m_isInMethod);
if (enable == m_autoLoadImages)
return;
@@ -566,7 +558,6 @@ void CachedResourceLoader::removeCachedResource(CachedResource* resource) const
void CachedResourceLoader::load(CachedResource* resource, bool incremental, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks)
{
- NestingLevelIncrementer debugIncrementer(m_isInMethod);
incrementRequestCount(resource);
RefPtr<CachedResourceRequest> request = CachedResourceRequest::load(this, resource, incremental, securityCheck, sendResourceLoadCallbacks);
@@ -576,7 +567,6 @@ void CachedResourceLoader::load(CachedResource* resource, bool incremental, Secu
void CachedResourceLoader::loadDone(CachedResourceRequest* request)
{
- NestingLevelIncrementer debugIncrementer(m_isInMethod);
m_loadFinishing = false;
RefPtr<CachedResourceRequest> protect(request);
if (request)
@@ -653,7 +643,6 @@ int CachedResourceLoader::requestCount()
void CachedResourceLoader::preload(CachedResource::Type type, const String& url, const String& charset, bool referencedFromBody)
{
- NestingLevelIncrementer debugIncrementer(m_isInMethod);
bool hasRendering = m_document->body() && m_document->body()->renderer();
if (!hasRendering && (referencedFromBody || type == CachedResource::ImageResource)) {
// Don't preload images or body resources before we have something to draw. This prevents
@@ -680,7 +669,6 @@ void CachedResourceLoader::checkForPendingPreloads()
void CachedResourceLoader::requestPreload(CachedResource::Type type, const String& url, const String& charset)
{
- NestingLevelIncrementer debugIncrementer(m_isInMethod);
String encoding;
if (type == CachedResource::Script || type == CachedResource::CSSStyleSheet)
encoding = charset.isEmpty() ? m_document->charset() : charset;
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h
index 0302010..a68ebd3 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.h
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.h
@@ -153,12 +153,15 @@ private:
bool m_autoLoadImages : 1;
bool m_loadFinishing : 1;
bool m_allowStaleResources : 1;
+<<<<<<< HEAD
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
bool m_blockNetworkImage : 1;
#endif
// FIME: For debugging, remove.
unsigned m_isInMethod;
+=======
+>>>>>>> webkit.org at r82507
};
}
diff --git a/Source/WebCore/loader/cache/CachedScript.cpp b/Source/WebCore/loader/cache/CachedScript.cpp
index bfd39c5..e1a8a32 100644
--- a/Source/WebCore/loader/cache/CachedScript.cpp
+++ b/Source/WebCore/loader/cache/CachedScript.cpp
@@ -88,6 +88,8 @@ const String& CachedScript::script()
m_script += m_decoder->flush();
setDecodedSize(m_script.length() * sizeof(UChar));
}
+ m_decodedDataDeletionTimer.startOneShot(0);
+
return m_script;
}
@@ -102,16 +104,6 @@ void CachedScript::data(PassRefPtr<SharedBuffer> data, bool allDataReceived)
checkNotify();
}
-void CachedScript::checkNotify()
-{
- if (isLoading())
- return;
-
- CachedResourceClientWalker w(m_clients);
- while (CachedResourceClient* c = w.next())
- c->notifyFinished(this);
-}
-
void CachedScript::error(CachedResource::Status status)
{
setStatus(status);
@@ -125,7 +117,7 @@ void CachedScript::destroyDecodedData()
m_script = String();
unsigned extraSize = 0;
#if USE(JSC)
- if (m_sourceProviderCache)
+ if (m_sourceProviderCache && m_clients.isEmpty())
m_sourceProviderCache->clear();
extraSize = m_sourceProviderCache ? m_sourceProviderCache->byteSize() : 0;
diff --git a/Source/WebCore/loader/cache/CachedScript.h b/Source/WebCore/loader/cache/CachedScript.h
index 85c3805..a4ea453 100644
--- a/Source/WebCore/loader/cache/CachedScript.h
+++ b/Source/WebCore/loader/cache/CachedScript.h
@@ -55,8 +55,6 @@ namespace WebCore {
virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived);
virtual void error(Status);
- void checkNotify();
-
virtual void destroyDecodedData();
#if USE(JSC)
// Allows JSC to cache additional information about the source.