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

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

Issue 217643003: Revert of MemoryCache: make sure that Resources are evicted only when they can be deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/MemoryCache.cpp ('k') | Source/core/fetch/Resource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/MemoryCacheTest.cpp
diff --git a/Source/core/fetch/MemoryCacheTest.cpp b/Source/core/fetch/MemoryCacheTest.cpp
index 3b78bc6163cb9bf1d58990a30185cd7b956889c6..5a10bb68a41a0c35991525e6b1c7485ef00e3193 100644
--- a/Source/core/fetch/MemoryCacheTest.cpp
+++ b/Source/core/fetch/MemoryCacheTest.cpp
@@ -153,7 +153,7 @@
const unsigned maxDeadCapacity = 0;
memoryCache()->setCapacities(minDeadCapacity, maxDeadCapacity, totalCapacity);
- Resource* cachedResource =
+ ResourcePtr<Resource> cachedResource =
new Resource(ResourceRequest(""), Resource::Raw);
const char data[5] = "abcd";
cachedResource->appendData(data, 3);
@@ -164,7 +164,7 @@
ASSERT_EQ(0u, memoryCache()->deadSize());
ASSERT_EQ(0u, memoryCache()->liveSize());
- memoryCache()->add(cachedResource);
+ memoryCache()->add(cachedResource.get());
ASSERT_EQ(cachedResource->size(), memoryCache()->deadSize());
ASSERT_EQ(0u, memoryCache()->liveSize());
@@ -183,8 +183,8 @@
const unsigned maxDeadCapacity = 0;
memoryCache()->setCapacities(minDeadCapacity, maxDeadCapacity, totalCapacity);
const char data[6] = "abcde";
- Resource* cachedDeadResource =
- new Resource(ResourceRequest("hhtp://foo"), Resource::Raw);
+ ResourcePtr<Resource> cachedDeadResource =
+ new Resource(ResourceRequest("http://foo"), Resource::Raw);
cachedDeadResource->appendData(data, 3);
ResourcePtr<Resource> cachedLiveResource =
new FakeDecodedResource(ResourceRequest(""), Resource::Raw);
@@ -194,7 +194,7 @@
class Task1 : public blink::WebThread::Task {
public:
- Task1(const ResourcePtr<Resource>& live, Resource* dead)
+ Task1(const ResourcePtr<Resource>& live, const ResourcePtr<Resource>& dead)
: m_live(live)
, m_dead(dead)
{ }
@@ -209,7 +209,7 @@
ASSERT_EQ(0u, memoryCache()->deadSize());
ASSERT_EQ(0u, memoryCache()->liveSize());
- memoryCache()->add(m_dead);
+ memoryCache()->add(m_dead.get());
memoryCache()->add(m_live.get());
memoryCache()->insertInLiveDecodedResourcesList(m_live.get());
ASSERT_EQ(m_dead->size(), memoryCache()->deadSize());
@@ -223,8 +223,7 @@
}
private:
- ResourcePtr<Resource> m_live;
- Resource* m_dead;
+ ResourcePtr<Resource> m_live, m_dead;
};
class Task2 : public blink::WebThread::Task {
« no previous file with comments | « Source/core/fetch/MemoryCache.cpp ('k') | Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698