summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/entry_unittest.cc
diff options
context:
space:
mode:
authorvasilii <vasilii@chromium.org>2014-09-19 01:20:17 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-19 08:20:35 +0000
commita3b755859b3113c74df16939f124bc42464092b1 (patch)
tree0481b01eb76cb0f128a35a376a418ec7223aa36e /net/disk_cache/entry_unittest.cc
parent48c3e5ebfd2640061ed488216f1d275d17c887bd (diff)
downloadchromium_src-a3b755859b3113c74df16939f124bc42464092b1.zip
chromium_src-a3b755859b3113c74df16939f124bc42464092b1.tar.gz
chromium_src-a3b755859b3113c74df16939f124bc42464092b1.tar.bz2
Revert of Remove void** from disk_cache interface. (patchset #30 id:650001 of https://codereview.chromium.org/542733002/)
Reason for revert: Introduced memory leaks on linux asan http://build.chromium.org/p/chromium.memory/builders/Linux%20ASan%20LSan%20Tests%20%281%29/builds/5892: Direct leak of 80 byte(s) in 2 object(s) allocated from: #0 0x501ccb in operator new(unsigned long) (/b/build/slave/Linux_ASan_LSan_Tests__1_/build/src/out/Release/net_unittests+0x501ccb) #1 0x309f8d7 in disk_cache::BackendImpl::OpenNextEntryImpl(void**) net/disk_cache/blockfile/backend_impl.cc:620:5 #2 0x30a02cd in disk_cache::BackendImpl::SyncOpenNextEntry(void**, disk_cache::Entry**) net/disk_cache/blockfile/backend_impl.cc:436:17 #3 0x30d49dd in disk_cache::BackendIO::ExecuteBackendOperation() net/disk_cache/blockfile/in_flight_backend_io.cc:248:17 #4 0x2e3b0bf in Run base/callback.h:401:12 #5 0x2e3b0bf in base::debug::TaskAnnotator::RunTask(char const*, char const*, base::PendingTask const&) base/debug/task_annotator.cc:62 #6 0x2dc22fc in base::MessageLoop::RunTask(base::PendingTask const&) base/message_loop/message_loop.cc:446:3 #7 0x2dc33cc in DeferOrRunPendingTask base/message_loop/message_loop.cc:456:5 #8 0x2dc33cc in base::MessageLoop::DoWork() base/message_loop/message_loop.cc:565 #9 0x2e2361f in base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_libevent.cc:232:21 #10 0x2ddd94b in base::RunLoop::Run() base/run_loop.cc:54:3 #11 0x2dc0bc4 in base::MessageLoop::Run() base/message_loop/message_loop.cc:308:3 #12 0x2e0ad90 in base::Thread::ThreadMain() base/threading/thread.cc:228:5 #13 0x2dfeaf0 in base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:80:3 #14 0x7fa9f4e0ce99 in start_thread /build/buildd/eglibc-2.15/nptl/pthread_create.c:308 Indirect leak of 64 byte(s) in 2 object(s) allocated from: #0 0x501ccb in operator new(unsigned long) (/b/build/slave/Linux_ASan_LSan_Tests__1_/build/src/out/Release/net_unittests+0x501ccb) #1 0x30ebaaf in disk_cache::Rankings::GetNext(disk_cache::StorageBlock<disk_cache::RankingsNode>*, disk_cache::Rankings::List) net/disk_cache/blockfile/rankings.cc:435:5 #2 0x30a219d in disk_cache::BackendImpl::OpenFollowingEntryFromList(disk_cache::Rankings::List, disk_cache::StorageBlock<disk_cache::RankingsNode>**, disk_cache::EntryImpl**) net/disk_cache/blockfile/backend_impl.cc:1694:36 #3 0x309fa3d in disk_cache::BackendImpl::OpenNextEntryImpl(void**) net/disk_cache/blockfile/backend_impl.cc:638:11 #4 0x30a02cd in disk_cache::BackendImpl::SyncOpenNextEntry(void**, disk_cache::Entry**) net/disk_cache/blockfile/backend_impl.cc:436:17 #5 0x30d49dd in disk_cache::BackendIO::ExecuteBackendOperation() net/disk_cache/blockfile/in_flight_backend_io.cc:248:17 #6 0x2e3b0bf in Run base/callback.h:401:12 #7 0x2e3b0bf in base::debug::TaskAnnotator::RunTask(char const*, char const*, base::PendingTask const&) base/debug/task_annotator.cc:62 #8 0x2dc22fc in base::MessageLoop::RunTask(base::PendingTask const&) base/message_loop/message_loop.cc:446:3 #9 0x2dc33cc in DeferOrRunPendingTask base/message_loop/message_loop.cc:456:5 #10 0x2dc33cc in base::MessageLoop::DoWork() base/message_loop/message_loop.cc:565 #11 0x2e2361f in base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_libevent.cc:232:21 #12 0x2ddd94b in base::RunLoop::Run() base/run_loop.cc:54:3 #13 0x2dc0bc4 in base::MessageLoop::Run() base/message_loop/message_loop.cc:308:3 #14 0x2e0ad90 in base::Thread::ThreadMain() base/threading/thread.cc:228:5 #15 0x2dfeaf0 in base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:80:3 #16 0x7fa9f4e0ce99 in start_thread /build/buildd/eglibc-2.15/nptl/pthread_create.c:308 Indirect leak of 36 byte(s) in 1 object(s) allocated from: #0 0x501ccb in operator new(unsigned long) (/b/build/slave/Linux_ASan_LSan_Tests__1_/build/src/out/Release/net_unittests+0x501ccb) #1 0x30c0696 in AllocateData net/disk_cache/blockfile/storage_block-inl.h:179:5 #2 0x30c0696 in disk_cache::StorageBlock<disk_cache::RankingsNode>::Load() net/disk_cache/blockfile/storage_block-inl.h:121 #3 0x30e6fe9 in disk_cache::Rankings::GetRanking(disk_cache::StorageBlock<disk_cache::RankingsNode>*) net/disk_cache/blockfile/rankings.cc:586:8 #4 0x30ebd5a in disk_cache::Rankings::GetNext(disk_cache::StorageBlock<disk_cache::RankingsNode>*, disk_cache::Rankings::List) net/disk_cache/blockfile/rankings.cc:440:8 #5 0x30a219d in disk_cache::BackendImpl::OpenFollowingEntryFromList(disk_cache::Rankings::List, disk_cache::StorageBlock<disk_cache::RankingsNode>**, disk_cache::EntryImpl**) net/disk_cache/blockfile/backend_impl.cc:1694:36 #6 0x309fa3d in disk_cache::BackendImpl::OpenNextEntryImpl(void**) net/disk_cache/blockfile/backend_impl.cc:638:11 #7 0x30a02cd in disk_cache::BackendImpl::SyncOpenNextEntry(void**, disk_cache::Entry**) net/disk_cache/blockfile/backend_impl.cc:436:17 #8 0x30d49dd in disk_cache::BackendIO::ExecuteBackendOperation() net/disk_cache/blockfile/in_flight_backend_io.cc:248:17 #9 0x2e3b0bf in Run base/callback.h:401:12 #10 0x2e3b0bf in base::debug::TaskAnnotator::RunTask(char const*, char const*, base::PendingTask const&) base/debug/task_annotator.cc:62 #11 0x2dc22fc in base::MessageLoop::RunTask(base::PendingTask const&) base/message_loop/message_loop.cc:446:3 #12 0x2dc33cc in DeferOrRunPendingTask base/message_loop/message_loop.cc:456:5 #13 0x2dc33cc in base::MessageLoop::DoWork() base/message_loop/message_loop.cc:565 #14 0x2e2361f in base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_libevent.cc:232:21 #15 0x2ddd94b in base::RunLoop::Run() base/run_loop.cc:54:3 #16 0x2dc0bc4 in base::MessageLoop::Run() base/message_loop/message_loop.cc:308:3 #17 0x2e0ad90 in base::Thread::ThreadMain() base/threading/thread.cc:228:5 #18 0x2dfeaf0 in base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:80:3 #19 0x7fa9f4e0ce99 in start_thread /build/buildd/eglibc-2.15/nptl/pthread_create.c:308 Original issue's description: > Remove void** from disk_cache interface. > > Enumeration and iteration were passing around void**. With this CL, we > instead use an Iterator object. > > R=clamy@chromium.org,jkarlin@chromium.org,jsbell@chromium.org > BUG=413644 > > Committed: https://crrev.com/732c8306d4864296511e7a3a252724b1bb34c342 > Cr-Commit-Position: refs/heads/master@{#295659} TBR=clamy@chromium.org,jkarlin@chromium.org,jsbell@chromium.org,rvargas@chromium.org,pasko@chromium.org,piman@chromium.org,michaeln@chromium.org,cbentzel@chromium.org,gavinp@chromium.org NOTREECHECKS=true NOTRY=true BUG=413644 Review URL: https://codereview.chromium.org/585833002 Cr-Commit-Position: refs/heads/master@{#295677}
Diffstat (limited to 'net/disk_cache/entry_unittest.cc')
-rw-r--r--net/disk_cache/entry_unittest.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index afe93ac..803f98f 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -1617,10 +1617,10 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyEnumerationWithSparseEntries) {
parent_entry->Close();
// Perform the enumerations.
- scoped_ptr<TestIterator> iter = CreateIterator();
+ void* iter = NULL;
disk_cache::Entry* entry = NULL;
int count = 0;
- while (iter->OpenNextEntry(&entry) == net::OK) {
+ while (OpenNextEntry(&iter, &entry) == net::OK) {
ASSERT_TRUE(entry != NULL);
++count;
disk_cache::MemEntryImpl* mem_entry =
@@ -2217,10 +2217,10 @@ TEST_F(DiskCacheEntryTest, CleanupSparseEntry) {
entry->Close();
EXPECT_EQ(4, cache_->GetEntryCount());
- scoped_ptr<TestIterator> iter = CreateIterator();
+ void* iter = NULL;
int count = 0;
std::string child_key[2];
- while (iter->OpenNextEntry(&entry) == net::OK) {
+ while (OpenNextEntry(&iter, &entry) == net::OK) {
ASSERT_TRUE(entry != NULL);
// Writing to an entry will alter the LRU list and invalidate the iterator.
if (entry->GetKey() != key && count < 2)