summaryrefslogtreecommitdiffstats
path: root/components/component_updater/component_updater_service_unittest.cc
diff options
context:
space:
mode:
authorsorin <sorin@chromium.org>2015-05-27 12:50:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-27 19:51:25 +0000
commit85e6803d2080f0565b91fdf5dadb671bea572c55 (patch)
tree44b2db73f0448c8ea7268ae1decfd756a1da442e /components/component_updater/component_updater_service_unittest.cc
parent013831e64e2ca1414e86fe2498cb193d5a8b8354 (diff)
downloadchromium_src-85e6803d2080f0565b91fdf5dadb671bea572c55.zip
chromium_src-85e6803d2080f0565b91fdf5dadb671bea572c55.tar.gz
chromium_src-85e6803d2080f0565b91fdf5dadb671bea572c55.tar.bz2
SequencedWorkerPool has a race condition on destruction that could result in a memory leak in some cases (see https://code.google.com/p/chromium/issues/detail?id=273800).
BUG=492450,450337 Review URL: https://codereview.chromium.org/1162433002 Cr-Commit-Position: refs/heads/master@{#331627}
Diffstat (limited to 'components/component_updater/component_updater_service_unittest.cc')
-rw-r--r--components/component_updater/component_updater_service_unittest.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/components/component_updater/component_updater_service_unittest.cc b/components/component_updater/component_updater_service_unittest.cc
index 597135b..c44c63b 100644
--- a/components/component_updater/component_updater_service_unittest.cc
+++ b/components/component_updater/component_updater_service_unittest.cc
@@ -15,8 +15,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
+#include "base/test/sequenced_worker_pool_owner.h"
#include "base/thread_task_runner_handle.h"
-#include "base/threading/sequenced_worker_pool.h"
#include "base/values.h"
#include "components/component_updater/component_updater_service.h"
#include "components/component_updater/component_updater_service_internal.h"
@@ -112,7 +112,7 @@ class ComponentUpdaterTest : public testing::Test {
base::RunLoop runloop_;
base::Closure quit_closure_;
- scoped_refptr<base::SequencedWorkerPool> worker_pool_;
+ scoped_ptr<base::SequencedWorkerPoolOwner> worker_pool_;
scoped_refptr<TestConfigurator> config_;
scoped_refptr<MockUpdateClient> update_client_;
@@ -157,11 +157,13 @@ scoped_ptr<ComponentUpdateService> TestComponentUpdateServiceFactory(
}
ComponentUpdaterTest::ComponentUpdaterTest()
- : worker_pool_(new base::SequencedWorkerPool(kNumWorkerThreads_, "test")) {
+ : worker_pool_(
+ new base::SequencedWorkerPoolOwner(kNumWorkerThreads_, "test")) {
quit_closure_ = runloop_.QuitClosure();
+ auto pool = worker_pool_->pool();
config_ = new TestConfigurator(
- worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()),
+ pool->GetSequencedTaskRunner(pool->GetSequenceToken()),
message_loop_.task_runner());
update_client_ = new MockUpdateClient();
@@ -171,7 +173,7 @@ ComponentUpdaterTest::ComponentUpdaterTest()
ComponentUpdaterTest::~ComponentUpdaterTest() {
EXPECT_CALL(update_client(), RemoveObserver(_)).Times(1);
- worker_pool_->Shutdown();
+ worker_pool_->pool()->Shutdown();
component_updater_.reset();
}