Index: base/tracked_objects.cc |
=================================================================== |
--- base/tracked_objects.cc (revision 107944) |
+++ base/tracked_objects.cc (working copy) |
@@ -542,7 +542,7 @@ |
} |
// static |
-void ThreadData::ShutdownSingleThreadedCleanup() { |
+void ThreadData::ShutdownSingleThreadedCleanup(bool leak) { |
// This is only called from test code, where we need to cleanup so that |
// additional tests can be run. |
// We must be single threaded... but be careful anyway. |
@@ -564,12 +564,12 @@ |
status_ = UNINITIALIZED; |
// To avoid any chance of racing in unit tests, which is the only place we |
- // call this function, we will leak all the data structures we recovered. |
- // These structures could plausibly be used by other threads in earlier tests |
- // that are still running. |
- return; |
+ // call this function, we may sometimes leak all the data structures we |
+ // recovered, as they may still be in use on threads from prior tests! |
+ if (leak) |
+ return; |
- // If we wanted to cleanup (on a single thread), here is what we would do. |
+ // When we want to cleanup (on a single thread), here is what we do. |
if (final_pool) { |
// The thread_data_list contains *all* the instances, and we'll use it to |