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

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

Issue 339493005: Move more methods into implementation specific timeline UI utils (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } else { 574 } else {
575 if (!listRowElement) { 575 if (!listRowElement) {
576 listRowElement = new WebInspector.TimelineRecordListRow(this ._linkifier, selectRecordCallback, scheduleRefreshCallback).element; 576 listRowElement = new WebInspector.TimelineRecordListRow(this ._linkifier, selectRecordCallback, scheduleRefreshCallback).element;
577 this._sidebarListElement.appendChild(listRowElement); 577 this._sidebarListElement.appendChild(listRowElement);
578 } 578 }
579 if (!graphRowElement) { 579 if (!graphRowElement) {
580 graphRowElement = new WebInspector.TimelineRecordGraphRow(th is._itemsGraphsElement, selectRecordCallback, scheduleRefreshCallback).element; 580 graphRowElement = new WebInspector.TimelineRecordGraphRow(th is._itemsGraphsElement, selectRecordCallback, scheduleRefreshCallback).element;
581 this._graphRowsElement.appendChild(graphRowElement); 581 this._graphRowsElement.appendChild(graphRowElement);
582 } 582 }
583 583
584 listRowElement.row.update(record, visibleTop, this._model.loaded FromFile()); 584 listRowElement.row.update(record, visibleTop, this._model.loaded FromFile(), this._uiUtils);
585 graphRowElement.row.update(record, this._calculator, this._expan dOffset, i); 585 graphRowElement.row.update(record, this._calculator, this._expan dOffset, i);
586 if (this._lastSelectedRecord === record) { 586 if (this._lastSelectedRecord === record) {
587 listRowElement.row.renderAsSelected(true); 587 listRowElement.row.renderAsSelected(true);
588 graphRowElement.row.renderAsSelected(true); 588 graphRowElement.row.renderAsSelected(true);
589 } 589 }
590 590
591 listRowElement = listRowElement.nextSibling; 591 listRowElement = listRowElement.nextSibling;
592 graphRowElement = graphRowElement.nextSibling; 592 graphRowElement = graphRowElement.nextSibling;
593 } 593 }
594 } 594 }
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 this._dataElement = this.element.createChild("span", "data dimmed"); 1041 this._dataElement = this.element.createChild("span", "data dimmed");
1042 this._scheduleRefresh = scheduleRefresh; 1042 this._scheduleRefresh = scheduleRefresh;
1043 this._selectRecord = selectRecord; 1043 this._selectRecord = selectRecord;
1044 } 1044 }
1045 1045
1046 WebInspector.TimelineRecordListRow.prototype = { 1046 WebInspector.TimelineRecordListRow.prototype = {
1047 /** 1047 /**
1048 * @param {!WebInspector.TimelinePresentationModel.Record} presentationRecor d 1048 * @param {!WebInspector.TimelinePresentationModel.Record} presentationRecor d
1049 * @param {number} offset 1049 * @param {number} offset
1050 * @param {boolean} loadedFromFile 1050 * @param {boolean} loadedFromFile
1051 * @param {!WebInspector.TimelineUIUtils} uiUtils
1051 */ 1052 */
1052 update: function(presentationRecord, offset, loadedFromFile) 1053 update: function(presentationRecord, offset, loadedFromFile, uiUtils)
1053 { 1054 {
1054 this._record = presentationRecord; 1055 this._record = presentationRecord;
1055 var record = presentationRecord.record(); 1056 var record = presentationRecord.record();
1056 this._offset = offset; 1057 this._offset = offset;
1057 1058
1058 this.element.className = "timeline-tree-item timeline-category-" + recor d.category().name; 1059 this.element.className = "timeline-tree-item timeline-category-" + recor d.category().name;
1059 var paddingLeft = 5; 1060 var paddingLeft = 5;
1060 var step = -3; 1061 var step = -3;
1061 for (var currentRecord = presentationRecord.presentationParent() ? prese ntationRecord.presentationParent().presentationParent() : null; currentRecord; c urrentRecord = currentRecord.presentationParent()) 1062 for (var currentRecord = presentationRecord.presentationParent() ? prese ntationRecord.presentationParent().presentationParent() : null; currentRecord; c urrentRecord = currentRecord.presentationParent())
1062 paddingLeft += 12 / (Math.max(1, step++)); 1063 paddingLeft += 12 / (Math.max(1, step++));
1063 this.element.style.paddingLeft = paddingLeft + "px"; 1064 this.element.style.paddingLeft = paddingLeft + "px";
1064 if (record.thread()) 1065 if (record.thread())
1065 this.element.classList.add("background"); 1066 this.element.classList.add("background");
1066 1067
1067 this._typeElement.textContent = record.title(); 1068 this._typeElement.textContent = record.title();
1068 1069
1069 if (this._dataElement.firstChild) 1070 if (this._dataElement.firstChild)
1070 this._dataElement.removeChildren(); 1071 this._dataElement.removeChildren();
1071 1072
1072 this._warningElement.classList.toggle("hidden", !presentationRecord.hasW arnings() && !presentationRecord.childHasWarnings()); 1073 this._warningElement.classList.toggle("hidden", !presentationRecord.hasW arnings() && !presentationRecord.childHasWarnings());
1073 this._warningElement.classList.toggle("timeline-tree-item-child-warning" , presentationRecord.childHasWarnings() && !presentationRecord.hasWarnings()); 1074 this._warningElement.classList.toggle("timeline-tree-item-child-warning" , presentationRecord.childHasWarnings() && !presentationRecord.hasWarnings());
1074 1075
1075 if (presentationRecord.coalesced()) { 1076 if (presentationRecord.coalesced()) {
1076 this._dataElement.createTextChild(WebInspector.UIString("× %d", pres entationRecord.presentationChildren().length)); 1077 this._dataElement.createTextChild(WebInspector.UIString("× %d", pres entationRecord.presentationChildren().length));
1077 } else { 1078 } else {
1078 var detailsNode = record instanceof WebInspector.TimelineModel.Recor dImpl ? 1079 var detailsNode = uiUtils.buildDetailsNode(record, this._linkifier, loadedFromFile);
1079 WebInspector.TimelineUIUtils.buildDetailsNode(record, this._link ifier, loadedFromFile) :
1080 WebInspector.TracingTimelineUIUtils.buildDetailsNodeForTraceEven t(record._event, this._linkifier, loadedFromFile, record.target());
1081 if (detailsNode) { 1080 if (detailsNode) {
1082 this._dataElement.appendChild(document.createTextNode("(")); 1081 this._dataElement.appendChild(document.createTextNode("("));
1083 this._dataElement.appendChild(detailsNode); 1082 this._dataElement.appendChild(detailsNode);
1084 this._dataElement.appendChild(document.createTextNode(")")); 1083 this._dataElement.appendChild(document.createTextNode(")"));
1085 } 1084 }
1086 } 1085 }
1087 1086
1088 this._expandArrowElement.classList.toggle("parent", presentationRecord.e xpandable()); 1087 this._expandArrowElement.classList.toggle("parent", presentationRecord.e xpandable());
1089 this._expandArrowElement.classList.toggle("expanded", !!presentationReco rd.visibleChildrenCount()); 1088 this._expandArrowElement.classList.toggle("expanded", !!presentationReco rd.visibleChildrenCount());
1090 this._record.setListRow(this); 1089 this._record.setListRow(this);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 this._element.classList.remove("hidden"); 1294 this._element.classList.remove("hidden");
1296 } else 1295 } else
1297 this._element.classList.add("hidden"); 1296 this._element.classList.add("hidden");
1298 }, 1297 },
1299 1298
1300 _dispose: function() 1299 _dispose: function()
1301 { 1300 {
1302 this._element.remove(); 1301 this._element.remove();
1303 } 1302 }
1304 } 1303 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineUIUtilsImpl.js ('k') | Source/devtools/front_end/timeline/TracingTimelineModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698