OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * LogGroupEntry is a wrapper around log entries, which makes it easier to | 7 * LogGroupEntry is a wrapper around log entries, which makes it easier to |
8 * find the corresponding start/end of events. | 8 * find the corresponding start/end of events. |
9 * | 9 * |
10 * This is used internally by the log and timeline views to pretty print | 10 * This is used internally by the log and timeline views to pretty print |
11 * collections of log entries. | 11 * collections of log entries. |
12 */ | 12 */ |
13 | 13 |
14 // TODO(eroman): document these methods! | 14 // TODO(eroman): document these methods! |
15 | 15 |
16 var LogGroupEntry = (function() { | 16 var LogGroupEntry = (function() { |
17 'use strict'; | 17 'use strict'; |
18 | 18 |
19 function LogGroupEntry(origEntry, index) { | 19 function LogGroupEntry(origEntry, index) { |
20 this.orig = origEntry; | 20 this.orig = origEntry; |
21 this.index = index; | 21 this.index = index; |
22 } | 22 } |
23 | 23 |
24 LogGroupEntry.prototype = { | 24 LogGroupEntry.prototype = { |
25 isBegin: function() { | 25 isBegin: function() { |
26 return this.orig.phase == LogEventPhase.PHASE_BEGIN; | 26 return this.orig.phase == EventPhase.PHASE_BEGIN; |
27 }, | 27 }, |
28 | 28 |
29 isEnd: function() { | 29 isEnd: function() { |
30 return this.orig.phase == LogEventPhase.PHASE_END; | 30 return this.orig.phase == EventPhase.PHASE_END; |
31 }, | 31 }, |
32 | 32 |
33 getDepth: function() { | 33 getDepth: function() { |
34 var depth = 0; | 34 var depth = 0; |
35 var p = this.parentEntry; | 35 var p = this.parentEntry; |
36 while (p) { | 36 while (p) { |
37 depth += 1; | 37 depth += 1; |
38 p = p.parentEntry; | 38 p = p.parentEntry; |
39 } | 39 } |
40 return depth; | 40 return depth; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 if (groupEntry.isBegin()) | 93 if (groupEntry.isBegin()) |
94 parentStack.push(groupEntry); | 94 parentStack.push(groupEntry); |
95 } | 95 } |
96 | 96 |
97 return groupedEntries; | 97 return groupedEntries; |
98 }; | 98 }; |
99 | 99 |
100 return LogGroupEntry; | 100 return LogGroupEntry; |
101 })(); | 101 })(); |
OLD | NEW |