OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2013 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/color_scheme.html"> | 8 <link rel="import" href="/tracing/base/color_scheme.html"> |
9 <link rel="import" href="/tracing/ui/base/draw_helpers.html"> | 9 <link rel="import" href="/tracing/ui/base/draw_helpers.html"> |
10 <link rel="import" href="/tracing/ui/base/ui.html"> | 10 <link rel="import" href="/tracing/ui/base/ui.html"> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 * of |times|. | 52 * of |times|. |
53 * | 53 * |
54 * @returns {!Array.<tr.b.math.Range>} An array of ranges where each element | 54 * @returns {!Array.<tr.b.math.Range>} An array of ranges where each element |
55 * represents the time range that a stripe covers. Each range is a subset | 55 * represents the time range that a stripe covers. Each range is a subset |
56 * of the interval [minTime, maxTime]. | 56 * of the interval [minTime, maxTime]. |
57 */ | 57 */ |
58 ModelTrack.generateStripes_ = function(times, minTime, maxTime) { | 58 ModelTrack.generateStripes_ = function(times, minTime, maxTime) { |
59 if (times.length === 0) return []; | 59 if (times.length === 0) return []; |
60 | 60 |
61 // Find the lowest and highest index within the viewport. | 61 // Find the lowest and highest index within the viewport. |
62 const lowIndex = | 62 const lowIndex = tr.b.math.findLowIndexInSortedArray( |
63 tr.b.math.findLowIndexInSortedArray(times, tr.b.identity, minTime); | 63 times, (x => x), minTime); |
64 let highIndex = lowIndex - 1; | 64 let highIndex = lowIndex - 1; |
65 while (times[highIndex + 1] <= maxTime) { | 65 while (times[highIndex + 1] <= maxTime) { |
66 highIndex++; | 66 highIndex++; |
67 } | 67 } |
68 | 68 |
69 const stripes = []; | 69 const stripes = []; |
70 // Must start at an even index and end at an odd index. | 70 // Must start at an even index and end at an odd index. |
71 for (let i = lowIndex - (lowIndex % 2); i <= highIndex; i += 2) { | 71 for (let i = lowIndex - (lowIndex % 2); i <= highIndex; i += 2) { |
72 const left = i < lowIndex ? minTime : times[i]; | 72 const left = i < lowIndex ? minTime : times[i]; |
73 const right = i + 1 > highIndex ? maxTime : times[i + 1]; | 73 const right = i + 1 > highIndex ? maxTime : times[i + 1]; |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 tr.ui.tracks.ContainerTrack.prototype.addClosestEventToSelection. | 511 tr.ui.tracks.ContainerTrack.prototype.addClosestEventToSelection. |
512 apply(this, arguments); | 512 apply(this, arguments); |
513 } | 513 } |
514 }; | 514 }; |
515 | 515 |
516 return { | 516 return { |
517 ModelTrack, | 517 ModelTrack, |
518 }; | 518 }; |
519 }); | 519 }); |
520 </script> | 520 </script> |
OLD | NEW |