diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-07 01:35:37 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-07 01:35:37 +0000 |
commit | 13ecb5e99e5fad75162cad08f1082eff259ff0d9 (patch) | |
tree | 988e3a5dc1b8fc33e4e28dd2826e8c0176350cd4 /content/browser/browser_thread_impl.cc | |
parent | 8c2acc21b17cdcc88edc0bea2623a637c97fdeab (diff) | |
download | chromium_src-13ecb5e99e5fad75162cad08f1082eff259ff0d9.zip chromium_src-13ecb5e99e5fad75162cad08f1082eff259ff0d9.tar.gz chromium_src-13ecb5e99e5fad75162cad08f1082eff259ff0d9.tar.bz2 |
Flush SequenceWorkerPool tasks after each test. Applies to unit_test, interactive_ui test, browser_tests... pretty much all gtest based content library test harnesses are affected.
The CL changes semantics and implementation of the existing FlushForTesting method (which wasn't suitable for this usage).
* The old method would wait for delayed tasks prior to continuing, the new method
will not run them but will delete them prior to continuing.
* The old method would deadlock if called after Shutdown had been called, the new method returns immediately in that case.
A few SWP unittests relied on the waiting for delayed task completion behavior. Those have been modified to explicitly wait thru other means.
BUG=168415,166470
Review URL: https://codereview.chromium.org/11649032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186578 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_thread_impl.cc')
-rw-r--r-- | content/browser/browser_thread_impl.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc index e046ce4..e2867c3 100644 --- a/content/browser/browser_thread_impl.cc +++ b/content/browser/browser_thread_impl.cc @@ -87,6 +87,14 @@ void BrowserThreadImpl::ShutdownThreadPool() { globals.blocking_pool->Shutdown(kMaxNewShutdownBlockingTasks); } +// static +void BrowserThreadImpl::FlushThreadPoolHelper() { + // We don't want to create a pool if none exists. + if (g_globals == NULL) + return; + g_globals.Get().blocking_pool->FlushForTesting(); +} + void BrowserThreadImpl::Init() { BrowserThreadGlobals& globals = g_globals.Get(); |