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

Unified Diff: base/tracked_objects.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.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
===================================================================
--- base/tracked_objects.cc (revision 120576)
+++ base/tracked_objects.cc (working copy)
@@ -393,7 +393,7 @@
if (!kTrackAllTaskObjects)
return NULL; // Not compiled in.
- if (!tracking_status())
+ if (!TrackingStatus())
return NULL;
ThreadData* current_thread_data = Get();
if (!current_thread_data)
@@ -622,28 +622,31 @@
}
// static
-bool ThreadData::InitializeAndSetTrackingStatus(bool status) {
+bool ThreadData::InitializeAndSetTrackingStatus(Status status) {
+ DCHECK_GE(status, DEACTIVATED);
+ DCHECK_LE(status, PROFILING_CHILDREN_ACTIVE);
+
if (!Initialize()) // No-op if already initialized.
return false; // Not compiled in.
- if (!status) {
- status_ = DEACTIVATED;
- } else {
- if (kTrackParentChildLinks)
- status_ = PROFILING_CHILDREN_ACTIVE;
- else
- status_ = PROFILING_ACTIVE;
- }
+ if (!kTrackParentChildLinks && status > DEACTIVATED)
+ status = PROFILING_ACTIVE;
+ status_ = status;
return true;
}
// static
-bool ThreadData::tracking_status() {
+ThreadData::Status ThreadData::status() {
+ return status_;
+}
+
+// static
+bool ThreadData::TrackingStatus() {
return status_ > DEACTIVATED;
}
// static
-bool ThreadData::tracking_parent_child_status() {
+bool ThreadData::TrackingParentChildStatus() {
return status_ >= PROFILING_CHILDREN_ACTIVE;
}
@@ -664,7 +667,7 @@
// static
TrackedTime ThreadData::Now() {
- if (kTrackAllTaskObjects && tracking_status())
+ if (kTrackAllTaskObjects && TrackingStatus())
return TrackedTime::Now();
return TrackedTime(); // Super fast when disabled, or not compiled.
}
@@ -686,7 +689,7 @@
// 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(false))
+ if (!InitializeAndSetTrackingStatus(DEACTIVATED))
return;
ThreadData* thread_data_list;
{
« 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