1<!DOCTYPE html> 2<!-- 3Copyright 2016 The Chromium Authors. All righstart 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/base.html"> 9 10<script> 11'use strict'; 12 13tr.exportTo('tr.model', function() { 14 /** 15 * A record that indicates how times in one clock domain map to another. 16 * 17 * @constructor 18 * @param {string} syncId The ID of the clock sync used to find the 19 * corresponding marker in another trace. 20 * @param {string} start The timestamp the clock sync started. 21 * @param {object} args Any additional argument. 22 */ 23 function ClockSyncRecord(syncId, start, args) { 24 this.syncId_ = syncId; 25 this.start_ = start; 26 this.args_ = args; 27 }; 28 29 ClockSyncRecord.prototype = { 30 get syncId() { 31 return this.syncId_; 32 }, 33 34 get start() { 35 return this.start_; 36 }, 37 38 set start(value) { 39 this.start_ = value; 40 }, 41 42 get args() { 43 return this.args_; 44 } 45 }; 46 47 /** 48 * A clock sync record that is recorded instantaneously. 49 */ 50 function InstantClockSyncRecord(syncId, start, args) { 51 ClockSyncRecord.call(this, syncId, start, args); 52 }; 53 54 InstantClockSyncRecord.prototype = { 55 __proto__: ClockSyncRecord.prototype 56 }; 57 58 /** 59 * A clock sync record that requires an external call to record. 60 * 61 * This type of clock sync record needs to be treated differently because the 62 * clock sync could actually have been recorded any time in 63 * [start, start + duration]. 64 */ 65 function PingPongClockSyncRecord(syncId, start, duration, args) { 66 ClockSyncRecord.call(this, syncId, start, args); 67 this.duration_ = duration; 68 }; 69 70 PingPongClockSyncRecord.prototype = { 71 __proto__: ClockSyncRecord.prototype, 72 73 get duration() { 74 return this.duration_; 75 }, 76 77 set duration(value) { 78 this.duration_ = value; 79 }, 80 }; 81 82 return { 83 InstantClockSyncRecord: InstantClockSyncRecord, 84 PingPongClockSyncRecord: PingPongClockSyncRecord 85 }; 86}); 87</script> 88