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

Side by Side 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: Early return in InitializeThreadContext Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TRACKED_OBJECTS_H_ 5 #ifndef BASE_TRACKED_OBJECTS_H_
6 #define BASE_TRACKED_OBJECTS_H_ 6 #define BASE_TRACKED_OBJECTS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 PROFILING_ACTIVE, // Recording profiles. 444 PROFILING_ACTIVE, // Recording profiles.
445 STATUS_LAST = PROFILING_ACTIVE 445 STATUS_LAST = PROFILING_ACTIVE
446 }; 446 };
447 447
448 typedef base::hash_map<Location, Births*, Location::Hash> BirthMap; 448 typedef base::hash_map<Location, Births*, Location::Hash> BirthMap;
449 typedef std::map<const Births*, DeathData> DeathMap; 449 typedef std::map<const Births*, DeathData> DeathMap;
450 450
451 // Initialize the current thread context with a new instance of ThreadData. 451 // Initialize the current thread context with a new instance of ThreadData.
452 // This is used by all threads that have names, and should be explicitly 452 // This is used by all threads that have names, and should be explicitly
453 // set *before* any births on the threads have taken place. It is generally 453 // set *before* any births on the threads have taken place. It is generally
454 // only used by the message loop, which has a well defined thread name. 454 // only used by the message loop, which has a well defined thread name.
jar (doing other things) 2016/04/20 04:34:51 This comment appears to state that this should *on
Zhenyu Shan 2016/05/04 23:33:03 Done. I'm not very sure if I've understood you co
455 static void InitializeThreadContext(const std::string& suggested_name); 455 static void InitializeThreadContext(const std::string& suggested_name,
456 bool is_worker_thread = false);
456 457
457 // Using Thread Local Store, find the current instance for collecting data. 458 // Using Thread Local Store, find the current instance for collecting data.
458 // If an instance does not exist, construct one (and remember it for use on 459 // If an instance does not exist, construct one (and remember it for use on
459 // this thread. 460 // this thread.
460 // This may return NULL if the system is disabled for any reason. 461 // This may return NULL if the system is disabled for any reason.
461 static ThreadData* Get(); 462 static ThreadData* Get();
462 463
463 // Fills |process_data_snapshot| with phased snapshots of all profiling 464 // Fills |process_data_snapshot| with phased snapshots of all profiling
464 // phases, including the current one, identified by |current_profiling_phase|. 465 // phases, including the current one, identified by |current_profiling_phase|.
465 // |current_profiling_phase| is necessary because a child process can start 466 // |current_profiling_phase| is necessary because a child process can start
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 ProcessDataSnapshot(const ProcessDataSnapshot& other); 812 ProcessDataSnapshot(const ProcessDataSnapshot& other);
812 ~ProcessDataSnapshot(); 813 ~ProcessDataSnapshot();
813 814
814 PhasedProcessDataSnapshotMap phased_snapshots; 815 PhasedProcessDataSnapshotMap phased_snapshots;
815 base::ProcessId process_id; 816 base::ProcessId process_id;
816 }; 817 };
817 818
818 } // namespace tracked_objects 819 } // namespace tracked_objects
819 820
820 #endif // BASE_TRACKED_OBJECTS_H_ 821 #endif // BASE_TRACKED_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698