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

Unified Diff: Source/devtools/front_end/MemoryStatistics.js

Issue 18828002: DevTools: Replace binarySearch with lowerBound and upperBound functions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaseline Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/DefaultTextEditor.js ('k') | Source/devtools/front_end/externs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/MemoryStatistics.js
diff --git a/Source/devtools/front_end/MemoryStatistics.js b/Source/devtools/front_end/MemoryStatistics.js
index 743fa1f41ce3837468215ee9f716c38b7d3ff868..9ca0ac262bbaf31030a615014f0fa886caeeb597 100644
--- a/Source/devtools/front_end/MemoryStatistics.js
+++ b/Source/devtools/front_end/MemoryStatistics.js
@@ -264,18 +264,12 @@ WebInspector.MemoryStatistics.prototype = {
{
return value - sample.time;
}
- var firstIndex = binarySearch(start, this._counters, comparator);
- var lastIndex = binarySearch(end, this._counters, comparator);
- if (firstIndex < 0)
- firstIndex = Math.max(0, -firstIndex - 2);
- if (lastIndex < 0)
- lastIndex = Math.min(-lastIndex - 1, this._counters.length - 1);
// Maximum index of element whose time <= start.
- this._minimumIndex = firstIndex;
+ this._minimumIndex = Number.constrain(this._counters.upperBound(start, comparator) - 1, 0, this._counters.length - 1);
// Minimum index of element whose time >= end.
- this._maximumIndex = lastIndex;
+ this._maximumIndex = Number.constrain(this._counters.lowerBound(end, comparator), 0, this._counters.length - 1);
// Current window bounds.
this._minTime = start;
« no previous file with comments | « Source/devtools/front_end/DefaultTextEditor.js ('k') | Source/devtools/front_end/externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698