1<!DOCTYPE html> 2<!-- 3Copyright 2016 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7 8<link rel="import" href="/tracing/core/scripting_controller.html"> 9<link rel="import" href="/tracing/extras/tquery/filter.html"> 10 11<script> 12'use strict'; 13 14tr.exportTo('tr.e.tquery', function() { 15 function FilterNot(subExpression) { 16 tr.e.tquery.Filter.call(this); 17 this.subExpression = subExpression; 18 } 19 20 FilterNot.prototype = { 21 __proto__: tr.e.tquery.Filter.prototype, 22 23 set subExpression(expr) { 24 this.subExpression_ = tr.e.tquery.Filter.normalizeFilterExpression(expr); 25 }, 26 27 get subExpression() { 28 return this.subExpression_; 29 }, 30 31 evaluate: function(context) { 32 return !this.subExpression.evaluate(context); 33 } 34 }; 35 tr.c.ScriptingObjectRegistry.register( 36 function() { 37 var exprs = Array.prototype.slice.call(arguments); 38 if (exprs.length !== 1) 39 throw new Error('not() must have exactly one subexpression'); 40 return new FilterNot(exprs[0]); 41 }, 42 { 43 name: 'not' 44 } 45 ); 46 return { 47 FilterNot: FilterNot 48 }; 49}); 50</script> 51