OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 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/base.html"> | 8 <link rel="import" href="/tracing/base/base.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/range.html"> | 10 <link rel="import" href="/tracing/base/range.html"> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 */ | 76 */ |
77 childEvents: function* () { | 77 childEvents: function* () { |
78 }, | 78 }, |
79 | 79 |
80 /** | 80 /** |
81 * Returns an iterable of all events in this and descendant | 81 * Returns an iterable of all events in this and descendant |
82 * event containers. | 82 * event containers. |
83 */ | 83 */ |
84 getDescendantEvents: function* () { | 84 getDescendantEvents: function* () { |
85 yield* this.childEvents(); | 85 yield* this.childEvents(); |
86 for (var container of this.childEventContainers()) | 86 for (var container of this.childEventContainers()) { |
87 yield* container.getDescendantEvents(); | 87 yield* container.getDescendantEvents(); |
| 88 } |
88 }, | 89 }, |
89 | 90 |
90 /** | 91 /** |
91 * Returns an iterable of all child event containers. | 92 * Returns an iterable of all child event containers. |
92 */ | 93 */ |
93 childEventContainers: function* () { | 94 childEventContainers: function* () { |
94 }, | 95 }, |
95 | 96 |
96 /** | 97 /** |
97 * Returns an iterable containing this and all descendant event containers. | 98 * Returns an iterable containing this and all descendant event containers. |
98 */ | 99 */ |
99 getDescendantEventContainers: function* () { | 100 getDescendantEventContainers: function* () { |
100 yield this; | 101 yield this; |
101 for (var container of this.childEventContainers()) | 102 for (var container of this.childEventContainers()) { |
102 yield* container.getDescendantEventContainers(); | 103 yield* container.getDescendantEventContainers(); |
| 104 } |
103 }, | 105 }, |
104 | 106 |
105 /** | 107 /** |
106 * Finds topmost slices in this container (see docstring for | 108 * Finds topmost slices in this container (see docstring for |
107 * findTopmostSlices). | 109 * findTopmostSlices). |
108 */ | 110 */ |
109 findTopmostSlicesInThisContainer: function* (eventPredicate, opt_this) { | 111 findTopmostSlicesInThisContainer: function* (eventPredicate, opt_this) { |
110 }, | 112 }, |
111 | 113 |
112 /** | 114 /** |
113 * The findTopmostSlices* series of helpers find all topmost slices | 115 * The findTopmostSlices* series of helpers find all topmost slices |
114 * satisfying the given predicates. | 116 * satisfying the given predicates. |
115 * | 117 * |
116 * As an example, suppose we are trying to find slices named 'C', with the | 118 * As an example, suppose we are trying to find slices named 'C', with the |
117 * following thread: | 119 * following thread: |
118 * | 120 * |
119 * -> |---C---| |-----D-----| | 121 * -> |---C---| |-----D-----| |
120 * |-C-| |---C---| <- | 122 * |-C-| |---C---| <- |
121 * | 123 * |
122 * findTopmostSlices would locate the pointed-to Cs, because the bottom C on | 124 * findTopmostSlices would locate the pointed-to Cs, because the bottom C on |
123 * the left is not the topmost C, and the right one is, even though it is | 125 * the left is not the topmost C, and the right one is, even though it is |
124 * not itself a top-level slice. | 126 * not itself a top-level slice. |
125 */ | 127 */ |
126 findTopmostSlices: function* (eventPredicate) { | 128 findTopmostSlices: function* (eventPredicate) { |
127 for (var ec of this.getDescendantEventContainers()) | 129 for (var ec of this.getDescendantEventContainers()) { |
128 yield* ec.findTopmostSlicesInThisContainer(eventPredicate); | 130 yield* ec.findTopmostSlicesInThisContainer(eventPredicate); |
| 131 } |
129 }, | 132 }, |
130 | 133 |
131 findTopmostSlicesNamed: function* (name) { | 134 findTopmostSlicesNamed: function* (name) { |
132 yield* this.findTopmostSlices(e => e.title === name); | 135 yield* this.findTopmostSlices(e => e.title === name); |
133 } | 136 } |
134 }; | 137 }; |
135 | 138 |
136 return { | 139 return { |
137 EventContainer, | 140 EventContainer, |
138 }; | 141 }; |
139 }); | 142 }); |
140 </script> | 143 </script> |
OLD | NEW |