aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/time.rs
diff options
context:
space:
mode:
authorTimothy B. Terriberry <5uqwzarday@snkmail.com>2014-12-04 21:33:21 -0800
committerTimothy B. Terriberry <tterribe@xiph.org>2014-12-05 14:23:27 -0800
commit65575bf8a7c97ea71dc760c3c5aed37f431d1f3c (patch)
tree9843da91efb3a36b48f36b0dc237c9e6f870f98e /components/util/time.rs
parentb8444f96f82791d7bbac456dfe23b71b2b09fea3 (diff)
downloadservo-65575bf8a7c97ea71dc760c3c5aed37f431d1f3c.tar.gz
servo-65575bf8a7c97ea71dc760c3c5aed37f431d1f3c.zip
Change time::profile's meta booleans to enums.
This makes these parameters self-documenting. This patch does not attempt to push those enums into the data structures that feed calls to this function. Fixes #4158.
Diffstat (limited to 'components/util/time.rs')
-rw-r--r--components/util/time.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/components/util/time.rs b/components/util/time.rs
index 6c244caf141..4fdc23b023d 100644
--- a/components/util/time.rs
+++ b/components/util/time.rs
@@ -246,10 +246,20 @@ impl TimeProfiler {
}
}
+#[deriving(Eq, PartialEq)]
+pub enum TimerMetadataFrameType {
+ TimeRootWindow,
+ TimeIFrame,
+}
+
+#[deriving(Eq, PartialEq)]
+pub enum TimerMetadataReflowType {
+ TimeIncremental,
+ TimeFirstReflow,
+}
pub fn profile<T>(category: TimeProfilerCategory,
- // url, iframe?, first reflow?
- meta: Option<(&Url, bool, bool)>,
+ meta: Option<(&Url, TimerMetadataFrameType, TimerMetadataReflowType)>,
time_profiler_chan: TimeProfilerChan,
callback: || -> T)
-> T {
@@ -257,11 +267,11 @@ pub fn profile<T>(category: TimeProfilerCategory,
let val = callback();
let end_time = precise_time_ns();
let ms = (end_time - start_time) as f64 / 1000000f64;
- let meta = meta.map(|(url, iframe, first_reflow)|
+ let meta = meta.map(|(url, iframe, reflow_type)|
TimerMetadata {
url: url.serialize(),
- iframe: iframe,
- incremental: !first_reflow,
+ iframe: iframe == TimeIFrame,
+ incremental: reflow_type == TimeIncremental,
});
time_profiler_chan.send(TimeMsg((category, meta), ms));
return val;