diff options
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_duration.html')
-rw-r--r-- | chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_duration.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_duration.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_duration.html new file mode 100644 index 00000000000..ab5828e2dda --- /dev/null +++ b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_duration.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<!-- +Copyright 2015 The Chromium Authors. All rights reserved. +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<link rel="import" href="/tracing/core/scripting_controller.html"> +<link rel="import" href="/tracing/extras/tquery/filter.html"> + +<script> +'use strict'; + +tr.exportTo('tr.e.tquery', function() { + function FilterHasDuration(minValueOrExpected, opt_maxValue) { + if (minValueOrExpected !== undefined && opt_maxValue !== undefined) { + this.minValue = minValueOrExpected; + this.maxValue = opt_maxValue; + } else { + this.expected = minValueOrExpected; + } + } + + FilterHasDuration.prototype = { + __proto__: tr.e.tquery.Filter.prototype, + + evaluate(context) { + if (context.event.duration === undefined) return false; + if (this.minValue !== undefined && this.maxValue !== undefined) { + return context.event.duration >= this.minValue && + context.event.duration <= this.maxValue; + } + return this.matchValue_(context.event.duration, this.expected); + } + }; + tr.c.ScriptingObjectRegistry.register( + function(minValueOrExpected, opt_maxValue) { + return new FilterHasDuration(minValueOrExpected, opt_maxValue); + }, + { + name: 'hasDuration' + } + ); + return { + FilterHasDuration, + }; +}); +</script> |