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

Unified Diff: base/tracked_objects_unittest.cc

Issue 9181002: Track parent-child relations during profiling (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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
===================================================================
--- base/tracked_objects_unittest.cc (revision 120576)
+++ base/tracked_objects_unittest.cc (working copy)
@@ -35,7 +35,8 @@
TEST_F(TrackedObjectsTest, MinimalStartupShutdown) {
// Minimal test doesn't even create any tasks.
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
EXPECT_FALSE(ThreadData::first()); // No activity even on this thread.
@@ -55,7 +56,8 @@
ShutdownSingleThreadedCleanup(false);
// Do it again, just to be sure we reset state completely.
- ThreadData::InitializeAndSetTrackingStatus(true);
+ ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE);
EXPECT_FALSE(ThreadData::first()); // No activity even on this thread.
data = ThreadData::Get();
EXPECT_TRUE(ThreadData::first()); // Now class was constructed.
@@ -71,7 +73,8 @@
}
TEST_F(TrackedObjectsTest, TinyStartupShutdown) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
// Instigate tracking on a single tracked object, on our thread.
@@ -113,7 +116,7 @@
EXPECT_EQ(2, birth_map.begin()->second->birth_count()); // 2 births.
EXPECT_EQ(1u, death_map.size()); // 1 location.
EXPECT_EQ(1, death_map.begin()->second.count()); // 1 death.
- if (ThreadData::tracking_parent_child_status()) {
+ if (ThreadData::TrackingParentChildStatus()) {
EXPECT_EQ(1u, parent_child_set.size()); // 1 child.
EXPECT_EQ(parent_child_set.begin()->first,
parent_child_set.begin()->second);
@@ -126,9 +129,10 @@
}
TEST_F(TrackedObjectsTest, ParentChildTest) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
- if (!ThreadData::tracking_parent_child_status())
+ if (!ThreadData::TrackingParentChildStatus())
return; // Feature not compiled in.
// Instigate tracking on a single tracked object, on our thread.
@@ -211,7 +215,8 @@
}
TEST_F(TrackedObjectsTest, DeathDataTest) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
scoped_ptr<DeathData> data(new DeathData());
@@ -270,7 +275,7 @@
TEST_F(TrackedObjectsTest, DeactivatedBirthOnlyToValueWorkerThread) {
// Transition to Deactivated state before doing anything.
- if (!ThreadData::InitializeAndSetTrackingStatus(false))
+ if (!ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED))
return;
// We don't initialize system with a thread name, so we're viewed as a worker
// thread.
@@ -296,7 +301,7 @@
TEST_F(TrackedObjectsTest, DeactivatedBirthOnlyToValueMainThread) {
// Start in the deactivated state.
- if (!ThreadData::InitializeAndSetTrackingStatus(false))
+ if (!ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED))
return;
// Use a well named thread.
@@ -323,7 +328,8 @@
}
TEST_F(TrackedObjectsTest, BirthOnlyToValueWorkerThread) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
// We don't initialize system with a thread name, so we're viewed as a worker
// thread.
@@ -365,7 +371,8 @@
}
TEST_F(TrackedObjectsTest, BirthOnlyToValueMainThread) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
// Use a well named thread.
@@ -409,7 +416,8 @@
}
TEST_F(TrackedObjectsTest, LifeCycleToValueMainThread) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
// Use a well named thread.
@@ -470,7 +478,8 @@
// our tallied births are matched by tallied deaths (except for when the
// task is still running, or is queued).
TEST_F(TrackedObjectsTest, LifeCycleMidDeactivatedToValueMainThread) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
// Use a well named thread.
@@ -491,7 +500,8 @@
pending_task.time_posted = kTimePosted; // Overwrite implied Now().
// Turn off tracking now that we have births.
- EXPECT_TRUE(ThreadData::InitializeAndSetTrackingStatus(false));
+ EXPECT_TRUE(ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::DEACTIVATED));
const TrackedTime kStartOfRun = TrackedTime() +
Duration::FromMilliseconds(5);
@@ -532,7 +542,7 @@
// We will deactivate tracking before starting a life cycle, and neither
// the birth nor the death will be recorded.
TEST_F(TrackedObjectsTest, LifeCyclePreDeactivatedToValueMainThread) {
- if (!ThreadData::InitializeAndSetTrackingStatus(false))
+ if (!ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED))
return;
// Use a well named thread.
@@ -571,7 +581,8 @@
}
TEST_F(TrackedObjectsTest, LifeCycleToValueWorkerThread) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
// Don't initialize thread, so that we appear as a worker thread.
@@ -662,7 +673,8 @@
}
TEST_F(TrackedObjectsTest, TwoLives) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
// Use a well named thread.
@@ -727,7 +739,8 @@
}
TEST_F(TrackedObjectsTest, DifferentLives) {
- if (!ThreadData::InitializeAndSetTrackingStatus(true))
+ if (!ThreadData::InitializeAndSetTrackingStatus(
+ ThreadData::PROFILING_CHILDREN_ACTIVE))
return;
// Use a well named thread.
« 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