diff options
author | vasilii <vasilii@chromium.org> | 2014-09-19 01:20:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-19 08:20:35 +0000 |
commit | a3b755859b3113c74df16939f124bc42464092b1 (patch) | |
tree | 0481b01eb76cb0f128a35a376a418ec7223aa36e /net/tools | |
parent | 48c3e5ebfd2640061ed488216f1d275d17c887bd (diff) | |
download | chromium_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/tools')
-rw-r--r-- | net/tools/dump_cache/simple_cache_dumper.cc | 9 | ||||
-rw-r--r-- | net/tools/dump_cache/simple_cache_dumper.h | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/net/tools/dump_cache/simple_cache_dumper.cc b/net/tools/dump_cache/simple_cache_dumper.cc index dd5ecbf..56162ca 100644 --- a/net/tools/dump_cache/simple_cache_dumper.cc +++ b/net/tools/dump_cache/simple_cache_dumper.cc @@ -26,6 +26,7 @@ SimpleCacheDumper::SimpleCacheDumper(base::FilePath input_path, output_path_(output_path), writer_(new DiskDumper(output_path)), cache_thread_(new base::Thread("CacheThead")), + iter_(NULL), src_entry_(NULL), dst_entry_(NULL), io_callback_(base::Bind(&SimpleCacheDumper::OnIOComplete, @@ -149,15 +150,15 @@ int SimpleCacheDumper::DoOpenEntry() { DCHECK(!dst_entry_); DCHECK(!src_entry_); state_ = STATE_OPEN_ENTRY_COMPLETE; - if (!iter_) - iter_ = cache_->CreateIterator(); - return iter_->OpenNextEntry(&src_entry_, io_callback_); + return cache_->OpenNextEntry(&iter_, &src_entry_, io_callback_); } int SimpleCacheDumper::DoOpenEntryComplete(int rv) { // ERR_FAILED indicates iteration finished. - if (rv == ERR_FAILED) + if (rv == ERR_FAILED) { + cache_->EndEnumeration(&iter_); return OK; + } if (rv < 0) return rv; diff --git a/net/tools/dump_cache/simple_cache_dumper.h b/net/tools/dump_cache/simple_cache_dumper.h index cc865a3..c95e6a9 100644 --- a/net/tools/dump_cache/simple_cache_dumper.h +++ b/net/tools/dump_cache/simple_cache_dumper.h @@ -9,10 +9,14 @@ #include "base/memory/scoped_ptr.h" #include "base/threading/thread.h" #include "net/base/completion_callback.h" -#include "net/disk_cache/disk_cache.h" class DiskDumper; +namespace disk_cache { +class Backend; +class Entry; +} // namespace disk_cache + namespace net { class IOBufferWithSize; @@ -75,7 +79,7 @@ class SimpleCacheDumper { scoped_ptr<disk_cache::Backend> cache_; scoped_ptr<DiskDumper> writer_; base::Thread* cache_thread_; - scoped_ptr<disk_cache::Backend::Iterator> iter_; + void* iter_; disk_cache::Entry* src_entry_; disk_cache::Entry* dst_entry_; CompletionCallback io_callback_; |