summaryrefslogtreecommitdiffstats
path: root/base/message_loop.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 21:11:06 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-28 21:11:06 +0000
commitf15841fb802ccfd27e9fd914734e38f64e6b880d (patch)
treef9c670ccb8665db7f327b2ab7f9cd5157426100f /base/message_loop.h
parentfad8296611231b3efca90eeb6708fd3036c04cbd (diff)
downloadchromium_src-f15841fb802ccfd27e9fd914734e38f64e6b880d.zip
chromium_src-f15841fb802ccfd27e9fd914734e38f64e6b880d.tar.gz
chromium_src-f15841fb802ccfd27e9fd914734e38f64e6b880d.tar.bz2
Fully enable about:tracking by default
Support is now controlled by the flag: --enable-tracking and the default is always on. To turn it off, use: --enable-tracking=0 All profiler code is compiled now in release and official builds (in addition to debug, where it was already active), but most entry points can be disabled (turned into no-ops) by a single const bool setting atop tracked_objects.cc (in case folks want to revert the perf-impact of this change). Transition to faster Now() service on Windows for the profiler use only. The TimeTicks::Now() function on Window uses locking to get a 64 bit time value. This CL transitions times used for profiling to more directly use a 32 bit Time interface, which is actually what drives the 64 bit TimeTicks. By using the smaller value, we avoid the need for locks, or even atomic operations for the most part in the tracking system. On linux, we just down-sample the standard TimeTicks to 32 bits for consistency (clean ability to snapshot asyncronously without atomics... but I should verify that such is helpful to performance). I've also put in yet more cleanup and refactoring. r=rtenneti bug=101856 Review URL: http://codereview.chromium.org/8391019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107793 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop.h')
-rw-r--r--base/message_loop.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/base/message_loop.h b/base/message_loop.h
index 732de03..aa7449f 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -44,11 +44,9 @@ namespace base {
class Histogram;
}
-#if defined(TRACK_ALL_TASK_OBJECTS)
namespace tracked_objects {
class Births;
}
-#endif // defined(TRACK_ALL_TASK_OBJECTS)
// A MessageLoop is used to process events for a particular thread. There is
// at most one MessageLoop instance per thread.
@@ -377,6 +375,22 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate {
}
#endif // OS_WIN
+ // This structure is copied around by value.
+ struct TrackingInfo {
+ TrackingInfo(const tracked_objects::Location& posted_from,
+ base::TimeTicks delayed_run_time);
+ ~TrackingInfo();
+
+ // Counter for location where the Closure was posted from.
+ tracked_objects::Births* birth_tally;
+
+ // Time this PendingTask was posted.
+ base::TimeTicks time_posted;
+
+ // The time when the task should be run.
+ base::TimeTicks delayed_run_time;
+ };
+
//----------------------------------------------------------------------------
protected:
struct RunState {
@@ -410,7 +424,7 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate {
#endif
// This structure is copied around by value.
- struct PendingTask {
+ struct PendingTask : public TrackingInfo {
PendingTask(const base::Closure& task,
const tracked_objects::Location& posted_from,
base::TimeTicks delayed_run_time,
@@ -423,17 +437,6 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate {
// The task to run.
base::Closure task;
-#if defined(TRACK_ALL_TASK_OBJECTS)
- // Counter for location where the Closure was posted from.
- tracked_objects::Births* post_births;
-#endif // defined(TRACK_ALL_TASK_OBJECTS)
-
- // Time this PendingTask was posted.
- base::TimeTicks time_posted;
-
- // The time when the task should be run.
- base::TimeTicks delayed_run_time;
-
// The site this PendingTask was posted from.
tracked_objects::Location posted_from;