| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/base/event.html"> | 8 <link rel="import" href="/tracing/base/event.html"> |
| 9 <link rel="import" href="/tracing/base/guid.html"> | 9 <link rel="import" href="/tracing/base/guid.html"> |
| 10 <link rel="import" href="/tracing/base/iteration_helpers.html"> | 10 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
| 11 <link rel="import" href="/tracing/base/range.html"> | 11 <link rel="import" href="/tracing/base/math/range.html"> |
| 12 <link rel="import" href="/tracing/model/event_registry.html"> | 12 <link rel="import" href="/tracing/model/event_registry.html"> |
| 13 | 13 |
| 14 <script> | 14 <script> |
| 15 'use strict'; | 15 'use strict'; |
| 16 | 16 |
| 17 tr.exportTo('tr.model', function() { | 17 tr.exportTo('tr.model', function() { |
| 18 var EventRegistry = tr.model.EventRegistry; | 18 var EventRegistry = tr.model.EventRegistry; |
| 19 | 19 |
| 20 var RequestSelectionChangeEvent = tr.b.Event.bind( | 20 var RequestSelectionChangeEvent = tr.b.Event.bind( |
| 21 undefined, 'requestSelectionChange', true, false); | 21 undefined, 'requestSelectionChange', true, false); |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Represents a event set within a and its associated set of tracks. | 24 * Represents a event set within a and its associated set of tracks. |
| 25 * @constructor | 25 * @constructor |
| 26 */ | 26 */ |
| 27 function EventSet(opt_events) { | 27 function EventSet(opt_events) { |
| 28 this.bounds_ = new tr.b.Range(); | 28 this.bounds_ = new tr.b.math.Range(); |
| 29 this.events_ = new Set(); | 29 this.events_ = new Set(); |
| 30 this.guid_ = tr.b.GUID.allocateSimple(); | 30 this.guid_ = tr.b.GUID.allocateSimple(); |
| 31 | 31 |
| 32 if (opt_events) { | 32 if (opt_events) { |
| 33 if (opt_events instanceof Array) { | 33 if (opt_events instanceof Array) { |
| 34 for (var event of opt_events) | 34 for (var event of opt_events) |
| 35 this.push(event); | 35 this.push(event); |
| 36 } else if (opt_events instanceof EventSet) { | 36 } else if (opt_events instanceof EventSet) { |
| 37 this.addEventSet(opt_events); | 37 this.addEventSet(opt_events); |
| 38 } else { | 38 } else { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 61 get guid() { | 61 get guid() { |
| 62 return this.guid_; | 62 return this.guid_; |
| 63 }, | 63 }, |
| 64 | 64 |
| 65 * [Symbol.iterator]() { | 65 * [Symbol.iterator]() { |
| 66 for (var event of this.events_) | 66 for (var event of this.events_) |
| 67 yield event; | 67 yield event; |
| 68 }, | 68 }, |
| 69 | 69 |
| 70 clear: function() { | 70 clear: function() { |
| 71 this.bounds_ = new tr.b.Range(); | 71 this.bounds_ = new tr.b.math.Range(); |
| 72 this.events_.clear(); | 72 this.events_.clear(); |
| 73 }, | 73 }, |
| 74 | 74 |
| 75 /** | 75 /** |
| 76 * Pushes each argument onto the EventSet. Returns the number of | 76 * Pushes each argument onto the EventSet. Returns the number of |
| 77 * arguments pushed. | 77 * arguments pushed. |
| 78 */ | 78 */ |
| 79 push: function(...events) { | 79 push: function(...events) { |
| 80 var numPushed; | 80 var numPushed; |
| 81 for (var event of events) { | 81 for (var event of events) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 Object.freeze(s); | 271 Object.freeze(s); |
| 272 return s; | 272 return s; |
| 273 })(); | 273 })(); |
| 274 | 274 |
| 275 return { | 275 return { |
| 276 EventSet, | 276 EventSet, |
| 277 RequestSelectionChangeEvent, | 277 RequestSelectionChangeEvent, |
| 278 }; | 278 }; |
| 279 }); | 279 }); |
| 280 </script> | 280 </script> |
| OLD | NEW |