Make memoryCache() return a reference
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Nov 2014 17:04:42 +0000 (17:04 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Nov 2014 17:04:42 +0000 (17:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138939

Reviewed by Antti Koivisto.

Source/WebCore:

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::cachedResource):
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::replayXHR):
(WebCore::InspectorResourceAgent::setCacheDisabled):
(WebCore::InspectorResourceAgent::mainFrameNavigated):
* loader/DocumentLoader.cpp:
(WebCore::areAllLoadersPageCacheAcceptable):
(WebCore::DocumentLoader::finishedLoading):
(WebCore::DocumentLoader::responseReceived):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::tellClientAboutPastMemoryCacheLoads):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequest):
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::SubresourceLoader::didFail):
(WebCore::SubresourceLoader::willCancel):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::addIncrementalDataBuffer):
(WebCore::CachedImage::finishLoading):
* loader/cache/CachedResource.cpp:
(WebCore::deadDecodedDataDeletionIntervalForResourceType):
(WebCore::CachedResource::~CachedResource):
(WebCore::CachedResource::failBeforeStarting):
(WebCore::CachedResource::addClientToSet):
(WebCore::CachedResource::removeClient):
(WebCore::CachedResource::destroyDecodedDataIfNeeded):
(WebCore::CachedResource::setDecodedSize):
(WebCore::CachedResource::setEncodedSize):
(WebCore::CachedResource::didAccessDecodedData):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
(WebCore::CachedResourceLoader::requestResource):
(WebCore::CachedResourceLoader::revalidateResource):
(WebCore::CachedResourceLoader::loadResource):
(WebCore::CachedResourceLoader::clearPreloads):
(WebCore::CachedResourceLoader::printPreloadStats):
* loader/cache/MemoryCache.cpp:
(WebCore::memoryCache):
(WebCore::MemoryCache::removeRequestFromCache):
(WebCore::MemoryCache::removeRequestFromSessionCaches):
* loader/cache/MemoryCache.h:
* loader/cocoa/DiskCacheMonitorCocoa.mm:
(WebCore::DiskCacheMonitor::resourceBecameFileBacked):
* page/FrameView.cpp:
(WebCore::FrameView::willPaintContents):
(WebCore::FrameView::didPaintContents):
* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::releaseCriticalMemory):
* testing/Internals.cpp:
(WebCore::Internals::isLoadingFromMemoryCache):

Source/WebKit/mac:

* Misc/WebCache.mm:
(+[WebCache statistics]):
(+[WebCache emptyInMemoryResources]):
(+[WebCache sizeOfDeadResources:]):
(+[WebCache addImageToCache:forURL:forFrame:]):
(+[WebCache removeImageFromCacheForURL:forFrame:]):
(+[WebCache imageForURL:]):
(+[WebCache setDisabled:]):
(+[WebCache isDisabled]):
* WebView/WebView.mm:
(+[WebView _setCacheModel:]):

Source/WebKit/win:

* WebCache.cpp:
(WebCache::statistics):
(WebCache::empty):
(WebCache::setDisabled):
(WebCache::disabled):
* WebView.cpp:
(WebView::setCacheModel):

Source/WebKit2:

* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didCacheResource):
* WebProcess/ResourceCache/WebResourceCacheManager.cpp:
(WebKit::WebResourceCacheManager::getCacheOrigins):
(WebKit::WebResourceCacheManager::clearCacheForOrigin):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::terminate):
(WebKit::WebProcess::didClose):
(WebKit::WebProcess::clearResourceCaches):
(WebKit::getWebCoreMemoryCacheStatistics):
(WebKit::WebProcess::setMemoryCacheDisabled):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetCacheModel):
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformSetCacheModel):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176450 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/loader/cache/MemoryCache.cpp
Source/WebCore/loader/cache/MemoryCache.h
Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm
Source/WebCore/page/FrameView.cpp
Source/WebCore/platform/MemoryPressureHandler.cpp
Source/WebCore/testing/Internals.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Misc/WebCache.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCache.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Network/NetworkProcessConnection.cpp
Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm
Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp

index 0e41b5a..515b02a 100644 (file)
@@ -1,3 +1,64 @@
+2014-11-21  Anders Carlsson  <andersca@apple.com>
+
+        Make memoryCache() return a reference
+        https://bugs.webkit.org/show_bug.cgi?id=138939
+
+        Reviewed by Antti Koivisto.
+
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::cachedResource):
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::InspectorResourceAgent::replayXHR):
+        (WebCore::InspectorResourceAgent::setCacheDisabled):
+        (WebCore::InspectorResourceAgent::mainFrameNavigated):
+        * loader/DocumentLoader.cpp:
+        (WebCore::areAllLoadersPageCacheAcceptable):
+        (WebCore::DocumentLoader::finishedLoading):
+        (WebCore::DocumentLoader::responseReceived):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::tellClientAboutPastMemoryCacheLoads):
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::willSendRequest):
+        (WebCore::SubresourceLoader::didReceiveResponse):
+        (WebCore::SubresourceLoader::didFail):
+        (WebCore::SubresourceLoader::willCancel):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create):
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::addIncrementalDataBuffer):
+        (WebCore::CachedImage::finishLoading):
+        * loader/cache/CachedResource.cpp:
+        (WebCore::deadDecodedDataDeletionIntervalForResourceType):
+        (WebCore::CachedResource::~CachedResource):
+        (WebCore::CachedResource::failBeforeStarting):
+        (WebCore::CachedResource::addClientToSet):
+        (WebCore::CachedResource::removeClient):
+        (WebCore::CachedResource::destroyDecodedDataIfNeeded):
+        (WebCore::CachedResource::setDecodedSize):
+        (WebCore::CachedResource::setEncodedSize):
+        (WebCore::CachedResource::didAccessDecodedData):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
+        (WebCore::CachedResourceLoader::requestResource):
+        (WebCore::CachedResourceLoader::revalidateResource):
+        (WebCore::CachedResourceLoader::loadResource):
+        (WebCore::CachedResourceLoader::clearPreloads):
+        (WebCore::CachedResourceLoader::printPreloadStats):
+        * loader/cache/MemoryCache.cpp:
+        (WebCore::memoryCache):
+        (WebCore::MemoryCache::removeRequestFromCache):
+        (WebCore::MemoryCache::removeRequestFromSessionCaches):
+        * loader/cache/MemoryCache.h:
+        * loader/cocoa/DiskCacheMonitorCocoa.mm:
+        (WebCore::DiskCacheMonitor::resourceBecameFileBacked):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::willPaintContents):
+        (WebCore::FrameView::didPaintContents):
+        * platform/MemoryPressureHandler.cpp:
+        (WebCore::MemoryPressureHandler::releaseCriticalMemory):
+        * testing/Internals.cpp:
+        (WebCore::Internals::isLoadingFromMemoryCache):
+
 2014-11-21  Daniel Bates  <dabates@apple.com>
 
         [iOS] WebKit2 fails to build with public SDK due to missing SPI from CFNetwork, QuartzCore, MediaPlayer, XPC
