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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/perf_ui/FlameChart.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) 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 * @param {number} width 948 * @param {number} width
949 */ 949 */
950 _drawFlowEvents(context, width, height) { 950 _drawFlowEvents(context, width, height) {
951 context.save(); 951 context.save();
952 var ratio = window.devicePixelRatio; 952 var ratio = window.devicePixelRatio;
953 var top = this.getScrollOffset(); 953 var top = this.getScrollOffset();
954 var arrowWidth = 6; 954 var arrowWidth = 6;
955 context.scale(ratio, ratio); 955 context.scale(ratio, ratio);
956 context.translate(0, -top); 956 context.translate(0, -top);
957 957
958 context.fillStyle = '#7f0000'; 958 context.fillStyle = '#7f5050';
alph 2017/03/14 00:39:37 Red color is reserved for something being wrong.
pfeldman 2017/03/14 01:15:10 Yeah, that's why I made it brown.
959 context.strokeStyle = '#7f0000'; 959 context.strokeStyle = '#7f5050';
960 var td = this._timelineData(); 960 var td = this._timelineData();
961 var endIndex = td.flowStartTimes.lowerBound(this._timeWindowRight); 961 var endIndex = td.flowStartTimes.lowerBound(this._timeWindowRight);
962 962
963 context.lineWidth = 0.5; 963 context.lineWidth = 0.5;
964 for (var i = 0; i < endIndex; ++i) { 964 for (var i = 0; i < endIndex; ++i) {
965 if (td.flowEndTimes[i] < this._timeWindowLeft) 965 if (!td.flowEndTimes[i] || td.flowEndTimes[i] < this._timeWindowLeft)
966 continue; 966 continue;
967 var startX = this._timeToPosition(td.flowStartTimes[i]); 967 var startX = this._timeToPosition(td.flowStartTimes[i]);
968 var endX = this._timeToPosition(td.flowEndTimes[i]); 968 var endX = this._timeToPosition(td.flowEndTimes[i]);
969 var startY = this._levelToHeight(td.flowStartLevels[i]) + this._barHeight / 2; 969 var startY = this._levelToHeight(td.flowStartLevels[i]) + this._barHeight / 2;
970 var endY = this._levelToHeight(td.flowEndLevels[i]) + this._barHeight / 2; 970 var endY = this._levelToHeight(td.flowEndLevels[i]) + this._barHeight / 2;
971 var distance = (endY - startY) / 10; 971
972 var spread = 30;
973 var lineY = spread + Math.max(0, startY + distance * (i % spread));
974 972
975 var segment = Math.min((endX - startX) / 4, 40); 973 var segment = Math.min((endX - startX) / 4, 40);
974 var distanceTime = td.flowEndTimes[i] - td.flowStartTimes[i];
alph 2017/03/14 00:39:37 This file changes seem to be unrelated to the main
pfeldman 2017/03/14 01:15:10 I know, I am sorry.
975 var distanceY = (endY - startY) / 10;
976 var spread = 30;
977 var lineY = distanceTime < 1 ? startY : spread + Math.max(0, startY + dist anceY * (i % spread));
978
979 var p = [];
alph 2017/03/14 00:39:37 creating arrays of objects is not a good idea for
pfeldman 2017/03/14 01:15:10 Do you think 2 bezierCurveTo-s is not making this
980 p.push({x: startX, y: startY});
981 p.push({x: startX + arrowWidth, y: startY});
982 p.push({x: startX + segment + 2 * arrowWidth, y: startY});
983 p.push({x: startX + segment, y: lineY});
984 p.push({x: startX + segment * 2, y: lineY});
985 p.push({x: endX - segment * 2, y: lineY});
986 p.push({x: endX - segment, y: lineY});
987 p.push({x: endX - segment - 2 * arrowWidth, y: endY});
988 p.push({x: endX - arrowWidth, y: endY});
989
976 context.beginPath(); 990 context.beginPath();
977 context.moveTo(startX, startY); 991 context.moveTo(p[0].x, p[0].y);
978 context.bezierCurveTo(startX + segment, startY, startX + segment, lineY, s tartX + segment * 2, lineY); 992 context.lineTo(p[1].x, p[1].y);
979 context.lineTo(endX - segment * 2, lineY); 993 context.bezierCurveTo(p[2].x, p[2].y, p[3].x, p[3].y, p[4].x, p[4].y);
980 context.bezierCurveTo(endX - segment, lineY, endX - segment, endY, endX - arrowWidth, endY); 994 context.lineTo(p[5].x, p[5].y);
995 context.bezierCurveTo(p[6].x, p[6].y, p[7].x, p[7].y, p[8].x, p[8].y);
981 context.stroke(); 996 context.stroke();
982 997
983 context.beginPath(); 998 context.beginPath();
984 context.arc(startX, startY, 2, -Math.PI / 2, Math.PI / 2, false); 999 context.arc(startX, startY, 2, -Math.PI / 2, Math.PI / 2, false);
985 context.fill(); 1000 context.fill();
986 1001
987 context.beginPath(); 1002 context.beginPath();
988 context.moveTo(endX, endY); 1003 context.moveTo(endX, endY);
989 context.lineTo(endX - arrowWidth, endY - 3); 1004 context.lineTo(endX - arrowWidth, endY - 3);
990 context.lineTo(endX - arrowWidth, endY + 3); 1005 context.lineTo(endX - arrowWidth, endY + 3);
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 } 1601 }
1587 1602
1588 /** 1603 /**
1589 * @override 1604 * @override
1590 * @return {number} 1605 * @return {number}
1591 */ 1606 */
1592 boundarySpan() { 1607 boundarySpan() {
1593 return this._maximumBoundaries - this._minimumBoundaries; 1608 return this._maximumBoundaries - this._minimumBoundaries;
1594 } 1609 }
1595 }; 1610 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698