Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | // This is a simple struct with tracking information that is stored |
michael@0 | 6 | // with a PendingTask (when message_loop is handling the task). |
michael@0 | 7 | // Only the information that is shared with the profiler in tracked_objects |
michael@0 | 8 | // are included in this structure. |
michael@0 | 9 | |
michael@0 | 10 | |
michael@0 | 11 | #ifndef BASE_TRACKING_INFO_H_ |
michael@0 | 12 | #define BASE_TRACKING_INFO_H_ |
michael@0 | 13 | |
michael@0 | 14 | #include "base/base_export.h" |
michael@0 | 15 | #include "base/profiler/tracked_time.h" |
michael@0 | 16 | #include "base/time/time.h" |
michael@0 | 17 | |
michael@0 | 18 | namespace tracked_objects { |
michael@0 | 19 | class Location; |
michael@0 | 20 | class Births; |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | namespace base { |
michael@0 | 24 | |
michael@0 | 25 | // This structure is copied around by value. |
michael@0 | 26 | struct BASE_EXPORT TrackingInfo { |
michael@0 | 27 | TrackingInfo(); |
michael@0 | 28 | TrackingInfo(const tracked_objects::Location& posted_from, |
michael@0 | 29 | base::TimeTicks delayed_run_time); |
michael@0 | 30 | ~TrackingInfo(); |
michael@0 | 31 | |
michael@0 | 32 | // To avoid conflating our stats with the delay duration in a PostDelayedTask, |
michael@0 | 33 | // we identify such tasks, and replace their post_time with the time they |
michael@0 | 34 | // were scheduled (requested?) to emerge from the delayed task queue. This |
michael@0 | 35 | // means that queuing delay for such tasks will show how long they went |
michael@0 | 36 | // unserviced, after they *could* be serviced. This is the same stat as we |
michael@0 | 37 | // have for non-delayed tasks, and we consistently call it queuing delay. |
michael@0 | 38 | tracked_objects::TrackedTime EffectiveTimePosted() const { |
michael@0 | 39 | return tracked_objects::TrackedTime( |
michael@0 | 40 | delayed_run_time.is_null() ? time_posted : delayed_run_time); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | // Record of location and thread that the task came from. |
michael@0 | 44 | tracked_objects::Births* birth_tally; |
michael@0 | 45 | |
michael@0 | 46 | // Time when the related task was posted. |
michael@0 | 47 | base::TimeTicks time_posted; |
michael@0 | 48 | |
michael@0 | 49 | // The time when the task should be run. |
michael@0 | 50 | base::TimeTicks delayed_run_time; |
michael@0 | 51 | }; |
michael@0 | 52 | |
michael@0 | 53 | } // namespace base |
michael@0 | 54 | |
michael@0 | 55 | #endif // BASE_TRACKING_INFO_H_ |