blob: 254c2f22676b926982962e2e5c1c7e47a4276328 [file] [log] [blame]
Chris Craikb122baf2015-03-05 13:58:42 -08001<!DOCTYPE html>
2<!--
3Copyright (c) 2015 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="/base/base.html">
9
10<script>
11'use strict';
12
13/**
14 * @fileoverview Provides the base class for all container classes.
15 */
16tv.exportTo('tv.c.trace_model', function() {
17 function EventContainer() {
Chris Craik19832152015-04-16 15:43:38 -070018 this.important = true;
Chris Craik44c28202015-05-12 17:25:16 -070019 this.bounds = undefined;
Chris Craikb122baf2015-03-05 13:58:42 -080020 }
21
22 EventContainer.prototype = {
23 /*
24 * @return {String} An identifier that is made up of this parent's
25 * stableIdentifier plus this countainer identifier.
26 */
27 get stableId() {
28 throw new Error('Not implemented');
Chris Craik44c28202015-05-12 17:25:16 -070029 },
30
31 updateBounds: function() {
32 throw new Error('Not implemented');
33 },
34
35 shiftTimestampsForward: function(amount) {
36 throw new Error('Not implemented');
37 },
38
39 iterateAllEventsInThisContainer: function(eventTypePredicate,
40 callback, opt_this) {
41 throw new Error('Not implemented');
42 },
43
44 iterateAllChildEventContainers: function(callback, opt_this) {
45 throw new Error('Not implemented');
46 },
47
48 /**
49 * Iterates all events in the model and calls callback on each event.
50 * @param {function(event)} callback The callback called for every event.
51 */
52 iterateAllEvents: function(callback, opt_this) {
53 this.iterateAllEventContainers(function(ec) {
54 ec.iterateAllEventsInThisContainer(
55 function(eventType) { return true; },
56 callback, opt_this);
57 });
58 },
59
60 iterateAllEventContainers: function(callback, opt_this) {
61 function visit(ec) {
62 callback.call(opt_this, ec);
63 ec.iterateAllChildEventContainers(visit);
64 }
65 visit(this);
Chris Craikb122baf2015-03-05 13:58:42 -080066 }
67 };
68
69 return {
70 EventContainer: EventContainer
71 };
72});
73</script>