Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: chrome/browser/resources/media_internals/disjoint_range_set.js

Issue 7479005: Add charts to the resource data section of chrome://media-internals. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: camelCase. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 cr.define('media', function() { 5 cr.define('media', function() {
6 6
7 /** 7 /**
8 * This class represents a collection of non-intersecting ranges. Ranges 8 * This class represents a collection of non-intersecting ranges. Ranges
9 * specified by (start, end) can be added and removed at will. It is used to 9 * specified by (start, end) can be added and removed at will. It is used to
10 * record which sections of a media file have been cached, e.g. the first and 10 * record which sections of a media file have been cached, e.g. the first and
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 starts.sort(function(a, b) { 118 starts.sort(function(a, b) {
119 return a - b; 119 return a - b;
120 }); 120 });
121 121
122 var ranges = this.ranges_; 122 var ranges = this.ranges_;
123 var results = starts.map(function(s) { 123 var results = starts.map(function(s) {
124 return mapper(s, ranges[s]); 124 return mapper(s, ranges[s]);
125 }); 125 });
126 126
127 return results; 127 return results;
128 } 128 },
129
130 /**
131 * Finds the maximum value present in any of the contained ranges.
132 * @return {int} The maximum value contained by this DisjointRangeSet.
133 */
134 max: function() {
135 var max = -Infinity;
136 for (var start in this.ranges_)
137 max = Math.max(max, this.ranges_[start]);
138 return max;
139 },
129 }; 140 };
130 141
131 return { 142 return {
132 DisjointRangeSet: DisjointRangeSet 143 DisjointRangeSet: DisjointRangeSet
133 }; 144 };
134 }); 145 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698