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

Unified Diff: base/test/scoped_async_task_scheduler.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 | « no previous file | base/test/scoped_task_environment.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/scoped_async_task_scheduler.cc
diff --git a/base/test/scoped_async_task_scheduler.cc b/base/test/scoped_async_task_scheduler.cc
index 397243edb0588fa90778ee927e64f36f6ef3d25e..0b5736a6e5cc72d079418bf1998b014a96883021 100644
--- a/base/test/scoped_async_task_scheduler.cc
+++ b/base/test/scoped_async_task_scheduler.cc
@@ -29,6 +29,9 @@ ScopedAsyncTaskScheduler::ScopedAsyncTaskScheduler() {
ScopedAsyncTaskScheduler::~ScopedAsyncTaskScheduler() {
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 | « no previous file | base/test/scoped_task_environment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698