summaryrefslogtreecommitdiffstats
path: root/base/threading
diff options
context:
space:
mode:
authorgbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-18 05:41:23 +0000
committergbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-18 05:41:23 +0000
commit4f60d80fe11923a832b5d1dfca1373debde321db (patch)
tree63119dc1264958b19a46c980ea0112389fb49a77 /base/threading
parent7e77b05ee015b7c8621cce2d5d3f711945f7d4c7 (diff)
downloadchromium_src-4f60d80fe11923a832b5d1dfca1373debde321db.zip
chromium_src-4f60d80fe11923a832b5d1dfca1373debde321db.tar.gz
chromium_src-4f60d80fe11923a832b5d1dfca1373debde321db.tar.bz2
Regularize storage monitor creation in Windows.
BUG=None Review URL: https://chromiumcodereview.appspot.com/12647013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194784 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/threading')
-rw-r--r--base/threading/sequenced_worker_pool.h8
-rw-r--r--base/threading/sequenced_worker_pool_unittest.cc16
2 files changed, 18 insertions, 6 deletions
diff --git a/base/threading/sequenced_worker_pool.h b/base/threading/sequenced_worker_pool.h
index a96cd76..7e04b07 100644
--- a/base/threading/sequenced_worker_pool.h
+++ b/base/threading/sequenced_worker_pool.h
@@ -57,10 +57,10 @@ class SequencedTaskRunner;
// These will be executed in an unspecified order. The order of execution
// between tasks with different sequence tokens is also unspecified.
//
-// This class is designed to be leaked on shutdown to allow the
-// CONTINUE_ON_SHUTDOWN behavior to be implemented. To enforce the
-// BLOCK_SHUTDOWN behavior, you must call Shutdown() which will wait until
-// the necessary tasks have completed.
+// This class may be leaked on shutdown to facilitate fast shutdown. The
+// expected usage, however, is to call Shutdown(), which correctly accounts
+// for CONTINUE_ON_SHUTDOWN behavior and is required for BLOCK_SHUTDOWN
+// behavior.
//
// Implementation note: This does not use a base::WorkerPool since that does
// not enforce shutdown semantics or allow us to specify how many worker
diff --git a/base/threading/sequenced_worker_pool_unittest.cc b/base/threading/sequenced_worker_pool_unittest.cc
index f0caf1a..95e4f11 100644
--- a/base/threading/sequenced_worker_pool_unittest.cc
+++ b/base/threading/sequenced_worker_pool_unittest.cc
@@ -28,7 +28,7 @@ namespace base {
// IMPORTANT NOTE:
//
// Many of these tests have failure modes where they'll hang forever. These
-// tests should not be flaky, and hangling indicates a type of failure. Do not
+// tests should not be flaky, and hanging indicates a type of failure. Do not
// mark as flaky if they're hanging, it's likely an actual bug.
namespace {
@@ -781,7 +781,7 @@ TEST_F(SequencedWorkerPoolTest, FlushForTesting) {
true));
// We expect all except the delayed task to have been run. We verify all
- // closures have been deleted deleted by looking at the refcount of the
+ // closures have been deleted by looking at the refcount of the
// tracker.
EXPECT_FALSE(tracker()->HasOneRef());
pool()->FlushForTesting();
@@ -798,6 +798,18 @@ TEST_F(SequencedWorkerPoolTest, FlushForTesting) {
pool()->FlushForTesting();
}
+TEST(SequencedWorkerPoolRefPtrTest, ShutsDownCleanWithContinueOnShutdown) {
+ MessageLoop loop;
+ scoped_refptr<SequencedWorkerPool> pool(new SequencedWorkerPool(3, "Pool"));
+ scoped_refptr<SequencedTaskRunner> task_runner =
+ pool->GetSequencedTaskRunnerWithShutdownBehavior(
+ pool->GetSequenceToken(),
+ base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
+
+ // Upon test exit, should shut down without hanging.
+ pool->Shutdown();
+}
+
class SequencedWorkerPoolTaskRunnerTestDelegate {
public:
SequencedWorkerPoolTaskRunnerTestDelegate() {}