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

Unified Diff: base/tracked_objects.cc

Issue 1141793003: Update from https://crrev.com/329939 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « base/tracked_objects.h ('k') | base/tracked_objects_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tracked_objects.cc
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc
index 9029f4febda79c9206494fc19219994e4d455a15..9db05c0d3fd7354e8ae93a1b32f80ba56ab4ce75 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -168,32 +168,6 @@ void DeathData::RecordDeath(const int32 queue_duration,
}
}
-int DeathData::count() const { return count_; }
-
-int32 DeathData::run_duration_sum() const { return run_duration_sum_; }
-
-int32 DeathData::run_duration_max() const { return run_duration_max_; }
-
-int32 DeathData::run_duration_sample() const {
- return run_duration_sample_;
-}
-
-int32 DeathData::queue_duration_sum() const {
- return queue_duration_sum_;
-}
-
-int32 DeathData::queue_duration_max() const {
- return queue_duration_max_;
-}
-
-int32 DeathData::queue_duration_sample() const {
- return queue_duration_sample_;
-}
-
-const DeathDataPhaseSnapshot* DeathData::last_phase_snapshot() const {
- return last_phase_snapshot_;
-}
-
void DeathData::OnProfilingPhaseCompleted(int profiling_phase) {
// Snapshotting and storing current state.
last_phase_snapshot_ = new DeathDataPhaseSnapshot(
@@ -388,8 +362,7 @@ ThreadData* ThreadData::next() const { return next_; }
// static
void ThreadData::InitializeThreadContext(const std::string& suggested_name) {
- if (!Initialize()) // Always initialize if needed.
- return;
+ Initialize();
ThreadData* current_thread_data =
reinterpret_cast<ThreadData*>(tls_index_.Get());
if (current_thread_data)
@@ -718,9 +691,9 @@ static void OptionallyInitializeAlternateTimer() {
ThreadData::SetAlternateTimeSource(alternate_time_source);
}
-bool ThreadData::Initialize() {
+void ThreadData::Initialize() {
if (status_ >= DEACTIVATED)
- return true; // Someone else did the initialization.
+ return; // Someone else did the initialization.
// Due to racy lazy initialization in tests, we'll need to recheck status_
// after we acquire the lock.
@@ -729,7 +702,7 @@ bool ThreadData::Initialize() {
// initialization.
base::AutoLock lock(*list_lock_.Pointer());
if (status_ >= DEACTIVATED)
- return true; // Someone raced in here and beat us.
+ return; // Someone raced in here and beat us.
// Put an alternate timer in place if the environment calls for it, such as
// for tracking TCMalloc allocations. This insertion is idempotent, so we
@@ -743,8 +716,7 @@ bool ThreadData::Initialize() {
if (!tls_index_.initialized()) { // Testing may have initialized this.
DCHECK_EQ(status_, UNINITIALIZED);
tls_index_.Initialize(&ThreadData::OnThreadTermination);
- if (!tls_index_.initialized())
- return false;
+ DCHECK(tls_index_.initialized());
} else {
// TLS was initialzed for us earlier.
DCHECK_EQ(status_, DORMANT_DURING_TESTS);
@@ -759,21 +731,18 @@ bool ThreadData::Initialize() {
// we get the lock earlier in this method.
status_ = kInitialStartupState;
DCHECK(status_ != UNINITIALIZED);
- return true;
}
// static
-bool ThreadData::InitializeAndSetTrackingStatus(Status status) {
+void ThreadData::InitializeAndSetTrackingStatus(Status status) {
DCHECK_GE(status, DEACTIVATED);
DCHECK_LE(status, PROFILING_ACTIVE);
- if (!Initialize()) // No-op if already initialized.
- return false; // Not compiled in.
+ Initialize(); // No-op if already initialized.
if (status > DEACTIVATED)
status = PROFILING_ACTIVE;
status_ = status;
- return true;
}
// static
@@ -827,8 +796,8 @@ void ThreadData::ShutdownSingleThreadedCleanup(bool leak) {
// This is only called from test code, where we need to cleanup so that
// additional tests can be run.
// We must be single threaded... but be careful anyway.
- if (!InitializeAndSetTrackingStatus(DEACTIVATED))
- return;
+ InitializeAndSetTrackingStatus(DEACTIVATED);
+
ThreadData* thread_data_list;
{
base::AutoLock lock(*list_lock_.Pointer());
« no previous file with comments | « base/tracked_objects.h ('k') | base/tracked_objects_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698