1<!DOCTYPE html> 2<!-- 3Copyright (c) 2014 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/base/guid.html"> 9<link rel="import" href="/tracing/model/event_set.html"> 10<link rel="import" href="/tracing/model/selectable_item.html"> 11<link rel="import" href="/tracing/model/selection_state.html"> 12 13<script> 14'use strict'; 15 16/** 17 * @fileoverview Provides the Event class. 18 */ 19tr.exportTo('tr.model', function() { 20 var SelectableItem = tr.model.SelectableItem; 21 var SelectionState = tr.model.SelectionState; 22 var IMMUTABLE_EMPTY_SET = tr.model.EventSet.IMMUTABLE_EMPTY_SET; 23 24 /** 25 * An Event is the base type for any non-container, selectable piece 26 * of data in the trace model. 27 * 28 * @constructor 29 * @extends {SelectableItem} 30 */ 31 function Event() { 32 SelectableItem.call(this, this /* modelItem */); 33 this.guid_ = tr.b.GUID.allocate(); 34 this.selectionState = SelectionState.NONE; 35 this.info = undefined; 36 } 37 38 Event.prototype = { 39 __proto__: SelectableItem.prototype, 40 41 get guid() { 42 return this.guid_; 43 }, 44 45 get stableId() { 46 return undefined; 47 }, 48 49 // Empty by default. Lazily initialized on an instance in 50 // addAssociatedAlert(). See #1930. 51 associatedAlerts: IMMUTABLE_EMPTY_SET, 52 53 addAssociatedAlert: function(alert) { 54 if (this.associatedAlerts === IMMUTABLE_EMPTY_SET) 55 this.associatedAlerts = new tr.model.EventSet(); 56 this.associatedAlerts.push(alert); 57 }, 58 59 /** Adds the range of timestamps for this event to the specified range. */ 60 addBoundsToRange: function(range) { 61 throw new Error('Not implemented'); 62 } 63 }; 64 65 return { 66 Event: Event 67 }; 68}); 69</script> 70