summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_title.html
blob: b636da1772659fa2074a5b92daaf38488f59cf41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!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 FilterHasTitle(expected) {
    tr.e.tquery.Filter.call(this);
    this.expected = expected;
  }

  FilterHasTitle.prototype = {
    __proto__: tr.e.tquery.Filter.prototype,

    evaluate: function(context) {
      return this.matchValue_(context.event.title, this.expected);
    }
  };
  tr.c.ScriptingObjectRegistry.register(
      function(expected) {
        var filter = new tr.e.tquery.FilterHasTitle(expected);
        return filter;
      },
      {
        name: 'hasTitle'
      }
  );

  return {
    FilterHasTitle: FilterHasTitle
  };
});
</script>