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

Unified Diff: base/tracked_objects.h

Issue 1845753006: Don't create redundant ThreadData for Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: base/tracked_objects.h
diff --git a/base/tracked_objects.h b/base/tracked_objects.h
index 168b17db045a429234c3ae403622a9217adf3ad8..27423602f580f249dbbf67b0aad4d6f0611c41c0 100644
--- a/base/tracked_objects.h
+++ b/base/tracked_objects.h
@@ -448,11 +448,15 @@ class BASE_EXPORT ThreadData {
typedef base::hash_map<Location, Births*, Location::Hash> BirthMap;
typedef std::map<const Births*, DeathData> DeathMap;
- // Initialize the current thread context with a new instance of ThreadData.
+ // If is_worker_thread, do partial initialization of the thread context,
+ // and wait for just-in-time initilization using potentially recycled
Lei Zhang 2016/05/12 19:47:40 typo
Zhenyu Shan 2016/05/16 02:05:35 Restored the comment here because we moved is_work
+ // context. Otherwise, Initialize the current thread context with a new
+ // instance of ThreadData.
// This is used by all threads that have names, and should be explicitly
// set *before* any births on the threads have taken place. It is generally
// only used by the message loop, which has a well defined thread name.
- static void InitializeThreadContext(const std::string& suggested_name);
+ static void InitializeThreadContext(const std::string& suggested_name,
+ bool is_worker_thread = false);
// Using Thread Local Store, find the current instance for collecting data.
// If an instance does not exist, construct one (and remember it for use on
@@ -514,7 +518,7 @@ class BASE_EXPORT ThreadData {
// Initializes all statics if needed (this initialization call should be made
// while we are single threaded).
- static void Initialize();
+ static void EnsureTlsInitialization();
// Sets internal status_.
// If |status| is false, then status_ is set to DEACTIVATED.

Powered by Google App Engine
This is Rietveld 408576698