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

Unified Diff: base/tracked_objects.cc

Issue 8432003: Reduce leaking in object tracking tests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 2 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/tracked_objects.h ('k') | base/tracked_objects_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « base/tracked_objects.h ('k') | base/tracked_objects_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698