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

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.
@@ -596,7 +601,10 @@
static ThreadData* all_thread_data_list_head_;
// The next available thread number. This should only be accessed when the
// list_lock_ is held.
ramant (doing other things) 2011/11/21 04:14:06 nit: should we consider adjusting comments?
jar (doing other things) 2011/11/21 17:22:30 Done.
- static int thread_number_counter_;
+ 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.
@@ -606,7 +614,7 @@
// 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 +663,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