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

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

Issue 185233002: DevTools: remove timeline presentation model dependency from record. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comments addressed. 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) 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 eventDivider.className += " timeline-frame-divider"; 195 eventDivider.className += " timeline-frame-divider";
196 196
197 if (title) 197 if (title)
198 eventDivider.title = title; 198 eventDivider.title = title;
199 199
200 return eventDivider; 200 return eventDivider;
201 } 201 }
202 202
203 203
204 /** 204 /**
205 * @param {!WebInspector.TimelinePresentationModel} presentationModel 205 * @param {!WebInspector.TimelineModel} model
206 * @param {!{name: string, tasks: !Array.<!{startTime: number, endTime: number}> , firstTaskIndex: number, lastTaskIndex: number}} info 206 * @param {!{name: string, tasks: !Array.<!{startTime: number, endTime: number}> , firstTaskIndex: number, lastTaskIndex: number}} info
207 * @return {!Element} 207 * @return {!Element}
208 */ 208 */
209 WebInspector.TimelineUIUtils.generateMainThreadBarPopupContent = function(presen tationModel, info) 209 WebInspector.TimelineUIUtils.generateMainThreadBarPopupContent = function(model, info)
210 { 210 {
211 var firstTaskIndex = info.firstTaskIndex; 211 var firstTaskIndex = info.firstTaskIndex;
212 var lastTaskIndex = info.lastTaskIndex; 212 var lastTaskIndex = info.lastTaskIndex;
213 var tasks = info.tasks; 213 var tasks = info.tasks;
214 var messageCount = lastTaskIndex - firstTaskIndex + 1; 214 var messageCount = lastTaskIndex - firstTaskIndex + 1;
215 var cpuTime = 0; 215 var cpuTime = 0;
216 216
217 for (var i = firstTaskIndex; i <= lastTaskIndex; ++i) { 217 for (var i = firstTaskIndex; i <= lastTaskIndex; ++i) {
218 var task = tasks[i]; 218 var task = tasks[i];
219 cpuTime += task.endTime - task.startTime; 219 cpuTime += task.endTime - task.startTime;
220 } 220 }
221 var startTime = tasks[firstTaskIndex].startTime; 221 var startTime = tasks[firstTaskIndex].startTime;
222 var endTime = tasks[lastTaskIndex].endTime; 222 var endTime = tasks[lastTaskIndex].endTime;
223 var duration = endTime - startTime; 223 var duration = endTime - startTime;
224 224
225 var contentHelper = new WebInspector.TimelinePopupContentHelper(info.name); 225 var contentHelper = new WebInspector.TimelinePopupContentHelper(info.name);
226 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (duration, true), 226 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (duration, true),
227 Number.millisToString(startTime - presentationModel.minimumRecordTime(), true)); 227 Number.millisToString(startTime - model.minimumRecordTime(), true));
228 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText) ; 228 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText) ;
229 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis ToString(cpuTime, true)); 229 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis ToString(cpuTime, true));
230 contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageC ount); 230 contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageC ount);
231 return contentHelper.contentTable(); 231 return contentHelper.contentTable();
232 } 232 }
233 233
234 /** 234 /**
235 * @param {!WebInspector.TimelinePresentationModel} presentationModel 235 * @param {!WebInspector.TimelineModel} model
236 * @param {!TimelineAgent.TimelineEvent} record 236 * @param {!TimelineAgent.TimelineEvent} record
237 * @return {string} 237 * @return {string}
238 */ 238 */
239 WebInspector.TimelineUIUtils.recordTitle = function(presentationModel, record) 239 WebInspector.TimelineUIUtils.recordTitle = function(model, record)
240 { 240 {
241 if (record.type === WebInspector.TimelineModel.RecordType.TimeStamp) 241 if (record.type === WebInspector.TimelineModel.RecordType.TimeStamp)
242 return record.data["message"]; 242 return record.data["message"];
243 if (WebInspector.TimelineUIUtils.isEventDivider(record)) { 243 if (WebInspector.TimelineUIUtils.isEventDivider(record)) {
244 var startTime = Number.millisToString(record.startTime - presentationMod el.minimumRecordTime()); 244 var startTime = Number.millisToString(record.startTime - model.minimumRe cordTime());
245 return WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.re cordStyle(record).title, startTime, true); 245 return WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.re cordStyle(record).title, startTime, true);
246 } 246 }
247 return WebInspector.TimelineUIUtils.recordStyle(record).title; 247 return WebInspector.TimelineUIUtils.recordStyle(record).title;
248 } 248 }
249 249
250 /** 250 /**
251 * @param {!Object} total 251 * @param {!Object} total
252 * @param {!Object} addend 252 * @param {!Object} addend
253 */ 253 */
254 WebInspector.TimelineUIUtils.aggregateTimeByCategory = function(total, addend) 254 WebInspector.TimelineUIUtils.aggregateTimeByCategory = function(total, addend)
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 for (var i = 0; i < stackTrace.length; ++i) { 608 for (var i = 0; i < stackTrace.length; ++i) {
609 var stackFrame = stackTrace[i]; 609 var stackFrame = stackTrace[i];
610 var row = stackTraceElement.createChild("div"); 610 var row = stackTraceElement.createChild("div");
611 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); 611 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)"));
612 row.createTextChild(" @ "); 612 row.createTextChild(" @ ");
613 var urlElement = this._linkifier.linkifyLocation(stackFrame.url, sta ckFrame.lineNumber - 1); 613 var urlElement = this._linkifier.linkifyLocation(stackFrame.url, sta ckFrame.lineNumber - 1);
614 row.appendChild(urlElement); 614 row.appendChild(urlElement);
615 } 615 }
616 } 616 }
617 } 617 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/TimelinePresentationModel.js ('k') | Source/devtools/front_end/TimelineView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698