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

Side by Side Diff: Source/devtools/front_end/TimelineFlameChart.js

Issue 188293003: DevTools: minor flame chart speedups. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 this._totalTime = Math.max(1000, this._endTime - this._startTime); 191 this._totalTime = Math.max(1000, this._endTime - this._startTime);
192 192
193 if (this._mainThread) { 193 if (this._mainThread) {
194 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask || !!record.thread) 194 if (record.type === WebInspector.TimelineModel.RecordType.GPUTask || !!record.thread)
195 return; 195 return;
196 } else { 196 } else {
197 if (record.type === WebInspector.TimelineModel.RecordType.Program || !record.thread || record.thread === "gpu") 197 if (record.type === WebInspector.TimelineModel.RecordType.Program || !record.thread || record.thread === "gpu")
198 return; 198 return;
199 } 199 }
200 200
201 var recordIndex = this._pushRecord(record, true, level, record.startTime , record.endTime); 201 if (record.children.length) {
202 var currentTime = record.startTime; 202 this._pushRecord(record, true, level, record.startTime, record.start Time + + record.selfTime);
alph 2014/03/06 06:24:46 Something is wrong here.
pfeldman 2014/03/06 11:19:57 Done.
203 for (var i = 0; i < record.children.length; ++i) { 203 this._pushRecord(record, false, level, record.startTime + record.sel fTime, record.endTime);
204 var childRecord = record.children[i]; 204 } else {
205 var childStartTime = childRecord.startTime; 205 this._pushRecord(record, true, level, record.startTime, record.endTi me);
206 var childEndTime = childRecord.endTime;
207 if (childStartTime === childEndTime) {
208 this._appendRecord(childRecord, level + 1);
209 continue;
210 }
211
212 if (currentTime !== childStartTime) {
213 if (recordIndex !== -1) {
214 this._timelineData.entryTotalTimes[recordIndex] = childStart Time - record.startTime;
215 recordIndex = -1;
216 } else {
217 this._pushRecord(record, true, level, currentTime, childStar tTime);
218 }
219 }
220 this._pushRecord(record, false, level, childStartTime, childEndTime) ;
221 this._appendRecord(childRecord, level + 1);
222 currentTime = childEndTime;
223 } 206 }
224 if (recordIndex === -1 && recordEndTime !== currentTime || record.childr en.length === 0) 207 for (var i = 0; i < record.children.length; ++i)
225 this._pushRecord(record, true, level, currentTime, recordEndTime); 208 this._appendRecord(record.children[i], level + 1);
226
227 this._maxStackDepth = Math.max(this._maxStackDepth, level + 2); 209 this._maxStackDepth = Math.max(this._maxStackDepth, level + 2);
228 }, 210 },
229 211
230 /** 212 /**
231 * @param {!WebInspector.TimelineModel.Record} record 213 * @param {!WebInspector.TimelineModel.Record} record
232 * @param {boolean} isSelfSegment 214 * @param {boolean} isSelfSegment
233 * @param {number} level 215 * @param {number} level
234 * @param {number} startTime 216 * @param {number} startTime
235 * @param {number} endTime 217 * @param {number} endTime
236 * @return {number} 218 * @return {number}
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 requestWindowTimes: function(windowStartTime, windowEndTime) 311 requestWindowTimes: function(windowStartTime, windowEndTime)
330 { 312 {
331 this._delegate.requestWindowTimes(windowStartTime, windowEndTime); 313 this._delegate.requestWindowTimes(windowStartTime, windowEndTime);
332 }, 314 },
333 315
334 /** 316 /**
335 * @param {?RegExp} textFilter 317 * @param {?RegExp} textFilter
336 */ 318 */
337 refreshRecords: function(textFilter) 319 refreshRecords: function(textFilter)
338 { 320 {
339 this._dataProvider.reset();
340 this._mainView.reset();
341 this.setSelectedRecord(this._selectedRecord);
342 }, 321 },
343 322
344 reset: function() 323 reset: function()
345 { 324 {
346 this._automaticallySizeWindow = true; 325 this._automaticallySizeWindow = true;
347 this._dataProvider.reset(); 326 this._dataProvider.reset();
348 this._mainView.setWindowTimes(0, Infinity); 327 this._mainView.setWindowTimes(0, Infinity);
349 delete this._selectedRecord;
350 }, 328 },
351 329
352 _onRecordingStarted: function() 330 _onRecordingStarted: function()
353 { 331 {
354 this._automaticallySizeWindow = true; 332 this._automaticallySizeWindow = true;
355 }, 333 },
356 334
357 /** 335 /**
358 * @param {!WebInspector.TimelineModel.Record} record 336 * @param {!WebInspector.TimelineModel.Record} record
359 */ 337 */
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 */ 383 */
406 highlightSearchResult: function(record, regex, selectRecord) 384 highlightSearchResult: function(record, regex, selectRecord)
407 { 385 {
408 }, 386 },
409 387
410 /** 388 /**
411 * @param {?WebInspector.TimelineModel.Record} record 389 * @param {?WebInspector.TimelineModel.Record} record
412 */ 390 */
413 setSelectedRecord: function(record) 391 setSelectedRecord: function(record)
414 { 392 {
415 this._selectedRecord = record;
416 var entryRecords = this._dataProvider._records; 393 var entryRecords = this._dataProvider._records;
417 for (var entryIndex = 0; entryIndex < entryRecords.length; ++entryIndex) { 394 for (var entryIndex = 0; entryIndex < entryRecords.length; ++entryIndex) {
418 if (entryRecords[entryIndex] === record) { 395 if (entryRecords[entryIndex] === record) {
419 this._mainView.setSelectedEntry(entryIndex); 396 this._mainView.setSelectedEntry(entryIndex);
420 return; 397 return;
421 } 398 }
422 } 399 }
423 this._mainView.setSelectedEntry(-1); 400 this._mainView.setSelectedEntry(-1);
424 if (this._selectedElement) {
425 this._selectedElement.remove();
426 delete this._selectedElement;
427 }
428 }, 401 },
429 402
430 /** 403 /**
431 * @param {!WebInspector.Event} event 404 * @param {!WebInspector.Event} event
432 */ 405 */
433 _onEntrySelected: function(event) 406 _onEntrySelected: function(event)
434 { 407 {
435 var entryIndex = event.data; 408 var entryIndex = event.data;
436 var record = this._dataProvider._records[entryIndex]; 409 var record = this._dataProvider._records[entryIndex];
437 this._delegate.selectRecord(record); 410 this._delegate.selectRecord(record);
438 }, 411 },
439 412
440 __proto__: WebInspector.View.prototype 413 __proto__: WebInspector.View.prototype
441 } 414 }
OLDNEW
« Source/devtools/front_end/FlameChart.js ('K') | « Source/devtools/front_end/FlameChart.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698