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

Unified Diff: base/tracked_objects.h

Issue 8606001: Check that thread contexts are cleaned up during profiling (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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/tracked_objects.cc » ('j') | base/tracked_objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tracked_objects.h
===================================================================
--- base/tracked_objects.h (revision 110865)
+++ base/tracked_objects.h (working copy)
@@ -532,6 +532,11 @@
// the code).
static TrackedTime Now();
+ // This function can be called at process termination to validate that thread
+ // cleanup routines have been called for at least some number of named
+ // threads.
+ static void EnsureCleanupWasCalled(int major_threads_shutdown_count);
+
private:
// Allow only tests to call ShutdownSingleThreadedCleanup. We NEVER call it
// in production code.
@@ -594,19 +599,26 @@
// The list is traversed by about:profiler when it needs to snapshot data.
// This is only accessed while list_lock_ is held.
static ThreadData* all_thread_data_list_head_;
- // The next available thread number. This should only be accessed when the
- // list_lock_ is held.
- static int thread_number_counter_;
+
+ // The next available worker thread number. This should only be accessed when
+ // the list_lock_ is held.
+ static int worker_thread_data_creation_count_;
+
+ // The number of times TLS has called us back to cleanup a ThreadData
+ // instance. This is only accessed while list_lock_ is held.
+ static int cleanup_count_;
+
// Incarnation sequence number, indicating how many times (during unittests)
// we've either transitioned out of UNINITIALIZED, or into that state. This
// value is only accessed while the list_lock_ is held.
static int incarnation_counter_;
+
// Protection for access to all_thread_data_list_head_, and to
// unregistered_thread_data_pool_. This lock is leaked at shutdown.
// The lock is very infrequently used, so we can afford to just make a lazy
// instance and be safe.
static base::LazyInstance<base::Lock,
- base::LeakyLazyInstanceTraits<base::Lock> > list_lock_;
+ base::LeakyLazyInstanceTraits<base::Lock> > list_lock_;
// Record of what the incarnation_counter_ was when this instance was created.
// If the incarnation_counter_ has changed, then we avoid pushing into the
@@ -655,7 +667,7 @@
// thread, or reading from another thread. For reading from this thread we
// don't need a lock, as there is no potential for a conflict since the
// writing is only done from this thread.
- mutable base::Lock lock_;
+ mutable base::Lock map_lock_;
DISALLOW_COPY_AND_ASSIGN(ThreadData);
};
« no previous file with comments | « no previous file | base/tracked_objects.cc » ('j') | base/tracked_objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698