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

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

Issue 1315373005: DevTools: remove most convenience wrappers from WI.TimelineModel.Record (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 var nodeSpan = createElement("span"); 1127 var nodeSpan = createElement("span");
1128 return nodeSpan.createTextChild(WebInspector.UIString("[ unknown nod e ]")); 1128 return nodeSpan.createTextChild(WebInspector.UIString("[ unknown nod e ]"));
1129 } 1129 }
1130 }, 1130 },
1131 1131
1132 __proto__: TreeElement.prototype 1132 __proto__: TreeElement.prototype
1133 } 1133 }
1134 1134
1135 /** 1135 /**
1136 * @param {!Object} total 1136 * @param {!Object} total
1137 * @param {!WebInspector.TimelineModel} model
1137 * @param {!WebInspector.TimelineModel.Record} record 1138 * @param {!WebInspector.TimelineModel.Record} record
1138 */ 1139 */
1139 WebInspector.TimelineUIUtils.aggregateTimeForRecord = function(total, record) 1140 WebInspector.TimelineUIUtils.aggregateTimeForRecord = function(total, model, rec ord)
1140 { 1141 {
1141 var traceEvent = record.traceEvent(); 1142 WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent(total, model, rec ord.traceEvent());
1142 var model = record.timelineModel();
1143 WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent(total, model, tra ceEvent);
1144 } 1143 }
1145 1144
1146 /** 1145 /**
1147 * @param {!Object} total 1146 * @param {!Object} total
1148 * @param {!WebInspector.TimelineModel} model 1147 * @param {!WebInspector.TimelineModel} model
1149 * @param {!WebInspector.TracingModel.Event} event 1148 * @param {!WebInspector.TracingModel.Event} event
1150 * @return {boolean} 1149 * @return {boolean}
1151 */ 1150 */
1152 WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent = function(total, mod el, event) 1151 WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent = function(total, mod el, event)
1153 { 1152 {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 callback(container); 1235 callback(container);
1237 } 1236 }
1238 1237
1239 function showPaintProfiler() 1238 function showPaintProfiler()
1240 { 1239 {
1241 WebInspector.TimelinePanel.instance().select(WebInspector.TimelineSelect ion.fromTraceEvent(event), WebInspector.TimelinePanel.DetailsTab.PaintProfiler); 1240 WebInspector.TimelinePanel.instance().select(WebInspector.TimelineSelect ion.fromTraceEvent(event), WebInspector.TimelinePanel.DetailsTab.PaintProfiler);
1242 } 1241 }
1243 } 1242 }
1244 1243
1245 /** 1244 /**
1246 * @param {string} recordType 1245 * @param {!WebInspector.TimelineModel.RecordType} recordType
1247 * @param {?string} title 1246 * @param {?string} title
1248 * @param {number} position 1247 * @param {number} position
1249 * @return {!Element} 1248 * @return {!Element}
1250 */ 1249 */
1251 WebInspector.TimelineUIUtils.createEventDivider = function(recordType, title, po sition) 1250 WebInspector.TimelineUIUtils.createEventDivider = function(recordType, title, po sition)
1252 { 1251 {
1253 var eventDivider = createElement("div"); 1252 var eventDivider = createElement("div");
1254 eventDivider.className = "resources-event-divider"; 1253 eventDivider.className = "resources-event-divider";
1255 var recordTypes = WebInspector.TimelineModel.RecordType; 1254 var recordTypes = WebInspector.TimelineModel.RecordType;
1256 1255
1257 if (recordType === recordTypes.MarkDOMContent) 1256 if (recordType === recordTypes.MarkDOMContent)
1258 eventDivider.className += " resources-blue-divider"; 1257 eventDivider.className += " resources-blue-divider";
1259 else if (recordType === recordTypes.MarkLoad) 1258 else if (recordType === recordTypes.MarkLoad)
1260 eventDivider.className += " resources-red-divider"; 1259 eventDivider.className += " resources-red-divider";
1261 else if (recordType === recordTypes.MarkFirstPaint) 1260 else if (recordType === recordTypes.MarkFirstPaint)
1262 eventDivider.className += " resources-green-divider"; 1261 eventDivider.className += " resources-green-divider";
1263 else if (recordType === recordTypes.TimeStamp || recordType === recordTypes. ConsoleTime) 1262 else if (recordType === recordTypes.TimeStamp || recordType === recordTypes. ConsoleTime)
1264 eventDivider.className += " resources-orange-divider"; 1263 eventDivider.className += " resources-orange-divider";
1265 else if (recordType === recordTypes.BeginFrame) 1264 else if (recordType === recordTypes.BeginFrame)
1266 eventDivider.className += " timeline-frame-divider"; 1265 eventDivider.className += " timeline-frame-divider";
1267 1266
1268 if (title) 1267 if (title)
1269 eventDivider.title = title; 1268 eventDivider.title = title;
1270 eventDivider.style.left = position + "px"; 1269 eventDivider.style.left = position + "px";
1271 return eventDivider; 1270 return eventDivider;
1272 } 1271 }
1273 1272
1274 /** 1273 /**
1275 * @param {!WebInspector.TimelineModel.Record} record 1274 * @param {!WebInspector.TimelineModel.Record} record
1275 * @param {number} zeroTime
1276 * @param {number} position 1276 * @param {number} position
1277 * @return {!Element} 1277 * @return {!Element}
1278 */ 1278 */
1279 WebInspector.TimelineUIUtils.createDividerForRecord = function(record, position) 1279 WebInspector.TimelineUIUtils.createDividerForRecord = function(record, zeroTime, position)
1280 { 1280 {
1281 var startTime = Number.millisToString(record.startTime() - record.timelineMo del().minimumRecordTime()); 1281 var startTime = Number.millisToString(record.startTime() - zeroTime);
1282 var title = WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.e ventTitle(record.traceEvent()), startTime); 1282 var title = WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.e ventTitle(record.traceEvent()), startTime);
1283 return WebInspector.TimelineUIUtils.createEventDivider(record.type(), title, position); 1283 return WebInspector.TimelineUIUtils.createEventDivider(record.type(), title, position);
1284 } 1284 }
1285 1285
1286 /** 1286 /**
1287 * @return {!Array.<string>} 1287 * @return {!Array.<string>}
1288 */ 1288 */
1289 WebInspector.TimelineUIUtils._visibleTypes = function() 1289 WebInspector.TimelineUIUtils._visibleTypes = function()
1290 { 1290 {
1291 var eventStyles = WebInspector.TimelineUIUtils._initEventStyles(); 1291 var eventStyles = WebInspector.TimelineUIUtils._initEventStyles();
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 if (!this._linkifier || !this._target) 1937 if (!this._linkifier || !this._target)
1938 return; 1938 return;
1939 1939
1940 var stackTraceElement = parentElement.createChild("div", "timeline-detai ls-view-row-value timeline-details-view-row-stack-trace monospace"); 1940 var stackTraceElement = parentElement.createChild("div", "timeline-detai ls-view-row-value timeline-details-view-row-stack-trace monospace");
1941 1941
1942 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre viewContents(this._target, this._linkifier, stackTrace); 1942 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre viewContents(this._target, this._linkifier, stackTrace);
1943 1943
1944 stackTraceElement.appendChild(callFrameElem); 1944 stackTraceElement.appendChild(callFrameElem);
1945 } 1945 }
1946 } 1946 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698