Web Replay: add page-level setting to bypass the MemoryCache
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Mar 2014 22:46:27 +0000 (22:46 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Mar 2014 22:46:27 +0000 (22:46 +0000)
commitc21143ad955ebf35e0fa73b2c29ae7729a4b208a
treecba604e7be77846bc9dce16f2a4f199f3f9fd2ed
parent38e8773bdd5ff24ac1211555e27876153d03a6a3
Web Replay: add page-level setting to bypass the MemoryCache
https://bugs.webkit.org/show_bug.cgi?id=130728

Reviewed by Timothy Hatcher.

Source/WebCore:

When replaying a specific Page we don't want to store its cached resources in the
MemoryCache. This patch adds a page setting to prevent the page's resources from
being saved in the MemoryCache.

If Settings::usesMemoryCache() is false, page resources are given the special
SessionID bypassCacheSessionID(). The cached resource loader and memory cache
act as if the memory cache is disabled if the resource has this special session id.

Hook up ReplayController to override the memory cache setting during capture/replay.

Test: http/tests/cache/bypass-memory-cache-after-reload.html

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
(WebCore::CachedResourceLoader::revalidateResource):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::add):
* page/Page.cpp:
(WebCore::Page::sessionID):
* page/SessionID.h:
(WebCore::SessionID::bypassCacheSessionID):
* page/Settings.cpp:
(WebCore::Settings::Settings):
* page/Settings.h:
(WebCore::Settings::setUsesMemoryCache):
(WebCore::Settings::usesMemoryCache):
* replay/ReplayController.cpp:
(WebCore::ReplayController::setForceDeterministicSettings):
* replay/ReplayController.h:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setUsesMemoryCache):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebKit2:

* UIProcess/APISession.cpp:
(API::generateID): update the base ID for generating unique sessions.

LayoutTests:

Mac WebKit2 needs different expectations because of resource load timing characteristics
introduced by the interaction of Settings::usesMemoryCache and NetworkProcess.

* http/tests/cache/bypass-memory-cache-after-reload-expected.txt: Added.
* http/tests/cache/bypass-memory-cache-after-reload.html: Added.
* platform/mac-wk2/http/tests/cache/bypass-memory-cache-after-reload-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/cache/bypass-memory-cache-after-reload-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cache/bypass-memory-cache-after-reload.html [new file with mode: 0644]
LayoutTests/platform/mac-wk2/http/tests/cache/bypass-memory-cache-after-reload-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/MemoryCache.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/SessionID.h
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/replay/ReplayController.cpp
Source/WebCore/replay/ReplayController.h
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/APISession.cpp