index 2f244ca..aa9411a 100644 (file)
@@ -263,7 +263,7 @@ CachedResource* InspectorPageAgent::cachedResource(Frame* frame, const URL& url)
 #if ENABLE(CACHE_PARTITIONING)
         request.setDomainForCachePartition(frame->document()->topOrigin()->domainForCachePartition());
 #endif
-        cachedResource = memoryCache()->resourceForRequest(request, frame->page()->sessionID());
+        cachedResource = memoryCache().resourceForRequest(request, frame->page()->sessionID());
     }
 
     return cachedResource;
index 481b2ba..89bca09 100644 (file)
@@ -707,9 +707,9 @@ void InspectorResourceAgent::replayXHR(ErrorString&, const String& requestId)
     request.setDomainForCachePartition(m_pageAgent->mainFrame()->document()->topOrigin()->domainForCachePartition());
 #endif
 
-    CachedResource* cachedResource = memoryCache()->resourceForRequest(request, m_pageAgent->page()->sessionID());
+    CachedResource* cachedResource = memoryCache().resourceForRequest(request, m_pageAgent->page()->sessionID());
     if (cachedResource)
-        memoryCache()->remove(cachedResource);
+        memoryCache().remove(cachedResource);
 
     xhr->open(xhrReplayData->method(), xhrReplayData->url(), xhrReplayData->async(), IGNORE_EXCEPTION);
     for (const auto& header : xhrReplayData->headers())
@@ -741,7 +741,7 @@ void InspectorResourceAgent::setCacheDisabled(ErrorString&, bool cacheDisabled)
 {
     m_cacheDisabled = cacheDisabled;
     if (cacheDisabled)
-        memoryCache()->evictResources();
+        memoryCache().evictResources();
 }
 
 void InspectorResourceAgent::loadResource(ErrorString& errorString, const String& frameId, const String& urlString, PassRefPtr<LoadResourceCallback> prpCallback)
@@ -789,7 +789,7 @@ void InspectorResourceAgent::loadResource(ErrorString& errorString, const String
 void InspectorResourceAgent::mainFrameNavigated(DocumentLoader* loader)
 {
     if (m_cacheDisabled)
-        memoryCache()->evictResources();
+        memoryCache().evictResources();
 
     m_resourcesData->clear(m_pageAgent->loaderId(loader));
 }
index 1575431..e3cab78 100644 (file)
@@ -106,7 +106,7 @@ static bool areAllLoadersPageCacheAcceptable(const ResourceLoaderMap& loaders)
         if (!loader->frameLoader())
             return false;
 
-        CachedResource* cachedResource = memoryCache()->resourceForURL(handle->firstRequest().url(), loader->frameLoader()->frame().page()->sessionID());
+        CachedResource* cachedResource = memoryCache().resourceForURL(handle->firstRequest().url(), loader->frameLoader()->frame().page()->sessionID());
         if (!cachedResource)
             return false;
 
@@ -448,7 +448,7 @@ void DocumentLoader::finishedLoading(double finishTime)
     // and deny the appcache the chance to intercept it in the future, so remove from the memory cache.
     if (m_frame) {
         if (m_mainResource && m_frame->document()->hasManifest())
-            memoryCache()->remove(m_mainResource.get());
+            memoryCache().remove(m_mainResource.get());
     }
     m_applicationCacheHost->finishedLoadingMainResource();
 }
