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

Unified Diff: base/threading/thread_id_name_manager.h

Issue 14634009: Move Thread Name Mapping into ThreadFunc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/threading/thread_id_name_manager.h
diff --git a/base/threading/thread_id_name_manager.h b/base/threading/thread_id_name_manager.h
index e592742e6a348375a3d3de745b6be68d1c04a56d..e690680eaf87ff4aa5ae84eae42b537a29b83886 100644
--- a/base/threading/thread_id_name_manager.h
+++ b/base/threading/thread_id_name_manager.h
@@ -23,6 +23,9 @@ class BASE_EXPORT ThreadIdNameManager {
static const char* GetDefaultInternedString();
+ // Register the mapping between a thread |id| and |handle|.
+ void RegisterThread(PlatformThreadHandle* handle, PlatformThreadId id);
+
// Set the name for the given id.
void SetName(PlatformThreadId id, const char* name);
@@ -30,7 +33,7 @@ class BASE_EXPORT ThreadIdNameManager {
const char* GetName(PlatformThreadId id);
// Remove the name for the given id.
- void RemoveName(PlatformThreadId id);
+ void RemoveName(PlatformThreadHandle* handle, PlatformThreadId id);
private:
friend struct DefaultSingletonTraits<ThreadIdNameManager>;
@@ -41,8 +44,13 @@ class BASE_EXPORT ThreadIdNameManager {
// lock_ protects both the thread_id_to_name_ and name_to_interned_name_ maps.
jar (doing other things) 2013/05/22 19:37:56 You probably want to update this comment, and your
dsinclair 2013/05/22 20:22:31 Done.
Lock lock_;
- std::map<PlatformThreadId, std::string*> thread_id_to_interned_name_;
std::map<std::string, std::string*> name_to_interned_name_;
+ std::map<PlatformThreadId, PlatformThreadHandle*> thread_id_to_handle_;
+ std::map<PlatformThreadHandle*, std::string*> thread_handle_to_interned_name_;
+
+ // Treat the main process specially as it doesn't have a PlatformThreadHandle
+ std::string* main_process_name_;
+ PlatformThreadId main_process_id_;
DISALLOW_COPY_AND_ASSIGN(ThreadIdNameManager);
};

Powered by Google App Engine
This is Rietveld 408576698