https://bugs.webkit.org/show_bug.cgi?id=51134
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Dec 2010 20:57:02 +0000 (20:57 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Dec 2010 20:57:02 +0000 (20:57 +0000)
commit0b7040170d3c52cf20d84bf85483321e3ddbd6ec
tree620e47309fd4039e800bcd9c771448cbd9925bf7
parent4da31067dd5f9992c057bb79b51fe3f46e113e7c
https://bugs.webkit.org/show_bug.cgi?id=51134
Move loading related code from MemoryCache to CachedResourceLoader

Reviewed by Darin Adler.

- Merge MemoryCache::requestResource to CachedResourceLoader::requestResource
- Merge MemoryCache::requestUserCSSStyleSheet to CachedResourceLoader::requestUserCSSStyleSheet
- Move MemoryCache::revalidateResource to CachedResourceLoader::revalidateResource
- Add MemoryCache::add
- Refactor the decision on whether to reload, revalidate or use the existing resource to
  a single function, CachedResourceLoader::determineRevalidationPolicy

* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::cachedImage):

    Remove a code path that called MemoryCache::requestResource directly. This code path would have crashed
    if ever taken (since it passes null CachedResourceLoader pointer).

* loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):
* loader/cache/CachedImage.cpp:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource):
(WebCore::CachedResource::~CachedResource):
(WebCore::CachedResource::mustRevalidateDueToCacheHeaders):

    Moved tests that were not about cache headers to CachedResourceLoader::determineRevalidationPolicy and renamed.

(WebCore::CachedResource::setLoadPriority):

    Check for Unresolved value before setting.

* loader/cache/CachedResource.h:
(WebCore::CachedResource::setOwningCachedResourceLoader):

    Rename to be bit less mysterious.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::createResource):

    This was moved from MemoryCache.

(WebCore::CachedResourceLoader::~CachedResourceLoader):
(WebCore::CachedResourceLoader::determineRevalidationPolicy):
(WebCore::CachedResourceLoader::requestUserCSSStyleSheet):

    This was moved/merged from MemoryCache.

(WebCore::CachedResourceLoader::canRequest):
(WebCore::CachedResourceLoader::requestResource):

    This combines MemoryCache::requestResource and the existing method.

(WebCore::CachedResourceLoader::revalidateResource):

    This was moved from MemoryCache.

(WebCore::CachedResourceLoader::loadResource):

    New method for initiating loading.

(WebCore::CachedResourceLoader::notifyLoadedFromMemoryCache):

    Renamed the mysterious CachedResourceLoader::checkCacheObjectStatus

* loader/cache/CachedResourceLoader.h:
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::add):
* loader/cache/MemoryCache.h:
(WebCore::MemoryCache::remove):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74807 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/CSSImageValue.cpp
WebCore/loader/ImageLoader.cpp
WebCore/loader/cache/CachedImage.cpp
WebCore/loader/cache/CachedResource.cpp
WebCore/loader/cache/CachedResource.h
WebCore/loader/cache/CachedResourceLoader.cpp
WebCore/loader/cache/CachedResourceLoader.h
WebCore/loader/cache/MemoryCache.cpp
WebCore/loader/cache/MemoryCache.h