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

Unified Diff: base/tracked_objects_unittest.cc

Issue 1104053004: Cleanup: removing unused descendants information from tracked objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: isherman@ comments Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/tracked_objects.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tracked_objects_unittest.cc
diff --git a/base/tracked_objects_unittest.cc b/base/tracked_objects_unittest.cc
index 81f464cb78423e1d21cf570a53c277fae725d7aa..3537e542a97fe549866bf102920d2851089c2b32 100644
--- a/base/tracked_objects_unittest.cc
+++ b/base/tracked_objects_unittest.cc
@@ -101,8 +101,6 @@ class TrackedObjectsTest : public testing::Test {
EXPECT_EQ(death_thread, process_data_phase.tasks[0].death_thread_name);
- EXPECT_EQ(0u, process_data_phase.descendants.size());
-
EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
}
@@ -122,7 +120,7 @@ unsigned int TrackedObjectsTest::test_time_;
TEST_F(TrackedObjectsTest, TaskStopwatchNoStartStop) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -135,7 +133,7 @@ TEST_F(TrackedObjectsTest, TaskStopwatchNoStartStop) {
TEST_F(TrackedObjectsTest, MinimalStartupShutdown) {
// Minimal test doesn't even create any tasks.
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -148,18 +146,16 @@ TEST_F(TrackedObjectsTest, MinimalStartupShutdown) {
EXPECT_EQ(data, ThreadData::Get());
ThreadData::BirthMap birth_map;
ThreadData::DeathsSnapshot deaths;
- ThreadData::ParentChildSet parent_child_set;
- data->SnapshotMaps(0, &birth_map, &deaths, &parent_child_set);
+ data->SnapshotMaps(0, &birth_map, &deaths);
EXPECT_EQ(0u, birth_map.size());
EXPECT_EQ(0u, deaths.size());
- EXPECT_EQ(0u, parent_child_set.size());
// Clean up with no leaking.
Reset();
// Do it again, just to be sure we reset state completely.
- EXPECT_TRUE(ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE));
+ EXPECT_TRUE(
+ ThreadData::InitializeAndSetTrackingStatus(ThreadData::PROFILING_ACTIVE));
EXPECT_FALSE(ThreadData::first()); // No activity even on this thread.
data = ThreadData::Get();
EXPECT_TRUE(ThreadData::first()); // Now class was constructed.
@@ -168,16 +164,14 @@ TEST_F(TrackedObjectsTest, MinimalStartupShutdown) {
EXPECT_EQ(data, ThreadData::Get());
birth_map.clear();
deaths.clear();
- parent_child_set.clear();
- data->SnapshotMaps(0, &birth_map, &deaths, &parent_child_set);
+ data->SnapshotMaps(0, &birth_map, &deaths);
EXPECT_EQ(0u, birth_map.size());
EXPECT_EQ(0u, deaths.size());
- EXPECT_EQ(0u, parent_child_set.size());
}
TEST_F(TrackedObjectsTest, TinyStartupShutdown) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -185,7 +179,7 @@ TEST_F(TrackedObjectsTest, TinyStartupShutdown) {
// Instigate tracking on a single tracked object, on our thread.
const char kFunction[] = "TinyStartupShutdown";
Location location(kFunction, kFile, kLineNumber, NULL);
- Births* first_birth = ThreadData::TallyABirthIfActive(location);
+ ThreadData::TallyABirthIfActive(location);
ThreadData* data = ThreadData::first();
ASSERT_TRUE(data);
@@ -193,17 +187,14 @@ TEST_F(TrackedObjectsTest, TinyStartupShutdown) {
EXPECT_EQ(data, ThreadData::Get());
ThreadData::BirthMap birth_map;
ThreadData::DeathsSnapshot deaths;
- ThreadData::ParentChildSet parent_child_set;
- data->SnapshotMaps(0, &birth_map, &deaths, &parent_child_set);
+ data->SnapshotMaps(0, &birth_map, &deaths);
EXPECT_EQ(1u, birth_map.size()); // 1 birth location.
EXPECT_EQ(1, birth_map.begin()->second->birth_count()); // 1 birth.
EXPECT_EQ(0u, deaths.size()); // No deaths.
- EXPECT_EQ(0u, parent_child_set.size()); // No children.
// Now instigate another birth, while we are timing the run of the first
// execution.
- ThreadData::PrepareForStartOfRun(first_birth);
// Create a child (using the same birth location).
// TrackingInfo will call TallyABirth() during construction.
const int32 start_time = 1;
@@ -222,19 +213,11 @@ TEST_F(TrackedObjectsTest, TinyStartupShutdown) {
birth_map.clear();
deaths.clear();
- parent_child_set.clear();
- data->SnapshotMaps(0, &birth_map, &deaths, &parent_child_set);
+ data->SnapshotMaps(0, &birth_map, &deaths);
EXPECT_EQ(1u, birth_map.size()); // 1 birth location.
EXPECT_EQ(2, birth_map.begin()->second->birth_count()); // 2 births.
EXPECT_EQ(1u, deaths.size()); // 1 location.
EXPECT_EQ(1, deaths.begin()->second.death_data.count); // 1 death.
- if (ThreadData::TrackingParentChildStatus()) {
- EXPECT_EQ(1u, parent_child_set.size()); // 1 child.
- EXPECT_EQ(parent_child_set.begin()->first,
- parent_child_set.begin()->second);
- } else {
- EXPECT_EQ(0u, parent_child_set.size()); // no stats.
- }
// The births were at the same location as the one known death.
EXPECT_EQ(birth_map.begin()->second, deaths.begin()->first);
@@ -264,33 +247,11 @@ TEST_F(TrackedObjectsTest, TinyStartupShutdown) {
EXPECT_EQ(0, process_data_phase.tasks[0].death_data.queue_duration_max);
EXPECT_EQ(0, process_data_phase.tasks[0].death_data.queue_duration_sample);
EXPECT_EQ(kWorkerThreadName, process_data_phase.tasks[0].death_thread_name);
-
- if (ThreadData::TrackingParentChildStatus()) {
- ASSERT_EQ(1u, process_data_phase.descendants.size());
- EXPECT_EQ(kFile,
- process_data_phase.descendants[0].parent.location.file_name);
- EXPECT_EQ(kFunction,
- process_data_phase.descendants[0].parent.location.function_name);
- EXPECT_EQ(kLineNumber,
- process_data_phase.descendants[0].parent.location.line_number);
- EXPECT_EQ(kWorkerThreadName,
- process_data_phase.descendants[0].parent.thread_name);
- EXPECT_EQ(kFile,
- process_data_phase.descendants[0].child.location.file_name);
- EXPECT_EQ(kFunction,
- process_data_phase.descendants[0].child.location.function_name);
- EXPECT_EQ(kLineNumber,
- process_data_phase.descendants[0].child.location.line_number);
- EXPECT_EQ(kWorkerThreadName,
- process_data_phase.descendants[0].child.thread_name);
- } else {
- EXPECT_EQ(0u, process_data_phase.descendants.size());
- }
}
TEST_F(TrackedObjectsTest, DeathDataTestRecordDeath) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -333,7 +294,7 @@ TEST_F(TrackedObjectsTest, DeathDataTestRecordDeath) {
TEST_F(TrackedObjectsTest, DeathDataTest2Phases) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -402,7 +363,7 @@ TEST_F(TrackedObjectsTest, DeathDataTest2Phases) {
TEST_F(TrackedObjectsTest, Delta) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -487,7 +448,7 @@ TEST_F(TrackedObjectsTest, DeactivatedBirthOnlyToSnapshotMainThread) {
TEST_F(TrackedObjectsTest, BirthOnlyToSnapshotWorkerThread) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -504,7 +465,7 @@ TEST_F(TrackedObjectsTest, BirthOnlyToSnapshotWorkerThread) {
TEST_F(TrackedObjectsTest, BirthOnlyToSnapshotMainThread) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -521,7 +482,7 @@ TEST_F(TrackedObjectsTest, BirthOnlyToSnapshotMainThread) {
TEST_F(TrackedObjectsTest, LifeCycleToSnapshotMainThread) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -554,7 +515,7 @@ TEST_F(TrackedObjectsTest, LifeCycleToSnapshotMainThread) {
TEST_F(TrackedObjectsTest, TwoPhases) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -628,8 +589,6 @@ TEST_F(TrackedObjectsTest, TwoPhases) {
EXPECT_EQ(kMainThreadName, process_data_phase0.tasks[0].death_thread_name);
- EXPECT_EQ(0u, process_data_phase0.descendants.size());
-
auto it1 = process_data.phased_snapshots.find(1);
ASSERT_TRUE(it1 != process_data.phased_snapshots.end());
const ProcessDataPhaseSnapshot& process_data_phase1 = it1->second;
@@ -654,14 +613,12 @@ TEST_F(TrackedObjectsTest, TwoPhases) {
EXPECT_EQ(kMainThreadName, process_data_phase1.tasks[0].death_thread_name);
- EXPECT_EQ(0u, process_data_phase1.descendants.size());
-
EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
}
TEST_F(TrackedObjectsTest, ThreePhases) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -753,8 +710,6 @@ TEST_F(TrackedObjectsTest, ThreePhases) {
EXPECT_EQ(kMainThreadName, process_data_phase0.tasks[0].death_thread_name);
- EXPECT_EQ(0u, process_data_phase0.descendants.size());
-
auto it1 = process_data.phased_snapshots.find(1);
ASSERT_TRUE(it1 != process_data.phased_snapshots.end());
const ProcessDataPhaseSnapshot& process_data_phase1 = it1->second;
@@ -779,8 +734,6 @@ TEST_F(TrackedObjectsTest, ThreePhases) {
EXPECT_EQ(kMainThreadName, process_data_phase1.tasks[0].death_thread_name);
- EXPECT_EQ(0u, process_data_phase1.descendants.size());
-
auto it2 = process_data.phased_snapshots.find(2);
ASSERT_TRUE(it2 != process_data.phased_snapshots.end());
const ProcessDataPhaseSnapshot& process_data_phase2 = it2->second;
@@ -805,14 +758,12 @@ TEST_F(TrackedObjectsTest, ThreePhases) {
EXPECT_EQ(kMainThreadName, process_data_phase2.tasks[0].death_thread_name);
- EXPECT_EQ(0u, process_data_phase2.descendants.size());
-
EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
}
TEST_F(TrackedObjectsTest, TwoPhasesSecondEmpty) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -874,14 +825,12 @@ TEST_F(TrackedObjectsTest, TwoPhasesSecondEmpty) {
ASSERT_EQ(0u, process_data_phase1.tasks.size());
- EXPECT_EQ(0u, process_data_phase0.descendants.size());
-
EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
}
TEST_F(TrackedObjectsTest, TwoPhasesFirstEmpty) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -946,7 +895,7 @@ TEST_F(TrackedObjectsTest, TwoPhasesFirstEmpty) {
// task is still running, or is queued).
TEST_F(TrackedObjectsTest, LifeCycleMidDeactivatedToSnapshotMainThread) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -1026,7 +975,7 @@ TEST_F(TrackedObjectsTest, LifeCyclePreDeactivatedToSnapshotMainThread) {
TEST_F(TrackedObjectsTest, TwoLives) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -1070,7 +1019,7 @@ TEST_F(TrackedObjectsTest, TwoLives) {
TEST_F(TrackedObjectsTest, DifferentLives) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -1141,13 +1090,12 @@ TEST_F(TrackedObjectsTest, DifferentLives) {
EXPECT_EQ(0, process_data_phase.tasks[1].death_data.queue_duration_max);
EXPECT_EQ(0, process_data_phase.tasks[1].death_data.queue_duration_sample);
EXPECT_EQ(kStillAlive, process_data_phase.tasks[1].death_thread_name);
- EXPECT_EQ(0u, process_data_phase.descendants.size());
EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
}
TEST_F(TrackedObjectsTest, TaskWithNestedExclusion) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -1185,7 +1133,7 @@ TEST_F(TrackedObjectsTest, TaskWithNestedExclusion) {
TEST_F(TrackedObjectsTest, TaskWith2NestedExclusions) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -1229,7 +1177,7 @@ TEST_F(TrackedObjectsTest, TaskWith2NestedExclusions) {
TEST_F(TrackedObjectsTest, TaskWithNestedExclusionWithNestedTask) {
if (!ThreadData::InitializeAndSetTrackingStatus(
- ThreadData::PROFILING_CHILDREN_ACTIVE)) {
+ ThreadData::PROFILING_ACTIVE)) {
// Don't run the test if task tracking is not compiled in.
return;
}
@@ -1319,7 +1267,6 @@ TEST_F(TrackedObjectsTest, TaskWithNestedExclusionWithNestedTask) {
EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_max);
EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_sample);
EXPECT_EQ(kMainThreadName, process_data_phase.tasks[t1].death_thread_name);
- EXPECT_EQ(0u, process_data_phase.descendants.size());
EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
}
« no previous file with comments | « base/tracked_objects.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698