summaryrefslogtreecommitdiffstats
path: root/base/tracked_objects.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-24 00:00:31 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-24 00:00:31 +0000
commit9a88c90a08d3b8611d0bd5b46f6299b62a7b5f5d (patch)
tree44b4cc62faa701edcff662b676cc081e4e3ea603 /base/tracked_objects.h
parenta1c833f571c913363cc2fbd3400caf3a6f715c14 (diff)
downloadchromium_src-9a88c90a08d3b8611d0bd5b46f6299b62a7b5f5d.zip
chromium_src-9a88c90a08d3b8611d0bd5b46f6299b62a7b5f5d.tar.gz
chromium_src-9a88c90a08d3b8611d0bd5b46f6299b62a7b5f5d.tar.bz2
Check that thread contexts are cleaned up during profiling
There was a Thread Local Store regression, wherein thread cleanup notifcation was not sent to TLS users. This CL ensures that when this happens, that Chrome will crash. For now, I'm landed with a short-circuit (returns true all the time) in the test. I'll remove the TODO when we have XP properly supported. r=rtenneti BUG=103209 Review URL: http://codereview.chromium.org/8606001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/tracked_objects.h')
-rw-r--r--base/tracked_objects.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/base/tracked_objects.h b/base/tracked_objects.h
index 8acddba..29b2900 100644
--- a/base/tracked_objects.h
+++ b/base/tracked_objects.h
@@ -532,6 +532,11 @@ class BASE_EXPORT ThreadData {
// 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 @@ class BASE_EXPORT ThreadData {
// 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 @@ class BASE_EXPORT ThreadData {
// 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);
};