| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <link rel="import" href="/core/trace_model/timed_event.html"> |
| <link rel="import" href="/core/analysis/util.html"> |
| |
| <script> |
| 'use strict'; |
| |
| /** |
| * @fileoverview Provides the InstantEvent class. |
| */ |
| tv.exportTo('tv.c.trace_model', function() { |
| var InstantEventType = { |
| GLOBAL: 1, |
| PROCESS: 2 |
| }; |
| |
| function InstantEvent(category, title, colorId, start, args) { |
| tv.c.trace_model.TimedEvent.call(this); |
| |
| this.category = category || ''; |
| this.title = title; |
| this.colorId = colorId; |
| this.start = start; |
| this.args = args; |
| |
| this.type = undefined; |
| }; |
| |
| InstantEvent.prototype = { |
| __proto__: tv.c.trace_model.TimedEvent.prototype |
| }; |
| |
| function GlobalInstantEvent(category, title, colorId, start, args) { |
| InstantEvent.apply(this, arguments); |
| this.type = InstantEventType.GLOBAL; |
| }; |
| |
| GlobalInstantEvent.prototype = { |
| __proto__: InstantEvent.prototype, |
| get userFriendlyName() { |
| return 'Global instant event ' + this.title + ' @ ' + |
| this.tsString(start); |
| } |
| }; |
| |
| function ProcessInstantEvent(category, title, colorId, start, args) { |
| InstantEvent.apply(this, arguments); |
| this.type = InstantEventType.PROCESS; |
| }; |
| |
| ProcessInstantEvent.prototype = { |
| __proto__: InstantEvent.prototype, |
| |
| get userFriendlyName() { |
| return 'Process-level instant event ' + this.title + ' @ ' + |
| this.tsString(start); |
| } |
| }; |
| |
| tv.c.trace_model.EventRegistry.register( |
| InstantEvent, |
| { |
| name: 'instantEvent', |
| pluralName: 'instantEvents', |
| singleViewElementName: 'tv-c-single-instant-event-sub-view', |
| multiViewElementName: 'tv-c-multi-instant-event-sub-view' |
| }); |
| |
| return { |
| GlobalInstantEvent: GlobalInstantEvent, |
| ProcessInstantEvent: ProcessInstantEvent, |
| |
| InstantEventType: InstantEventType, |
| InstantEvent: InstantEvent |
| }; |
| }); |
| </script> |
| |