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

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

Issue 184823002: DevTools: do not cache details node, remove linkifier from presentation record. (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) 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 WebInspector.TimelineUIUtils.generatePopupContentForFrameStatistics = function(s tatistics) 370 WebInspector.TimelineUIUtils.generatePopupContentForFrameStatistics = function(s tatistics)
371 { 371 {
372 /** 372 /**
373 * @param {number} time 373 * @param {number} time
374 */ 374 */
375 function formatTimeAndFPS(time) 375 function formatTimeAndFPS(time)
376 { 376 {
377 return WebInspector.UIString("%s (%.0f FPS)", Number.millisToString(time , true), 1 / time); 377 return WebInspector.UIString("%s (%.0f FPS)", Number.millisToString(time , true), 1 / time);
378 } 378 }
379 379
380 var contentHelper = new WebInspector.TimelineDetailsContentHelper(false); 380 var contentHelper = new WebInspector.TimelineDetailsContentHelper(new WebIns pector.Linkifier(), false);
caseq 2014/03/03 07:53:15 So what happens to locations created by the linkif
pfeldman 2014/03/03 09:16:48 It is never called here.
381 contentHelper.appendTextRow(WebInspector.UIString("Minimum Time"), formatTim eAndFPS(statistics.minDuration)); 381 contentHelper.appendTextRow(WebInspector.UIString("Minimum Time"), formatTim eAndFPS(statistics.minDuration));
382 contentHelper.appendTextRow(WebInspector.UIString("Average Time"), formatTim eAndFPS(statistics.average)); 382 contentHelper.appendTextRow(WebInspector.UIString("Average Time"), formatTim eAndFPS(statistics.average));
383 contentHelper.appendTextRow(WebInspector.UIString("Maximum Time"), formatTim eAndFPS(statistics.maxDuration)); 383 contentHelper.appendTextRow(WebInspector.UIString("Maximum Time"), formatTim eAndFPS(statistics.maxDuration));
384 contentHelper.appendTextRow(WebInspector.UIString("Standard Deviation"), Num ber.millisToString(statistics.stddev, true)); 384 contentHelper.appendTextRow(WebInspector.UIString("Standard Deviation"), Num ber.millisToString(statistics.stddev, true));
385 385
386 return contentHelper.element; 386 return contentHelper.element;
387 } 387 }
388 388
389 /** 389 /**
390 * @param {!CanvasRenderingContext2D} context 390 * @param {!CanvasRenderingContext2D} context
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 appendTextRow: function(title, content) 520 appendTextRow: function(title, content)
521 { 521 {
522 var row = document.createElement("tr"); 522 var row = document.createElement("tr");
523 row.appendChild(this._createCell(title, "timeline-details-row-title")); 523 row.appendChild(this._createCell(title, "timeline-details-row-title"));
524 row.appendChild(this._createCell(content, "timeline-details-row-data")); 524 row.appendChild(this._createCell(content, "timeline-details-row-data"));
525 this._contentTable.appendChild(row); 525 this._contentTable.appendChild(row);
526 }, 526 },
527 527
528 /** 528 /**
529 * @param {string} title 529 * @param {string} title
530 * @param {!Element|string} content 530 * @param {!Node|string} content
531 */ 531 */
532 appendElementRow: function(title, content) 532 appendElementRow: function(title, content)
533 { 533 {
534 var row = document.createElement("tr"); 534 var row = document.createElement("tr");
535 var titleCell = this._createCell(title, "timeline-details-row-title"); 535 var titleCell = this._createCell(title, "timeline-details-row-title");
536 row.appendChild(titleCell); 536 row.appendChild(titleCell);
537 var cell = document.createElement("td"); 537 var cell = document.createElement("td");
538 cell.className = "details"; 538 cell.className = "details";
539 if (content instanceof Node) 539 if (content instanceof Node)
540 cell.appendChild(content); 540 cell.appendChild(content);
541 else 541 else
542 cell.createTextChild(content || ""); 542 cell.createTextChild(content || "");
543 row.appendChild(cell); 543 row.appendChild(cell);
544 this._contentTable.appendChild(row); 544 this._contentTable.appendChild(row);
545 } 545 }
546 } 546 }
547 547
548 /** 548 /**
549 * @constructor 549 * @constructor
550 * @param {!WebInspector.Linkifier} linkifier
550 * @param {boolean} monospaceValues 551 * @param {boolean} monospaceValues
551 */ 552 */
552 WebInspector.TimelineDetailsContentHelper = function(monospaceValues) 553 WebInspector.TimelineDetailsContentHelper = function(linkifier, monospaceValues)
553 { 554 {
555 this._linkifier = linkifier;
caseq 2014/03/03 07:53:15 one
pfeldman 2014/03/03 09:16:48 Done.
554 this.element = document.createElement("div"); 556 this.element = document.createElement("div");
555 this.element.className = "timeline-details-view-block"; 557 this.element.className = "timeline-details-view-block";
556 this._monospaceValues = monospaceValues; 558 this._monospaceValues = monospaceValues;
559 this._linkifier = new WebInspector.Linkifier();
caseq 2014/03/03 07:53:15 two
pfeldman 2014/03/03 09:16:48 Done.
557 } 560 }
558 561
559 WebInspector.TimelineDetailsContentHelper.prototype = { 562 WebInspector.TimelineDetailsContentHelper.prototype = {
560 /** 563 /**
561 * @param {string} title 564 * @param {string} title
562 * @param {string|number|boolean} value 565 * @param {string|number|boolean} value
563 */ 566 */
564 appendTextRow: function(title, value) 567 appendTextRow: function(title, value)
565 { 568 {
566 var rowElement = this.element.createChild("div", "timeline-details-view- row"); 569 var rowElement = this.element.createChild("div", "timeline-details-view- row");
567 rowElement.createChild("span", "timeline-details-view-row-title").textCo ntent = WebInspector.UIString("%s: ", title); 570 rowElement.createChild("span", "timeline-details-view-row-title").textCo ntent = WebInspector.UIString("%s: ", title);
568 rowElement.createChild("span", "timeline-details-view-row-value" + (this ._monospaceValues ? " monospace" : "")).textContent = value; 571 rowElement.createChild("span", "timeline-details-view-row-value" + (this ._monospaceValues ? " monospace" : "")).textContent = value;
569 }, 572 },
570 573
571 /** 574 /**
572 * @param {string} title 575 * @param {string} title
573 * @param {!Element|string} content 576 * @param {!Node|string} content
574 */ 577 */
575 appendElementRow: function(title, content) 578 appendElementRow: function(title, content)
576 { 579 {
577 var rowElement = this.element.createChild("div", "timeline-details-view- row"); 580 var rowElement = this.element.createChild("div", "timeline-details-view- row");
578 rowElement.createChild("span", "timeline-details-view-row-title").textCo ntent = WebInspector.UIString("%s: ", title); 581 rowElement.createChild("span", "timeline-details-view-row-title").textCo ntent = WebInspector.UIString("%s: ", title);
579 var valueElement = rowElement.createChild("span", "timeline-details-view -row-details" + (this._monospaceValues ? " monospace" : "")); 582 var valueElement = rowElement.createChild("span", "timeline-details-view -row-details" + (this._monospaceValues ? " monospace" : ""));
580 if (content instanceof Node) 583 if (content instanceof Node)
581 valueElement.appendChild(content); 584 valueElement.appendChild(content);
582 else 585 else
583 valueElement.createTextChild(content || ""); 586 valueElement.createTextChild(content || "");
584 }, 587 },
585 588
586 /** 589 /**
587 * @param {string} title 590 * @param {string} title
591 * @param {string} url
592 * @param {number} line
593 */
594 appendLocationRow: function(title, url, line)
595 {
596 this.appendElementRow(title, this._linkifier.linkifyLocation(url, line - 1) || "");
597 },
598
599 /**
600 * @param {string} title
588 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace 601 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace
589 * @param {function(!ConsoleAgent.CallFrame)} callFrameLinkifier
590 */ 602 */
591 appendStackTrace: function(title, stackTrace, callFrameLinkifier) 603 appendStackTrace: function(title, stackTrace)
592 { 604 {
593 var rowElement = this.element.createChild("div", "timeline-details-view- row"); 605 var rowElement = this.element.createChild("div", "timeline-details-view- row");
594 rowElement.createChild("span", "timeline-details-view-row-title").textCo ntent = WebInspector.UIString("%s: ", title); 606 rowElement.createChild("span", "timeline-details-view-row-title").textCo ntent = WebInspector.UIString("%s: ", title);
595 var stackTraceElement = rowElement.createChild("div", "timeline-details- view-row-stack-trace monospace"); 607 var stackTraceElement = rowElement.createChild("div", "timeline-details- view-row-stack-trace monospace");
596 608
597 for (var i = 0; i < stackTrace.length; ++i) { 609 for (var i = 0; i < stackTrace.length; ++i) {
598 var stackFrame = stackTrace[i]; 610 var stackFrame = stackTrace[i];
599 var row = stackTraceElement.createChild("div"); 611 var row = stackTraceElement.createChild("div");
600 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); 612 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)"));
601 row.createTextChild(" @ "); 613 row.createTextChild(" @ ");
602 var urlElement = callFrameLinkifier(stackFrame); 614 var urlElement = this._linkifier.linkifyLocation(stackFrame.url, sta ckFrame.lineNumber - 1);
603 row.appendChild(urlElement); 615 row.appendChild(urlElement);
604 } 616 }
605 } 617 }
606 } 618 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698