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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js

Issue 2746333002: DevTools: move recurring flag into AsyncTask, control cancelation from embedder only. (Closed)
Patch Set: Created 3 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
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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 e._blackboxRoot = true; 330 e._blackboxRoot = true;
331 } 331 }
332 if (title) { 332 if (title) {
333 this._appendHeader(title, style, forceExpanded); 333 this._appendHeader(title, style, forceExpanded);
334 title = ''; 334 title = '';
335 } 335 }
336 336
337 var level = this._currentLevel + openEvents.length; 337 var level = this._currentLevel + openEvents.length;
338 if (flowEventsEnabled) 338 if (flowEventsEnabled)
339 this._appendFlowEvent(e, level); 339 this._appendFlowEvent(e, level);
340 this._appendEvent(e, level); 340 if (e.phase !== SDK.TracingModel.Phase.FlowEnd)
341 this._appendEvent(e, level);
341 if (!isExtension && TimelineModel.TimelineModel.isMarkerEvent(e)) 342 if (!isExtension && TimelineModel.TimelineModel.isMarkerEvent(e))
342 this._timelineData.entryTotalTimes[this._entryData.length] = undefined; 343 this._timelineData.entryTotalTimes[this._entryData.length] = undefined;
343 344
344 maxStackDepth = Math.max(maxStackDepth, openEvents.length + 1); 345 maxStackDepth = Math.max(maxStackDepth, openEvents.length + 1);
345 if (e.endTime) 346 if (e.endTime)
346 openEvents.push(e); 347 openEvents.push(e);
347 } 348 }
348 this._entryTypeByLevel.length = this._currentLevel + maxStackDepth; 349 this._entryTypeByLevel.length = this._currentLevel + maxStackDepth;
349 this._entryTypeByLevel.fill(entryType, this._currentLevel); 350 this._entryTypeByLevel.fill(entryType, this._currentLevel);
350 this._currentLevel += maxStackDepth; 351 this._currentLevel += maxStackDepth;
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 * @param {!SDK.TracingModel.Event} event 738 * @param {!SDK.TracingModel.Event} event
738 * @param {number} level 739 * @param {number} level
739 */ 740 */
740 _appendFlowEvent(event, level) { 741 _appendFlowEvent(event, level) {
741 var timelineData = this._timelineData; 742 var timelineData = this._timelineData;
742 /** 743 /**
743 * @param {!SDK.TracingModel.Event} event 744 * @param {!SDK.TracingModel.Event} event
744 * @return {number} 745 * @return {number}
745 */ 746 */
746 function pushStartFlow(event) { 747 function pushStartFlow(event) {
748 if (event.args.name === 'Image')
alph 2017/03/14 00:39:37 What's wrong with Image?
pfeldman 2017/03/14 01:15:10 I'll drop it.
caseq 2017/03/14 01:15:43 This is supposed to work for the generic case of f
749 return -1;
747 var flowIndex = timelineData.flowStartTimes.length; 750 var flowIndex = timelineData.flowStartTimes.length;
748 timelineData.flowStartTimes.push(event.startTime); 751 timelineData.flowStartTimes.push(event.startTime);
749 timelineData.flowStartLevels.push(level); 752 timelineData.flowStartLevels.push(level);
750 return flowIndex; 753 return flowIndex;
751 } 754 }
752 755
753 /** 756 /**
754 * @param {!SDK.TracingModel.Event} event 757 * @param {!SDK.TracingModel.Event} event
755 * @param {number} flowIndex 758 * @param {number} flowIndex
756 */ 759 */
757 function pushEndFlow(event, flowIndex) { 760 function pushEndFlow(event, flowIndex) {
761 if (flowIndex < 0)
762 return;
758 timelineData.flowEndTimes[flowIndex] = event.startTime; 763 timelineData.flowEndTimes[flowIndex] = event.startTime;
759 timelineData.flowEndLevels[flowIndex] = level; 764 timelineData.flowEndLevels[flowIndex] = level;
760 } 765 }
761 766
762 switch (event.phase) { 767 switch (event.phase) {
763 case SDK.TracingModel.Phase.FlowBegin: 768 case SDK.TracingModel.Phase.FlowBegin:
764 this._flowEventIndexById.set(event.id, pushStartFlow(event)); 769 this._flowEventIndexById.set(event.id, pushStartFlow(event));
765 break; 770 break;
766 case SDK.TracingModel.Phase.FlowStep: 771 case SDK.TracingModel.Phase.FlowStep:
767 pushEndFlow(event, this._flowEventIndexById.get(event.id)); 772 pushEndFlow(event, this._flowEventIndexById.get(event.id));
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 * @return {boolean} 873 * @return {boolean}
869 */ 874 */
870 _isVisible(event) { 875 _isVisible(event) {
871 return this._filters.every(function(filter) { 876 return this._filters.every(function(filter) {
872 return filter.accept(event); 877 return filter.accept(event);
873 }); 878 });
874 } 879 }
875 }; 880 };
876 881
877 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; 882 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698