@@ -599,7 +599,7 @@ void DocumentLoader::responseReceived(CachedResource* resource, const ResourceRe
     // The memory cache doesn't understand the application cache or its caching rules. So if a main resource is served
     // from the application cache, ensure we don't save the result for future use.
     if (willLoadFallback)
-        memoryCache()->remove(m_mainResource.get());
+        memoryCache().remove(m_mainResource.get());
 
     if (willLoadFallback)
         return;
index 519408b..f6d8614 100644 (file)
@@ -3383,7 +3383,7 @@ void FrameLoader::tellClientAboutPastMemoryCacheLoads()
 
     size_t size = pastLoads.size();
     for (size_t i = 0; i < size; ++i) {
-        CachedResource* resource = memoryCache()->resourceForRequest(pastLoads[i], m_frame.page()->sessionID());
+        CachedResource* resource = memoryCache().resourceForRequest(pastLoads[i], m_frame.page()->sessionID());
 
         // FIXME: These loads, loaded from cache, but now gone from the cache by the time
         // Page::setMemoryCacheClientCallsEnabled(true) is called, will not be seen by the client.
index e15bdfb..3ef9233 100644 (file)
@@ -156,7 +156,7 @@ void SubresourceLoader::willSendRequest(ResourceRequest& newRequest, const Resou
         // Doing so would have us reusing the resource from the first request if the second request's revalidation succeeds.
         if (newRequest.isConditional() && m_resource->resourceToRevalidate() && newRequest.url() != m_resource->resourceToRevalidate()->response().url()) {
             newRequest.makeUnconditional();
-            memoryCache()->revalidationFailed(m_resource);
+            memoryCache().revalidationFailed(m_resource);
         }
         
         if (!m_documentLoader->cachedResourceLoader().canRequest(m_resource->type(), newRequest.url(), options())) {
@@ -202,13 +202,13 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response)
             // 304 Not modified / Use local copy
             // Existing resource is ok, just use it updating the expiration time.
             m_resource->setResponse(response);
-            memoryCache()->revalidationSucceeded(m_resource, response);
+            memoryCache().revalidationSucceeded(m_resource, response);
             if (!reachedTerminalState())
                 ResourceLoader::didReceiveResponse(response);
             return;
         }
         // Did not get 304 response, continue as a regular resource load.
-        memoryCache()->revalidationFailed(m_resource);
+        memoryCache().revalidationFailed(m_resource);
     }
 
     m_resource->responseReceived(response);
@@ -328,10 +328,10 @@ void SubresourceLoader::didFail(const ResourceError& error)
     CachedResourceHandle<CachedResource> protectResource(m_resource);
     m_state = Finishing;
     if (m_resource->resourceToRevalidate())
-        memoryCache()->revalidationFailed(m_resource);
+        memoryCache().revalidationFailed(m_resource);
     m_resource->setResourceError(error);
     if (!m_resource->isPreloaded())
-        memoryCache()->remove(m_resource);
+        memoryCache().remove(m_resource);
     m_resource->error(CachedResource::LoadError);
     cleanupForError(error);
     notifyDone();
@@ -361,9 +361,9 @@ void SubresourceLoader::willCancel(const ResourceError& error)
     m_state = Finishing;
 #endif
     if (m_resource->resourceToRevalidate())
-        memoryCache()->revalidationFailed(m_resource);
+        memoryCache().revalidationFailed(m_resource);
     m_resource->setResourceError(error);
-    memoryCache()->remove(m_resource);
+    memoryCache().remove(m_resource);
 }
 
 void SubresourceLoader::didCancel(const ResourceError&)
index 5c94069..aecf562 100644 (file)
@@ -547,7 +547,7 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString
 #if ENABLE(CACHE_PARTITIONING)
                 request.setDomainForCachePartition(frame->document()->topOrigin()->domainForCachePartition());
 #endif
-                CachedResource* cachedResource = memoryCache()->resourceForRequest(request, frame->page()->sessionID());
+                CachedResource* cachedResource = memoryCache().resourceForRequest(request, frame->page()->sessionID());
                 if (cachedResource) {
                     if (RefPtr<ArchiveResource> resource = ArchiveResource::create(cachedResource->resourceBuffer(), subresourceURL, cachedResource->response())) {
                         subresources.append(WTF::move(resource));
index db2ae97..20a9894 100644 (file)
@@ -381,7 +381,7 @@ void CachedImage::addIncrementalDataBuffer(SharedBuffer& data)
         // Image decoding failed. Either we need more image data or the image data is malformed.
         error(errorOccurred() ? status() : DecodeError);
         if (inCache())
-            memoryCache()->remove(this);
+            memoryCache().remove(this);
         return;
     }
 
@@ -422,7 +422,7 @@ void CachedImage::finishLoading(SharedBuffer* data)
         // Image decoding failed; the image data is malformed.
         error(errorOccurred() ? status() : DecodeError);
         if (inCache())
-            memoryCache()->remove(this);
+            memoryCache().remove(this);
         return;
     }
 
index 6173017..d3f886e 100644 (file)
@@ -103,7 +103,7 @@ static std::chrono::milliseconds deadDecodedDataDeletionIntervalForResourceType(
     if (type == CachedResource::Script)
         return std::chrono::milliseconds { 0 };
 
-    return memoryCache()->deadDecodedDataDeletionInterval();
+    return memoryCache().deadDecodedDataDeletionInterval();
 }
 
 DEFINE_DEBUG_ONLY_GLOBAL(RefCountedLeakCounter, cachedResourceLeakCounter, ("CachedResource"));
@@ -162,7 +162,7 @@ CachedResource::~CachedResource()
     ASSERT(canDelete());
     ASSERT(!inCache());
     ASSERT(!m_deleted);
-    ASSERT(url().isNull() || memoryCache()->resourceForRequest(resourceRequest(), sessionID()) != this);
+    ASSERT(url().isNull() || memoryCache().resourceForRequest(resourceRequest(), sessionID()) != this);
 
 #ifndef NDEBUG
     m_deleted = true;
@@ -178,7 +178,7 @@ void CachedResource::failBeforeStarting()
     // FIXME: What if resources in other frames were waiting for this revalidation?
     LOG(ResourceLoading, "Cannot start loading '%s'", url().string().latin1().data());
     if (m_resourceToRevalidate) 
-        memoryCache()->revalidationFailed(this); 
+        memoryCache().revalidationFailed(this); 
     error(CachedResource::LoadError);
 }
 
@@ -415,7 +415,7 @@ bool CachedResource::addClientToSet(CachedResourceClient* client)
             m_preloadResult = PreloadReferenced;
     }
     if (!hasClients() && inCache())
