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

Side by Side Diff: tracing/tracing/base/math/range.html

Issue 2955053002: Remove tr.b.identity. (Closed)
Patch Set: Created 3 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. 3 Copyright (c) 2014 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/iteration_helpers.html"> 9 <link rel="import" href="/tracing/base/iteration_helpers.html">
10 <link rel="import" href="/tracing/base/math/math.html"> 10 <link rel="import" href="/tracing/base/math/math.html">
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 const i = Math.trunc((i0 + i1) / 2); 216 const i = Math.trunc((i0 + i1) / 2);
217 if (test(i)) { 217 if (test(i)) {
218 i1 = i; // Explore the left branch. 218 i1 = i; // Explore the left branch.
219 } else { 219 } else {
220 i0 = i + 1; // Explore the right branch. 220 i0 = i + 1; // Explore the right branch.
221 } 221 }
222 } 222 }
223 return i1; 223 return i1;
224 } 224 }
225 225
226 const keyFunc = opt_keyFunc || tr.b.identity; 226 const keyFunc = opt_keyFunc || (x => x);
227 function getValue(index) { 227 function getValue(index) {
228 return keyFunc.call(opt_this, array[index]); 228 return keyFunc.call(opt_this, array[index]);
229 } 229 }
230 230
231 const first = binSearch(function(i) { 231 const first = binSearch(function(i) {
232 return this.min_ === undefined || this.min_ <= getValue(i); 232 return this.min_ === undefined || this.min_ <= getValue(i);
233 }.bind(this)); 233 }.bind(this));
234 const last = binSearch(function(i) { 234 const last = binSearch(function(i) {
235 return this.max_ !== undefined && this.max_ < getValue(i); 235 return this.max_ !== undefined && this.max_ < getValue(i);
236 }.bind(this)); 236 }.bind(this));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 }; 316 };
317 317
318 Range.PERCENT_RANGE = Range.fromExplicitRange(0, 1); 318 Range.PERCENT_RANGE = Range.fromExplicitRange(0, 1);
319 Object.freeze(Range.PERCENT_RANGE); 319 Object.freeze(Range.PERCENT_RANGE);
320 320
321 return { 321 return {
322 Range, 322 Range,
323 }; 323 };
324 }); 324 });
325 </script> 325 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/base/iteration_helpers_test.html ('k') | tracing/tracing/base/math/statistics.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698