Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Unified Diff: Source/core/fetch/Resource.cpp

Issue 174523002: Reland "Move MemoryCache implementation details out of Resource" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/Resource.h ('k') | Source/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/Resource.cpp
diff --git a/Source/core/fetch/Resource.cpp b/Source/core/fetch/Resource.cpp
index e5219533d112d468fbb1386866646b68a70e6b88..3f9fe6402f1a2fd61429a38a6d8350eccad88f40 100644
--- a/Source/core/fetch/Resource.cpp
+++ b/Source/core/fetch/Resource.cpp
@@ -108,7 +108,6 @@ Resource::Resource(const ResourceRequest& request, Type type)
, m_protectorCount(0)
, m_preloadResult(PreloadNotReferenced)
, m_cacheLiveResourcePriority(CacheLiveResourcePriorityLow)
- , m_inLiveDecodedResourcesList(false)
, m_requestedFromNetworkingLayer(false)
, m_inCache(false)
, m_loading(false)
@@ -119,12 +118,7 @@ Resource::Resource(const ResourceRequest& request, Type type)
, m_needsSynchronousCacheHit(false)
#ifndef NDEBUG
, m_deleted(false)
- , m_lruIndex(0)
#endif
- , m_nextInAllResourcesList(0)
- , m_prevInAllResourcesList(0)
- , m_nextInLiveResourcesList(0)
- , m_prevInLiveResourcesList(0)
, m_resourceToRevalidate(0)
, m_proxyResource(0)
{
@@ -146,7 +140,7 @@ Resource::~Resource()
{
ASSERT(!m_resourceToRevalidate); // Should be true because canDelete() checks this.
ASSERT(canDelete());
- ASSERT(!inCache());
+ RELEASE_ASSERT(!inCache());
ASSERT(!m_deleted);
ASSERT(url().isNull() || memoryCache()->resourceForURL(KURL(ParsedURLString, url())) != this);
@@ -412,7 +406,7 @@ CachedMetadata* Resource::cachedMetadata(unsigned dataTypeID) const
void Resource::setCacheLiveResourcePriority(CacheLiveResourcePriority priority)
{
- if (inCache() && m_inLiveDecodedResourcesList && cacheLiveResourcePriority() != static_cast<unsigned>(priority)) {
+ if (inCache() && memoryCache()->isInLiveDecodedResourcesList(this) && cacheLiveResourcePriority() != static_cast<unsigned>(priority)) {
memoryCache()->removeFromLiveDecodedResourcesList(this);
m_cacheLiveResourcePriority = priority;
memoryCache()->insertInLiveDecodedResourcesList(this);
@@ -575,9 +569,9 @@ void Resource::setDecodedSize(size_t size)
// violation of the invariant that the list is to be kept sorted
// 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())
+ if (m_decodedSize && !memoryCache()->isInLiveDecodedResourcesList(this) && hasClients())
memoryCache()->insertInLiveDecodedResourcesList(this);
- else if (!m_decodedSize && m_inLiveDecodedResourcesList)
+ else if (!m_decodedSize && memoryCache()->isInLiveDecodedResourcesList(this))
memoryCache()->removeFromLiveDecodedResourcesList(this);
// Update the cache's size totals.
@@ -613,7 +607,7 @@ void Resource::didAccessDecodedData(double timeStamp)
{
m_lastDecodedAccessTime = timeStamp;
if (inCache()) {
- if (m_inLiveDecodedResourcesList) {
+ if (memoryCache()->isInLiveDecodedResourcesList(this)) {
memoryCache()->removeFromLiveDecodedResourcesList(this);
memoryCache()->insertInLiveDecodedResourcesList(this);
}
« no previous file with comments | « Source/core/fetch/Resource.h ('k') | Source/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698