-        memoryCache()->addToLiveResourcesSize(this);
+        memoryCache().addToLiveResourcesSize(this);
 
     if ((m_type == RawResource || m_type == MainResource) && !m_response.isNull() && !m_proxyResource) {
         // Certain resources (especially XHRs and main resources) do crazy things if an asynchronous load returns
@@ -447,8 +447,8 @@ void CachedResource::removeClient(CachedResourceClient* client)
     bool deleted = deleteIfPossible();
     if (!deleted && !hasClients()) {
         if (inCache()) {
-            memoryCache()->removeFromLiveResourcesSize(this);
-            memoryCache()->removeFromLiveDecodedResourcesList(this);
+            memoryCache().removeFromLiveResourcesSize(this);
+            memoryCache().removeFromLiveDecodedResourcesList(this);
         }
         if (!m_switchingClientsToRevalidatedResource)
             allClientsRemoved();
@@ -458,9 +458,9 @@ void CachedResource::removeClient(CachedResourceClient* client)
             // "no-store: ... MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible"
             // "... History buffers MAY store such responses as part of their normal operation."
             // We allow non-secure content to be reused in history, but we do not allow secure content to be reused.
-            memoryCache()->remove(this);
+            memoryCache().remove(this);
         }
-        memoryCache()->prune();
+        memoryCache().prune();
     }
     // This object may be dead here.
 }
@@ -469,7 +469,7 @@ void CachedResource::destroyDecodedDataIfNeeded()
 {
     if (!m_decodedSize)
         return;
-    if (!memoryCache()->deadDecodedDataDeletionInterval().count())
+    if (!memoryCache().deadDecodedDataDeletionInterval().count())
         return;
     m_decodedDataDeletionTimer.restart();
 }
@@ -499,13 +499,13 @@ void CachedResource::setDecodedSize(unsigned size)
     // The object must be moved to a different queue, since its size has been changed.
     // Remove before updating m_decodedSize, so we find the resource in the correct LRU list.
     if (inCache())
-        memoryCache()->removeFromLRUList(this);
+        memoryCache().removeFromLRUList(this);
     
     m_decodedSize = size;
    
     if (inCache()) { 
         // Now insert into the new LRU list.
-        memoryCache()->insertInLRUList(this);
+        memoryCache().insertInLRUList(this);
         
         // Insert into or remove from the live decoded list if necessary.
         // When inserting into the LiveDecodedResourcesList it is possible
@@ -515,12 +515,12 @@ void CachedResource::setDecodedSize(unsigned size)
         // by access time. The weakening of the invariant does not pose
         // a problem. For more details please see: https://bugs.webkit.org/show_bug.cgi?id=30209
         if (m_decodedSize && !m_inLiveDecodedResourcesList && hasClients())
-            memoryCache()->insertInLiveDecodedResourcesList(this);
+            memoryCache().insertInLiveDecodedResourcesList(this);
         else if (!m_decodedSize && m_inLiveDecodedResourcesList)
-            memoryCache()->removeFromLiveDecodedResourcesList(this);
+            memoryCache().removeFromLiveDecodedResourcesList(this);
 
         // Update the cache's size totals.
-        memoryCache()->adjustSize(hasClients(), delta);
+        memoryCache().adjustSize(hasClients(), delta);
     }
 }
 
@@ -534,13 +534,13 @@ void CachedResource::setEncodedSize(unsigned size)
     // The object must be moved to a different queue, since its size has been changed.
     // Remove before updating m_encodedSize, so we find the resource in the correct LRU list.
     if (inCache())
-        memoryCache()->removeFromLRUList(this);
+        memoryCache().removeFromLRUList(this);
 
     m_encodedSize = size;
 
     if (inCache()) { 
-        memoryCache()->insertInLRUList(this);
-        memoryCache()->adjustSize(hasClients(), delta);
+        memoryCache().insertInLRUList(this);
+        memoryCache().adjustSize(hasClients(), delta);
     }
 }
 
@@ -550,10 +550,10 @@ void CachedResource::didAccessDecodedData(double timeStamp)
     
     if (inCache()) {
         if (m_inLiveDecodedResourcesList) {
-            memoryCache()->removeFromLiveDecodedResourcesList(this);
-            memoryCache()->insertInLiveDecodedResourcesList(this);
+            memoryCache().removeFromLiveDecodedResourcesList(this);
+            memoryCache().insertInLiveDecodedResourcesList(this);
         }
-        memoryCache()->prune();
+        memoryCache().prune();
     }
 }
     
index 3488de4..405902c 100644 (file)
@@ -211,17 +211,17 @@ CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSSt
     request.mutableResourceRequest().setDomainForCachePartition(document()->topOrigin()->domainForCachePartition());
 #endif
 
