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

Side by Side Diff: Source/devtools/front_end/timeline/TimelineFrameOverview.js

Issue 423433004: DevTools: move the "Capture *" checkboxes from timeline sidebar to the toolbar. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 return visibleFrames; 130 return visibleFrames;
131 }, 131 },
132 132
133 /** 133 /**
134 * @param {!Array.<!WebInspector.TimelineFrame>} frames 134 * @param {!Array.<!WebInspector.TimelineFrame>} frames
135 * @return {number} 135 * @return {number}
136 */ 136 */
137 _computeTargetFrameLength: function(frames) 137 _computeTargetFrameLength: function(frames)
138 { 138 {
139 const targetFPS = 20;
apavlov 2014/07/25 09:10:10 They say "const" prevents function optimizations.
140 var result = 1000.0 / targetFPS;
141 if (!frames.length)
142 return result;
143
139 var durations = []; 144 var durations = [];
140 for (var i = 0; i < frames.length; ++i) { 145 for (var i = 0; i < frames.length; ++i) {
141 if (frames[i]) 146 if (frames[i])
142 durations.push(frames[i].duration); 147 durations.push(frames[i].duration);
143 } 148 }
144 var medianFrameLength = durations.qselect(Math.floor(durations.length / 2)); 149 var medianFrameLength = durations.qselect(Math.floor(durations.length / 2));
145 150
146 // Optimize appearance for 30fps, but leave some space so it's evident w hen a frame overflows. 151 // Optimize appearance for 30fps, but leave some space so it's evident w hen a frame overflows.
147 // However, if at least half frames won't fit at this scale, fall back t o using autoscale. 152 // However, if at least half frames won't fit at this scale, fall back t o using autoscale.
148 const targetFPS = 20;
149 var result = 1000.0 / targetFPS;
150 if (result >= medianFrameLength) 153 if (result >= medianFrameLength)
151 return result; 154 return result;
152 155
153 var maxFrameLength = Math.max.apply(Math, durations); 156 var maxFrameLength = Math.max.apply(Math, durations);
154 return Math.min(medianFrameLength * 2, maxFrameLength); 157 return Math.min(medianFrameLength * 2, maxFrameLength);
155 }, 158 },
156 159
157 /** 160 /**
158 * @param {!Array.<!WebInspector.TimelineFrame>} frames 161 * @param {!Array.<!WebInspector.TimelineFrame>} frames
159 * @param {number} scale 162 * @param {number} scale
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 * @param {number} time 362 * @param {number} time
360 * @param {function(number, {startTime:number, endTime:number}):number} comp arator 363 * @param {function(number, {startTime:number, endTime:number}):number} comp arator
361 */ 364 */
362 _firstBarAfter: function(time, comparator) 365 _firstBarAfter: function(time, comparator)
363 { 366 {
364 return insertionIndexForObjectInListSortedByFunction(time, this._barTime s, comparator); 367 return insertionIndexForObjectInListSortedByFunction(time, this._barTime s, comparator);
365 }, 368 },
366 369
367 __proto__: WebInspector.TimelineOverviewBase.prototype 370 __proto__: WebInspector.TimelineOverviewBase.prototype
368 } 371 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698