| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var SourceEntry = (function() { | 5 var SourceEntry = (function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * A SourceEntry gathers all log entries with the same source. | 9 * A SourceEntry gathers all log entries with the same source. |
| 10 * | 10 * |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 isError: function() { | 192 isError: function() { |
| 193 return this.isError_; | 193 return this.isError_; |
| 194 }, | 194 }, |
| 195 | 195 |
| 196 /** | 196 /** |
| 197 * Returns time of last event if inactive. Returns current time otherwise. | 197 * Returns time of last event if inactive. Returns current time otherwise. |
| 198 */ | 198 */ |
| 199 getEndTime: function() { | 199 getEndTime: function() { |
| 200 if (!this.isInactive_) { | 200 if (!this.isInactive_) { |
| 201 return (new Date()).getTime(); | 201 return timeutil.getCurrentTime(); |
| 202 } else { | 202 } else { |
| 203 var endTicks = this.entries_[this.entries_.length - 1].time; | 203 var endTicks = this.entries_[this.entries_.length - 1].time; |
| 204 return timeutil.convertTimeTicksToDate(endTicks).getTime(); | 204 return timeutil.convertTimeTicksToDate(endTicks).getTime(); |
| 205 } | 205 } |
| 206 }, | 206 }, |
| 207 | 207 |
| 208 /** | 208 /** |
| 209 * Returns the time between the first and last events with a matching | 209 * Returns the time between the first and last events with a matching |
| 210 * source ID. If source is still active, uses the current time for the | 210 * source ID. If source is still active, uses the current time for the |
| 211 * last event. | 211 * last event. |
| 212 */ | 212 */ |
| 213 getDuration: function() { | 213 getDuration: function() { |
| 214 var startTicks = this.entries_[0].time; | 214 var startTicks = this.entries_[0].time; |
| 215 var startTime = timeutil.convertTimeTicksToDate(startTicks).getTime(); | 215 var startTime = timeutil.convertTimeTicksToDate(startTicks).getTime(); |
| 216 var endTime = this.getEndTime(); | 216 var endTime = this.getEndTime(); |
| 217 return endTime - startTime; | 217 return endTime - startTime; |
| 218 }, | 218 }, |
| 219 | 219 |
| 220 printAsText: function() { | 220 printAsText: function() { |
| 221 return PrintSourceEntriesAsText(this.entries_); | 221 return PrintSourceEntriesAsText(this.entries_); |
| 222 } | 222 } |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 return SourceEntry; | 225 return SourceEntry; |
| 226 })(); | 226 })(); |
| OLD | NEW |