3 Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
7 <link rel="import" href="/tvcm.html">
11 tvcm.exportTo('tracing', function() {
13 * @constructor The generic base class for filtering a TraceModel based on
14 * various rules. The base class returns true for everything.
19 __proto__: Object.prototype,
21 matchCounter: function(counter) {
25 matchCpu: function(cpu) {
29 matchProcess: function(process) {
33 matchSlice: function(slice) {
37 matchThread: function(thread) {
43 * @constructor A filter that matches objects by their name case insensitive.
44 * .findAllObjectsMatchingFilter
46 function TitleFilter(text) {
48 this.text_ = text.toLowerCase();
51 throw new Error('Filter text is empty.');
53 TitleFilter.prototype = {
54 __proto__: Filter.prototype,
56 matchSlice: function(slice) {
57 if (slice.title === undefined)
59 return slice.title.toLowerCase().indexOf(this.text_) !== -1;
64 * @constructor A filter that matches objects with the exact given title.
66 function ExactTitleFilter(text) {
71 throw new Error('Filter text is empty.');
73 ExactTitleFilter.prototype = {
74 __proto__: Filter.prototype,
76 matchSlice: function(slice) {
77 return slice.title === this.text_;
82 TitleFilter: TitleFilter,
83 ExactTitleFilter: ExactTitleFilter