summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/threading/sequenced_worker_pool.cc9
-rw-r--r--tools/valgrind/drmemory/suppressions_full.txt5
-rw-r--r--tools/valgrind/memcheck/suppressions.txt9
-rw-r--r--tools/valgrind/memcheck/suppressions_mac.txt27
4 files changed, 6 insertions, 44 deletions
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc
index 48bb2eb..85bdbea 100644
--- a/base/threading/sequenced_worker_pool.cc
+++ b/base/threading/sequenced_worker_pool.cc
@@ -45,9 +45,8 @@ struct SequencedTask {
class SequencedWorkerPool::Worker : public SimpleThread {
public:
- // Hold a ref to |worker_pool|, since we want to keep it around even
- // if it doesn't join our thread. Note that this (deliberately)
- // leaks on shutdown.
+ // Hold a (cyclic) ref to |worker_pool|, since we want to keep it
+ // around as long as we are running.
Worker(const scoped_refptr<SequencedWorkerPool>& worker_pool,
int thread_number,
const std::string& thread_name_prefix);
@@ -57,7 +56,7 @@ class SequencedWorkerPool::Worker : public SimpleThread {
virtual void Run() OVERRIDE;
private:
- const scoped_refptr<SequencedWorkerPool> worker_pool_;
+ scoped_refptr<SequencedWorkerPool> worker_pool_;
DISALLOW_COPY_AND_ASSIGN(Worker);
};
@@ -226,6 +225,8 @@ void SequencedWorkerPool::Worker::Run() {
// having these worker objects at all, but that method lacks the ability to
// send thread-specific information easily to the thread loop.
worker_pool_->inner_->ThreadLoop(this);
+ // Release our cyclic reference once we're done.
+ worker_pool_ = NULL;
}
// Inner definitions ---------------------------------------------------------
diff --git a/tools/valgrind/drmemory/suppressions_full.txt b/tools/valgrind/drmemory/suppressions_full.txt
index 7ce6e00..949b372 100644
--- a/tools/valgrind/drmemory/suppressions_full.txt
+++ b/tools/valgrind/drmemory/suppressions_full.txt
@@ -1127,8 +1127,3 @@ name=http://crbug.com/115606
*!media::WebMListParser::OnListStart
*!media::WebMListParser::ParseListElement
*!media::WebMListParser::Parse
-
-LEAK
-name=http://crbug.com/115987
-...
-*!base::SequencedWorkerPool::*
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index 9900d1a..3e58d56 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -5930,14 +5930,7 @@
fun:_ZN7WebCore18HarfBuzzShaperBase10setPaddingEi
fun:_ZN7WebCore21ComplexTextController*
}
-{
- bug_115987
- Memcheck:Leak
- fun:_Znw*
- fun:_ZN4base12_GLOBAL__N_123SequencedWorkerPoolTestC2Ev
- fun:_ZN4base*SequencedWorkerPoolTest_*
- fun:_ZN7testing8internal15TestFactoryImplIN4base*SequencedWorkerPoolTest_*
-}
+
#-----------------------------------------------------------------------
# 4. These only occur on our Google workstations
diff --git a/tools/valgrind/memcheck/suppressions_mac.txt b/tools/valgrind/memcheck/suppressions_mac.txt
index d6a3734..447e901 100644
--- a/tools/valgrind/memcheck/suppressions_mac.txt
+++ b/tools/valgrind/memcheck/suppressions_mac.txt
@@ -2358,30 +2358,3 @@
fun:find_registered_purgeable_zone
fun:malloc_make_purgeable
}
-{
- bug_115987_a
- Memcheck:Leak
- fun:_Znw*
- fun:_ZN4base19SequencedWorkerPool5Inner30FinishStartingAdditionalThreadEi
- fun:_ZN4base19SequencedWorkerPool5Inner*
-}
-{
- bug_115987_b
- Memcheck:Leak
- fun:_Znw*
- fun:_ZN4base12_GLOBAL__N_123SequencedWorkerPoolTestC2Ev
- fun:_ZN4base*SequencedWorkerPoolTest_*
- fun:_ZN4base*SequencedWorkerPoolTest_*
- fun:_ZN7testing8internal15TestFactoryImplIN4base*SequencedWorkerPoolTest_*
-}
-{
- bug_115987_c
- Memcheck:Leak
- fun:_Znw*
- fun:_ZN9__gnu_cxx13new_allocatorI10linked_ptrIN4base19SequencedWorkerPool6WorkerEEE8allocateEmPKv
- fun:_ZNSt12_Vector_baseI10linked_ptrIN4base19SequencedWorkerPool6WorkerEESaIS4_EE11_M_allocateEm
- fun:_ZNSt6vectorI10linked_ptrIN4base19SequencedWorkerPool6WorkerEESaIS4_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS4_S6_EERKS4_
- fun:_ZNSt6vectorI10linked_ptrIN4base19SequencedWorkerPool6WorkerEESaIS4_EE9push_backERKS4_
- fun:_ZN4base19SequencedWorkerPool5Inner10ThreadLoopEPNS0_6WorkerE
- fun:_ZN4base19SequencedWorkerPool6Worker3RunEv
-}