-    if (CachedResource* existing = memoryCache()->resourceForRequest(request.resourceRequest(), sessionID())) {
+    if (CachedResource* existing = memoryCache().resourceForRequest(request.resourceRequest(), sessionID())) {
         if (is<CachedCSSStyleSheet>(*existing))
             return downcast<CachedCSSStyleSheet>(existing);
-        memoryCache()->remove(existing);
+        memoryCache().remove(existing);
     }
     if (url.string() != request.resourceRequest().url())
         request.mutableResourceRequest().setURL(url);
 
     CachedResourceHandle<CachedCSSStyleSheet> userSheet = new CachedCSSStyleSheet(request.resourceRequest(), request.charset(), sessionID());
 
-    memoryCache()->add(userSheet.get());
+    memoryCache().add(userSheet.get());
     // FIXME: loadResource calls setOwningCachedResourceLoader() if the resource couldn't be added to cache. Does this function need to call it, too?
 
     userSheet->load(this, ResourceLoaderOptions(DoNotSendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, DoNotIncludeCertificateInfo));
@@ -455,7 +455,7 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache
     if (Frame* f = frame())
         f->loader().client().dispatchWillRequestResource(&request);
 
-    if (memoryCache()->disabled()) {
+    if (memoryCache().disabled()) {
         DocumentResourceMap::iterator it = m_documentResources.find(url.string());
         if (it != m_documentResources.end()) {
             it->value->setOwningCachedResourceLoader(0);
@@ -470,12 +470,12 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache
         request.mutableResourceRequest().setDomainForCachePartition(document()->topOrigin()->domainForCachePartition());
 #endif
 
-    resource = memoryCache()->resourceForRequest(request.resourceRequest(), sessionID());
+    resource = memoryCache().resourceForRequest(request.resourceRequest(), sessionID());
 
     const RevalidationPolicy policy = determineRevalidationPolicy(type, request.mutableResourceRequest(), request.forPreload(), resource.get(), request.defer());
     switch (policy) {
     case Reload:
-        memoryCache()->remove(resource.get());
+        memoryCache().remove(resource.get());
         FALLTHROUGH;
     case Load:
         resource = loadResource(type, request);
@@ -486,7 +486,7 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache
     case Use:
         if (!shouldContinueAfterNotifyingLoadedFromMemoryCache(request, resource.get()))
             return 0;
-        memoryCache()->resourceAccessed(resource.get());
+        memoryCache().resourceAccessed(resource.get());
         break;
     }
 
@@ -502,7 +502,7 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache
         // We don't support immediate loads, but we do support immediate failure.
         if (resource->errorOccurred()) {
             if (resource->inCache())
-                memoryCache()->remove(resource.get());
+                memoryCache().remove(resource.get());
             return 0;
         }
     }
@@ -524,7 +524,7 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(co
 {
     ASSERT(resource);
     ASSERT(resource->inCache());
-    ASSERT(!memoryCache()->disabled());
+    ASSERT(!memoryCache().disabled());
     ASSERT(resource->canUseCacheValidator());
     ASSERT(!resource->resourceToRevalidate());
     ASSERT(resource->sessionID() == sessionID());
@@ -536,8 +536,8 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(co
     LOG(ResourceLoading, "Resource %p created to revalidate %p", newResource.get(), resource);
     newResource->setResourceToRevalidate(resource);
     
-    memoryCache()->remove(resource);
-    memoryCache()->add(newResource.get());
+    memoryCache().remove(resource);
+    memoryCache().add(newResource.get());
 #if ENABLE(RESOURCE_TIMING)
     storeResourceTimingInitiatorInformation(resource, request);
 #else
@@ -548,13 +548,13 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(co
 
 CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedResource::Type type, CachedResourceRequest& request)
 {
-    ASSERT(!memoryCache()->resourceForRequest(request.resourceRequest(), sessionID()));
+    ASSERT(!memoryCache().resourceForRequest(request.resourceRequest(), sessionID()));
 
     LOG(ResourceLoading, "Loading CachedResource for '%s'.", request.resourceRequest().url().stringCenterEllipsizedToLength().latin1().data());
 
     CachedResourceHandle<CachedResource> resource = createResource(type, request.mutableResourceRequest(), request.charset(), sessionID());
 
-    if (!memoryCache()->add(resource.get()))
+    if (!memoryCache().add(resource.get()))
         resource->setOwningCachedResourceLoader(this);
 #if ENABLE(RESOURCE_TIMING)
     storeResourceTimingInitiatorInformation(resource, request);
@@ -941,7 +941,7 @@ void CachedResourceLoader::clearPreloads()
         res->decreasePreloadCount();
         bool deleted = res->deleteIfPossible();
         if (!deleted && res->preloadResult() == CachedResource::PreloadNotReferenced)
-            memoryCache()->remove(res);
+            memoryCache().remove(res);
     }
     m_preloads = nullptr;
 }
@@ -985,7 +985,7 @@ void CachedResourceLoader::printPreloadStats()
         }
         
         if (res->errorOccurred())
-            memoryCache()->remove(res);
+            memoryCache().remove(res);
         
         res->decreasePreloadCount();
     }
index 61af2ff..2d3804d 100644 (file)
@@ -55,12 +55,13 @@ static const double cMinDelayBeforeLiveDecodedPrune = 1; // Seconds.
 static const float cTargetPrunePercentage = .95f; // Percentage of capacity toward which we prune, to avoid immediately pruning again.
 static const auto defaultDecodedDataDeletionInterval = std::chrono::seconds { 0 };
 
-MemoryCache* memoryCache()
+MemoryCache& memoryCache()
 {
-    static MemoryCache* staticCache = new MemoryCache;
     ASSERT(WTF::isMainThread());
 
-    return staticCache;
+    static NeverDestroyed<MemoryCache> memoryCache;
+
+    return memoryCache;
 }
 
 MemoryCache::MemoryCache()
@@ -766,8 +767,8 @@ void MemoryCache::removeRequestFromCache(ScriptExecutionContext* context, const
         return;
     }
 
-    if (CachedResource* resource = memoryCache()->resourceForRequest(request, sessionID))
-        memoryCache()->remove(resource);
+    if (CachedResource* resource = memoryCache().resourceForRequest(request, sessionID))
+        memoryCache().remove(resource);
 }
 
 void MemoryCache::removeRequestFromSessionCaches(ScriptExecutionContext* context, const ResourceRequest& request)
@@ -782,9 +783,9 @@ void MemoryCache::removeRequestFromSessionCaches(ScriptExecutionContext* context
         return;
     }
 
-    for (auto& resources : memoryCache()->m_sessionResources) {
-        if (CachedResource* resource = memoryCache()->resourceForRequestImpl(request, *resources.value))
-        memoryCache()->remove(resource);
+    for (auto& resources : memoryCache().m_sessionResources) {
+        if (CachedResource* resource = memoryCache().resourceForRequestImpl(request, *resources.value))
+        memoryCache().remove(resource);
     }
 }
 
index 1bbad1f..a20cc3c 100644 (file)
@@ -28,6 +28,7 @@
 #include "NativeImagePtr.h"
 #include "SecurityOriginHash.h"
 #include "SessionIDHash.h"
+#include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
@@ -64,7 +65,7 @@ struct SecurityOriginHash;
 class MemoryCache {
     WTF_MAKE_NONCOPYABLE(MemoryCache); WTF_MAKE_FAST_ALLOCATED;
 public:
-    friend MemoryCache* memoryCache();
+    friend NeverDestroyed<MemoryCache>;
 
 #if ENABLE(CACHE_PARTITIONING)
     typedef HashMap<String, CachedResource*> CachedResourceItem;
@@ -233,7 +234,7 @@ private:
 };
 
 // Function to obtain the global cache.
-WEBCORE_EXPORT MemoryCache* memoryCache();
+WEBCORE_EXPORT MemoryCache& memoryCache();
 
 }
 
index 212619e..4721f00 100644 (file)
@@ -114,7 +114,7 @@ DiskCacheMonitor::DiskCacheMonitor(const ResourceRequest& request, SessionID ses
 
 void DiskCacheMonitor::resourceBecameFileBacked(SharedBuffer& fileBackedBuffer)
 {
-    CachedResource* resource = memoryCache()->resourceForRequest(m_resourceRequest, m_sessionID);
+    CachedResource* resource = memoryCache().resourceForRequest(m_resourceRequest, m_sessionID);
     if (!resource)
         return;
 
index 8836929..4a6cdb7 100644 (file)
@@ -3736,7 +3736,7 @@ void FrameView::willPaintContents(GraphicsContext* context, const IntRect& dirty
 
         // To avoid unnecessary image decoding, we don't prune recently-decoded live resources here since
         // we might need some live bitmaps on painting.
-        memoryCache()->prune();
+        memoryCache().prune();
     }
 
     if (paintingState.isTopLevelPainter)
@@ -3776,7 +3776,7 @@ void FrameView::didPaintContents(GraphicsContext* context, const IntRect& dirtyR
     // Painting can lead to decoding of large amounts of bitmaps
     // If we are low on memory, wipe them out after the paint.
     if (paintingState.isTopLevelPainter && memoryPressureHandler().isUnderMemoryPressure())
-        memoryCache()->pruneLiveResources(true);
+        memoryCache().pruneLiveResources(true);
 
     // Regions may have changed as a result of the visibility/z-index of element changing.
 #if ENABLE(DASHBOARD_SUPPORT)
index d891f92..12f9113 100644 (file)
@@ -103,7 +103,7 @@ void MemoryPressureHandler::releaseCriticalMemory()
 
     {
         ReliefLogger log("Prune MemoryCache");
-        memoryCache()->pruneToPercentage(0);
+        memoryCache().pruneToPercentage(0);
     }
 
     {
index ba9e10b..57b95e5 100644 (file)
@@ -380,7 +380,7 @@ bool Internals::isLoadingFromMemoryCache(const String& url)
 {
     if (!contextDocument() || !contextDocument()->page())
         return false;
-    CachedResource* resource = memoryCache()->resourceForURL(contextDocument()->completeURL(url), contextDocument()->page()->sessionID());
+    CachedResource* resource = memoryCache().resourceForURL(contextDocument()->completeURL(url), contextDocument()->page()->sessionID());
     return resource && resource->status() == CachedResource::Cached;
 }
 
index 5495590..02a50d9 100644 (file)
@@ -1,3 +1,22 @@
+2014-11-21  Anders Carlsson  <andersca@apple.com>
+
+        Make memoryCache() return a reference
+        https://bugs.webkit.org/show_bug.cgi?id=138939
+
+        Reviewed by Antti Koivisto.
+
+        * Misc/WebCache.mm:
+        (+[WebCache statistics]):
+        (+[WebCache emptyInMemoryResources]):
+        (+[WebCache sizeOfDeadResources:]):
+        (+[WebCache addImageToCache:forURL:forFrame:]):
+        (+[WebCache removeImageFromCacheForURL:forFrame:]):
+        (+[WebCache imageForURL:]):
+        (+[WebCache setDisabled:]):
+        (+[WebCache isDisabled]):
+        * WebView/WebView.mm:
+        (+[WebView _setCacheModel:]):
+
 2014-11-20  Benjamin Poulain  <bpoulain@apple.com>
 
         Remove the remaining vestiges of minimal-ui
index 0221c98..baee3d0 100644 (file)
@@ -65,7 +65,7 @@
 
 + (NSArray *)statistics
 {
-    WebCore::MemoryCache::Statistics s = WebCore::memoryCache()->getStatistics();
+    WebCore::MemoryCache::Statistics s = WebCore::memoryCache().getStatistics();
 
     return [NSArray arrayWithObjects:
         [NSDictionary dictionaryWithObjectsAndKeys:
         [WebView _setCacheModel:WebCacheModelDocumentViewer];
         [WebView _setCacheModel:cacheModel];
 
-        WebCore::memoryCache()->pruneLiveResources(true);
+        WebCore::memoryCache().pruneLiveResources(true);
     });
 }
 
 + (void)sizeOfDeadResources:(int *)resources
 {
-    WebCore::MemoryCache::Statistics stats = WebCore::memoryCache()->getStatistics();
+    WebCore::MemoryCache::Statistics stats = WebCore::memoryCache().getStatistics();
     if (resources) {
         *resources = (stats.images.size - stats.images.liveSize)
                      + (stats.cssStyleSheets.size - stats.cssStyleSheets.liveSize)
     if (frame)
         topOrigin = core(frame)->document()->topOrigin();
 #endif
-    return WebCore::memoryCache()->addImageToCache(image, url, topOrigin ? topOrigin->domainForCachePartition() : emptyString());
+    return WebCore::memoryCache().addImageToCache(image, url, topOrigin ? topOrigin->domainForCachePartition() : emptyString());
 }
 
 + (void)removeImageFromCacheForURL:(NSURL *)url
     if (frame)
         topOrigin = core(frame)->document()->topOrigin();
 #endif
-    WebCore::memoryCache()->removeImageFromCache(url, topOrigin ? topOrigin->domainForCachePartition() : emptyString());
+    WebCore::memoryCache().removeImageFromCache(url, topOrigin ? topOrigin->domainForCachePartition() : emptyString());
 }
 
 + (CGImageRef)imageForURL:(NSURL *)url
     if (!url)
         return nullptr;
     
-    WebCore::CachedResource* cachedResource = WebCore::memoryCache()->resourceForURL(url);
+    WebCore::CachedResource* cachedResource = WebCore::memoryCache().resourceForURL(url);
     if (!is<WebCore::CachedImage>(cachedResource))
         return nullptr;
     WebCore::CachedImage& cachedImage = downcast<WebCore::CachedImage>(*cachedResource);
     if (!pthread_main_np())
         return [[self _webkit_invokeOnMainThread] setDisabled:disabled];
 
-    WebCore::memoryCache()->setDisabled(disabled);
+    WebCore::memoryCache().setDisabled(disabled);
 }
 
 + (BOOL)isDisabled
 {
-    return WebCore::memoryCache()->disabled();
+    return WebCore::memoryCache().disabled();
 }
 
 @end
index a79fb6b..290c111 100644 (file)
@@ -7900,8 +7900,8 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num)
     // Don't shrink a big disk cache, since that would cause churn.
     nsurlCacheDiskCapacity = std::max(nsurlCacheDiskCapacity, [nsurlCache diskCapacity]);
 
-    memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
-    memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
+    memoryCache().setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
+    memoryCache().setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
     pageCache()->setCapacity(pageCacheCapacity);
 #if PLATFORM(IOS)
     pageCache()->setShouldClearBackingStores(true);
index c6435fd..98e002b 100644 (file)
@@ -1,3 +1,18 @@
+2014-11-21  Anders Carlsson  <andersca@apple.com>
+
+        Make memoryCache() return a reference
+        https://bugs.webkit.org/show_bug.cgi?id=138939
+
+        Reviewed by Antti Koivisto.
+
+        * WebCache.cpp:
+        (WebCache::statistics):
+        (WebCache::empty):
+        (WebCache::setDisabled):
+        (WebCache::disabled):
+        * WebView.cpp:
+        (WebView::setCacheModel):
+
 2014-11-16  Zan Dobersek  <zdobersek@igalia.com>
 
         [TexMap] Add typecasting support for GraphicsLayerTextureMapper
index 27f8722..0661a79 100644 (file)
@@ -100,7 +100,7 @@ HRESULT WebCache::statistics(int* count, IPropertyBag** s)
     if (!s)
         return S_OK;
 
-    WebCore::MemoryCache::Statistics stat = WebCore::memoryCache()->getStatistics();
+    WebCore::MemoryCache::Statistics stat = WebCore::memoryCache().getStatistics();
 
     static CFStringRef imagesKey = CFSTR("images");
     static CFStringRef stylesheetsKey = CFSTR("style sheets");
@@ -207,10 +207,10 @@ HRESULT WebCache::statistics(int* count, IPropertyBag** s)
 
 HRESULT STDMETHODCALLTYPE WebCache::empty( void)
 {
-    if (WebCore::memoryCache()->disabled())
+    if (WebCore::memoryCache().disabled())
         return S_OK;
-    WebCore::memoryCache()->setDisabled(true);
-    WebCore::memoryCache()->setDisabled(false);
+    WebCore::memoryCache().setDisabled(true);
+    WebCore::memoryCache().setDisabled(false);
 
     // Empty the application cache.
     WebCore::cacheStorage().empty();
@@ -224,7 +224,7 @@ HRESULT STDMETHODCALLTYPE WebCache::empty( void)
 HRESULT STDMETHODCALLTYPE WebCache::setDisabled( 
     /* [in] */ BOOL disabled)
 {
-    WebCore::memoryCache()->setDisabled(!!disabled);
+    WebCore::memoryCache().setDisabled(!!disabled);
     return S_OK;
 }
 
@@ -233,7 +233,7 @@ HRESULT STDMETHODCALLTYPE WebCache::disabled(
 {
     if (!disabled)
         return E_POINTER;
-    *disabled = WebCore::memoryCache()->disabled();
+    *disabled = WebCore::memoryCache().disabled();
     return S_OK;
 }
 
index 904f39a..75f9ed2 100644 (file)
@@ -671,8 +671,8 @@ void WebView::setCacheModel(WebCacheModel cacheModel)
         ASSERT_NOT_REACHED();
     }
 
-    memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
-    memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
+    memoryCache().setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
+    memoryCache().setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
     pageCache()->setCapacity(pageCacheCapacity);
 
 #if USE(CFNETWORK)
index 7c6bd12..8591ad5 100644 (file)
@@ -1,3 +1,26 @@
+2014-11-21  Anders Carlsson  <andersca@apple.com>
+
+        Make memoryCache() return a reference
+        https://bugs.webkit.org/show_bug.cgi?id=138939
+
+        Reviewed by Antti Koivisto.
+
+        * WebProcess/Network/NetworkProcessConnection.cpp:
+        (WebKit::NetworkProcessConnection::didCacheResource):
+        * WebProcess/ResourceCache/WebResourceCacheManager.cpp:
+        (WebKit::WebResourceCacheManager::getCacheOrigins):
+        (WebKit::WebResourceCacheManager::clearCacheForOrigin):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::terminate):
+        (WebKit::WebProcess::didClose):
+        (WebKit::WebProcess::clearResourceCaches):
+        (WebKit::getWebCoreMemoryCacheStatistics):
+        (WebKit::WebProcess::setMemoryCacheDisabled):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformSetCacheModel):
+        * WebProcess/soup/WebProcessSoup.cpp:
+        (WebKit::WebProcess::platformSetCacheModel):
+
 2014-11-21  Daniel Bates  <dabates@apple.com>
 
         [iOS] WebKit2 fails to build with public SDK due to missing SPI from CFNetwork, QuartzCore, MediaPlayer, XPC
index 671a17e..3904b10 100644 (file)
@@ -83,7 +83,7 @@ void NetworkProcessConnection::didReceiveInvalidMessage(IPC::Connection*, IPC::S
 #if ENABLE(SHAREABLE_RESOURCE)
 void NetworkProcessConnection::didCacheResource(const ResourceRequest& request, const ShareableResource::Handle& handle, SessionID sessionID)
 {
-    CachedResource* resource = memoryCache()->resourceForRequest(request, sessionID);
+    CachedResource* resource = memoryCache().resourceForRequest(request, sessionID);
     if (!resource)
         return;
     
index 4187bf5..24fef19 100644 (file)
@@ -57,7 +57,7 @@ void WebResourceCacheManager::getCacheOrigins(uint64_t callbackID) const
 #else
     MemoryCache::SecurityOriginSet origins;
 #endif
-    memoryCache()->getOriginsWithCache(origins);
+    memoryCache().getOriginsWithCache(origins);
 
 #if USE(CFURLCACHE)
 #if ENABLE(CACHE_PARTITIONING)
@@ -114,7 +114,7 @@ void WebResourceCacheManager::clearCacheForOrigin(const SecurityOriginData& orig
     if (!origin)
         return;
 
-    memoryCache()->removeResourcesWithOrigin(origin.get());
+    memoryCache().removeResourcesWithOrigin(origin.get());
 
 #if USE(CFURLCACHE)
     if (resourceCachesToClear != InMemoryResourceCachesOnly) { 
index ce196d5..20e6393 100644 (file)
@@ -585,7 +585,7 @@ void WebProcess::terminate()
 #ifndef NDEBUG
     gcController().garbageCollectNow();
     fontCache().invalidate();
-    memoryCache()->setDisabled(true);
+    memoryCache().setDisabled(true);
 #endif
 
     m_webConnection->invalidate();
@@ -638,7 +638,7 @@ void WebProcess::didClose(IPC::Connection*)
 
     gcController().garbageCollectSoon();
     fontCache().invalidate();
-    memoryCache()->setDisabled(true);
+    memoryCache().setDisabled(true);
 #endif    
 
     // The UI process closed this connection, shut down.
@@ -710,7 +710,7 @@ void WebProcess::clearResourceCaches(ResourceCachesToClear resourceCachesToClear
     setCacheModel(CacheModelDocumentViewer);
     setCacheModel(cacheModel);
 
-    memoryCache()->evictResources();
+    memoryCache().evictResources();
 
     // Empty the cross-origin preflight cache.
     CrossOriginPreflightResultCache::shared().empty();
@@ -866,7 +866,7 @@ static void getWebCoreMemoryCacheStatistics(Vector<HashMap<String, uint64_t>>& r
     String xslString(ASCIILiteral("XSL"));
     String javaScriptString(ASCIILiteral("JavaScript"));
     
-    MemoryCache::Statistics memoryCacheStatistics = memoryCache()->getStatistics();
+    MemoryCache::Statistics memoryCacheStatistics = memoryCache().getStatistics();
     
     HashMap<String, uint64_t> counts;
     counts.set(imagesString, memoryCacheStatistics.images.count);
@@ -1248,8 +1248,8 @@ RefPtr<API::Object> WebProcess::apiObjectByConvertingFromHandles(API::Object* ob
 
 void WebProcess::setMemoryCacheDisabled(bool disabled)
 {
-    if (memoryCache()->disabled() != disabled)
-        memoryCache()->setDisabled(disabled);
+    if (memoryCache().disabled() != disabled)
+        memoryCache().setDisabled(disabled);
 }
 
 #if ENABLE(SERVICE_CONTROLS)
index 8e21f7b..2bb68f5 100644 (file)
@@ -109,8 +109,8 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel)
         pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity);
 
 
-    memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
-    memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
+    memoryCache().setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
+    memoryCache().setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
     pageCache()->setCapacity(pageCacheCapacity);
 
     NSURLCache *nsurlCache = [NSURLCache sharedURLCache];
index e8701a2..7d79f5e 100644 (file)
@@ -101,9 +101,9 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel)
                         cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval,
                         pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity);
 
-    WebCore::memoryCache()->setDisabled(cacheModel == CacheModelDocumentViewer);
-    WebCore::memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
-    WebCore::memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
+    WebCore::memoryCache().setDisabled(cacheModel == CacheModelDocumentViewer);
+    WebCore::memoryCache().setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
+    WebCore::memoryCache().setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
     WebCore::pageCache()->setCapacity(pageCacheCapacity);
 
 #if PLATFORM(GTK)