| Index: Source/core/loader/cache/MemoryCache.cpp
|
| diff --git a/Source/core/loader/cache/MemoryCache.cpp b/Source/core/loader/cache/MemoryCache.cpp
|
| index b4cc5948451cba08054fea3124db17bfb6deeaca..eb7d0390d6dadc295be4cfb38294eba3b0aa2a86 100644
|
| --- a/Source/core/loader/cache/MemoryCache.cpp
|
| +++ b/Source/core/loader/cache/MemoryCache.cpp
|
| @@ -86,7 +86,7 @@ KURL MemoryCache::removeFragmentIdentifierIfNeeded(const KURL& originalURL)
|
| if (!originalURL.hasFragmentIdentifier())
|
| return originalURL;
|
| // Strip away fragment identifier from HTTP URLs.
|
| - // Data URLs must be unmodified. For file and custom URLs clients may expect resources
|
| + // Data URLs must be unmodified. For file and custom URLs clients may expect resources
|
| // to be unique even when they differ by the fragment identifier only.
|
| if (!originalURL.protocolIsInHTTPFamily())
|
| return originalURL;
|
| @@ -101,7 +101,7 @@ void MemoryCache::add(CachedResource* resource)
|
| m_resources.set(resource->url(), resource);
|
| resource->setInCache(true);
|
| resource->updateForAccess();
|
| -
|
| +
|
| LOG(ResourceLoading, "MemoryCache::add Added '%s', resource %p\n", resource->url().string().latin1().data(), resource);
|
| }
|
|
|
| @@ -132,7 +132,7 @@ CachedResource* MemoryCache::resourceForURL(const KURL& resourceURL)
|
| return resource;
|
| }
|
|
|
| -unsigned MemoryCache::deadCapacity() const
|
| +unsigned MemoryCache::deadCapacity() const
|
| {
|
| // Dead resource capacity is whatever space is not occupied by live resources, bounded by an independent minimum and maximum.
|
| unsigned capacity = m_capacity - min(m_liveSize, m_capacity); // Start with available capacity.
|
| @@ -141,8 +141,8 @@ unsigned MemoryCache::deadCapacity() const
|
| return capacity;
|
| }
|
|
|
| -unsigned MemoryCache::liveCapacity() const
|
| -{
|
| +unsigned MemoryCache::liveCapacity() const
|
| +{
|
| // Live resource capacity is whatever is left over after calculating dead resource capacity.
|
| return m_capacity - deadCapacity();
|
| }
|
| @@ -158,7 +158,7 @@ void MemoryCache::pruneLiveResources()
|
| double currentTime = FrameView::currentPaintTimeStamp();
|
| if (!currentTime) // In case prune is called directly, outside of a Frame paint.
|
| currentTime = WTF::currentTime();
|
| -
|
| +
|
| // Destroy any decoded data in live objects that we can.
|
| // Start from the tail, since this is the least recently accessed of the objects.
|
|
|
| @@ -177,8 +177,8 @@ void MemoryCache::pruneLiveResources()
|
| if (elapsedTime < cMinDelayBeforeLiveDecodedPrune)
|
| return;
|
|
|
| - // Destroy our decoded data. This will remove us from
|
| - // m_liveDecodedResources, and possibly move us to a different LRU
|
| + // Destroy our decoded data. This will remove us from
|
| + // m_liveDecodedResources, and possibly move us to a different LRU
|
| // list in m_allResources.
|
| current->destroyDecodedData();
|
|
|
| @@ -198,7 +198,7 @@ void MemoryCache::pruneDeadResources()
|
| unsigned targetSize = static_cast<unsigned>(capacity * cTargetPrunePercentage); // Cut by a percentage to avoid immediately pruning again.
|
|
|
| int size = m_allResources.size();
|
| -
|
| +
|
| // See if we have any purged resources we can evict.
|
| for (int i = 0; i < size; i++) {
|
| CachedResource* current = m_allResources[i].m_tail;
|
| @@ -219,15 +219,15 @@ void MemoryCache::pruneDeadResources()
|
| for (int i = size - 1; i >= 0; i--) {
|
| // Remove from the tail, since this is the least frequently accessed of the objects.
|
| CachedResource* current = m_allResources[i].m_tail;
|
| -
|
| +
|
| // First flush all the decoded data in this queue.
|
| while (current) {
|
| // Protect 'previous' so it can't get deleted during destroyDecodedData().
|
| CachedResourceHandle<CachedResource> previous = current->m_prevInAllResourcesList;
|
| ASSERT(!previous || previous->inCache());
|
| if (!current->hasClients() && !current->isPreloaded() && current->isLoaded()) {
|
| - // Destroy our decoded data. This will remove us from
|
| - // m_liveDecodedResources, and possibly move us to a different
|
| + // Destroy our decoded data. This will remove us from
|
| + // m_liveDecodedResources, and possibly move us to a different
|
| // LRU list in m_allResources.
|
| current->destroyDecodedData();
|
|
|
| @@ -255,7 +255,7 @@ void MemoryCache::pruneDeadResources()
|
| break;
|
| current = previous.get();
|
| }
|
| -
|
| +
|
| // Shrink the vector back down so we don't waste time inspecting
|
| // empty LRU lists on future prunes.
|
| if (m_allResources[i].m_head)
|
| @@ -337,13 +337,13 @@ void MemoryCache::removeFromLRUList(CachedResource* resource)
|
|
|
| CachedResource* next = resource->m_nextInAllResourcesList;
|
| CachedResource* prev = resource->m_prevInAllResourcesList;
|
| -
|
| +
|
| if (next == 0 && prev == 0 && list->m_head != resource)
|
| return;
|
| -
|
| +
|
| resource->m_nextInAllResourcesList = 0;
|
| resource->m_prevInAllResourcesList = 0;
|
| -
|
| +
|
| if (next)
|
| next->m_prevInAllResourcesList = prev;
|
| else if (list->m_tail == resource)
|
| @@ -361,17 +361,17 @@ void MemoryCache::insertInLRUList(CachedResource* resource)
|
| ASSERT(!resource->m_nextInAllResourcesList && !resource->m_prevInAllResourcesList);
|
| ASSERT(resource->inCache());
|
| ASSERT(resource->accessCount() > 0);
|
| -
|
| +
|
| LRUList* list = lruListFor(resource);
|
|
|
| resource->m_nextInAllResourcesList = list->m_head;
|
| if (list->m_head)
|
| list->m_head->m_prevInAllResourcesList = resource;
|
| list->m_head = resource;
|
| -
|
| +
|
| if (!resource->m_nextInAllResourcesList)
|
| list->m_tail = resource;
|
| -
|
| +
|
| #if !ASSERT_DISABLED
|
| // Verify that we are in now in the list like we should be.
|
| list = lruListFor(resource);
|
| @@ -408,13 +408,13 @@ void MemoryCache::removeFromLiveDecodedResourcesList(CachedResource* resource)
|
|
|
| CachedResource* next = resource->m_nextInLiveResourcesList;
|
| CachedResource* prev = resource->m_prevInLiveResourcesList;
|
| -
|
| +
|
| if (next == 0 && prev == 0 && m_liveDecodedResources.m_head != resource)
|
| return;
|
| -
|
| +
|
| resource->m_nextInLiveResourcesList = 0;
|
| resource->m_prevInLiveResourcesList = 0;
|
| -
|
| +
|
| if (next)
|
| next->m_prevInLiveResourcesList = prev;
|
| else if (m_liveDecodedResources.m_tail == resource)
|
| @@ -436,10 +436,10 @@ void MemoryCache::insertInLiveDecodedResourcesList(CachedResource* resource)
|
| if (m_liveDecodedResources.m_head)
|
| m_liveDecodedResources.m_head->m_prevInLiveResourcesList = resource;
|
| m_liveDecodedResources.m_head = resource;
|
| -
|
| +
|
| if (!resource->m_nextInLiveResourcesList)
|
| m_liveDecodedResources.m_tail = resource;
|
| -
|
| +
|
| #if !ASSERT_DISABLED
|
| // Verify that we are in now in the list like we should be.
|
| bool found = false;
|
| @@ -496,7 +496,7 @@ void MemoryCache::removeURLFromCacheInternal(ScriptExecutionContext*, const KURL
|
| void MemoryCache::TypeStatistic::addResource(CachedResource* o)
|
| {
|
| bool purged = o->wasPurged();
|
| - bool purgeable = o->isPurgeable() && !purged;
|
| + bool purgeable = o->isPurgeable() && !purged;
|
| int pageSize = (o->encodedSize() + o->overheadSize() + 4095) & ~4095;
|
| count++;
|
| size += purged ? 0 : o->size();
|
|
|