Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3170)

Unified Diff: base/test/scoped_task_environment.cc

Issue 2812293002: Flush TaskScheduler in ~ScopedTaskEnvironment and ~ScopedAsyncTaskScheduler. (Closed)
Patch Set: CR-gab-8-add-comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/test/scoped_async_task_scheduler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/scoped_task_environment.cc
diff --git a/base/test/scoped_task_environment.cc b/base/test/scoped_task_environment.cc
index 8744b4a6b11427fe84c82bb7567708fff11b552c..b18bf6a19d3a940ba0268f1dcb4409780d108cf5 100644
--- a/base/test/scoped_task_environment.cc
+++ b/base/test/scoped_task_environment.cc
@@ -32,6 +32,9 @@ ScopedTaskEnvironment::~ScopedTaskEnvironment() {
RunLoop().RunUntilIdle();
DCHECK_EQ(TaskScheduler::GetInstance(), task_scheduler_);
+ // Without FlushForTesting(), DeleteSoon() and ReleaseSoon() tasks could be
+ // skipped, resulting in memory leaks.
+ TaskScheduler::GetInstance()->FlushForTesting();
TaskScheduler::GetInstance()->Shutdown();
TaskScheduler::GetInstance()->JoinForTesting();
TaskScheduler::SetInstance(nullptr);
« no previous file with comments | « base/test/scoped_async_task_scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698