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

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

Issue 631573002: [Devtools] Replace "Stacks" with "Causes" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Minor cleanup Created 6 years, 2 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 }, 263 },
264 264
265 _paintProfilerView: function() 265 _paintProfilerView: function()
266 { 266 {
267 if (this._lazyPaintProfilerView) 267 if (this._lazyPaintProfilerView)
268 return this._lazyPaintProfilerView; 268 return this._lazyPaintProfilerView;
269 this._lazyPaintProfilerView = new WebInspector.TimelinePaintProfilerView (); 269 this._lazyPaintProfilerView = new WebInspector.TimelinePaintProfilerView ();
270 return this._lazyPaintProfilerView; 270 return this._lazyPaintProfilerView;
271 }, 271 },
272 272
273 _causesView: function()
274 {
275 if (!this._lazyCausesView)
276 this._lazyCausesView = new WebInspector.TimelineCausesView();
277 return this._lazyCausesView;
278 },
279
273 /** 280 /**
274 * @param {!WebInspector.TimelineModeView} modeView 281 * @param {!WebInspector.TimelineModeView} modeView
275 */ 282 */
276 _addModeView: function(modeView) 283 _addModeView: function(modeView)
277 { 284 {
278 modeView.setWindowTimes(this.windowStartTime(), this.windowEndTime()); 285 modeView.setWindowTimes(this.windowStartTime(), this.windowEndTime());
279 modeView.refreshRecords(this._textFilter._regex); 286 modeView.refreshRecords(this._textFilter._regex);
280 this._stackView.appendView(modeView.view(), "timelinePanelTimelineStackS plitViewState"); 287 this._stackView.appendView(modeView.view(), "timelinePanelTimelineStackS plitViewState");
281 modeView.view().addEventListener(WebInspector.SplitView.Events.SidebarSi zeChanged, this._sidebarResized, this); 288 modeView.view().addEventListener(WebInspector.SplitView.Events.SidebarSi zeChanged, this._sidebarResized, this);
282 this._currentViews.push(modeView); 289 this._currentViews.push(modeView);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 panelStatusBarElement.appendChild(framesToggleButton.element); 347 panelStatusBarElement.appendChild(framesToggleButton.element);
341 348
342 if (Runtime.experiments.isEnabled("timelineOnTraceEvents")) { 349 if (Runtime.experiments.isEnabled("timelineOnTraceEvents")) {
343 var flameChartToggleButton = new WebInspector.StatusBarButton(WebIns pector.UIString("Tracing mode"), "timeline-flame-chart-status-bar-item"); 350 var flameChartToggleButton = new WebInspector.StatusBarButton(WebIns pector.UIString("Tracing mode"), "timeline-flame-chart-status-bar-item");
344 flameChartToggleButton.toggled = this._flameChartEnabledSetting.get( ); 351 flameChartToggleButton.toggled = this._flameChartEnabledSetting.get( );
345 flameChartToggleButton.addEventListener("click", this._flameChartEna bledChanged.bind(this, flameChartToggleButton)); 352 flameChartToggleButton.addEventListener("click", this._flameChartEna bledChanged.bind(this, flameChartToggleButton));
346 this._statusBarButtons.push(flameChartToggleButton); 353 this._statusBarButtons.push(flameChartToggleButton);
347 panelStatusBarElement.appendChild(flameChartToggleButton.element); 354 panelStatusBarElement.appendChild(flameChartToggleButton.element);
348 } 355 }
349 356
350 this._captureStacksSetting = WebInspector.settings.createSetting("timeli neCaptureStacks", true); 357 this._captureCausesSetting = WebInspector.settings.createSetting("timeli neCaptureCauses", true);
351 this._captureStacksSetting.addChangeListener(this._refreshViews, this); 358 this._captureCausesSetting.addChangeListener(this._refreshViews, this);
352 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspect or.UIString("Stacks"), 359 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspect or.UIString("Causes"),
353 this._capt ureStacksSetting, 360 this._capt ureCausesSetting,
354 WebInspect or.UIString("Capture JavaScript stack on every timeline event"))); 361 WebInspect or.UIString("Capture causes for timeline events (e.g., stack traces)")));
355 this._captureMemorySetting = WebInspector.settings.createSetting("timeli neCaptureMemory", false); 362 this._captureMemorySetting = WebInspector.settings.createSetting("timeli neCaptureMemory", false);
356 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspect or.UIString("Memory"), 363 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspect or.UIString("Memory"),
357 this._capt ureMemorySetting, 364 this._capt ureMemorySetting,
358 WebInspect or.UIString("Capture memory information on every timeline event"))); 365 WebInspect or.UIString("Capture memory information on every timeline event")));
359 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); 366 this._captureMemorySetting.addChangeListener(this._onModeChanged, this);
360 if (Runtime.experiments.isEnabled("timelinePowerProfiler") && 367 if (Runtime.experiments.isEnabled("timelinePowerProfiler") &&
361 WebInspector.targetManager.mainTarget().hasCapability(WebInspector.T arget.Capabilities.CanProfilePower)) { 368 WebInspector.targetManager.mainTarget().hasCapability(WebInspector.T arget.Capabilities.CanProfilePower)) {
362 this._capturePowerSetting = WebInspector.settings.createSetting("tim elineCapturePower", false); 369 this._capturePowerSetting = WebInspector.settings.createSetting("tim elineCapturePower", false);
363 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebIns pector.UIString("Power"), 370 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebIns pector.UIString("Power"),
364 this._ capturePowerSetting, 371 this._ capturePowerSetting,
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 this._recordingOptionUIControls.forEach(handler); 639 this._recordingOptionUIControls.forEach(handler);
633 WebInspector.inspectorView.setCurrentPanelLocked(!enabled); 640 WebInspector.inspectorView.setCurrentPanelLocked(!enabled);
634 }, 641 },
635 642
636 /** 643 /**
637 * @param {boolean} userInitiated 644 * @param {boolean} userInitiated
638 */ 645 */
639 _startRecording: function(userInitiated) 646 _startRecording: function(userInitiated)
640 { 647 {
641 this._userInitiatedRecording = userInitiated; 648 this._userInitiatedRecording = userInitiated;
642 this._model.startRecording(this._captureStacksSetting.get(), this._captu reMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLay ersAndPicturesSetting.get()); 649 this._model.startRecording(this._captureCausesSetting.get(), this._captu reMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLay ersAndPicturesSetting.get());
643 if (this._lazyFrameModel) 650 if (this._lazyFrameModel)
644 this._lazyFrameModel.setMergeRecords(false); 651 this._lazyFrameModel.setMergeRecords(false);
645 652
646 for (var i = 0; i < this._overviewControls.length; ++i) 653 for (var i = 0; i < this._overviewControls.length; ++i)
647 this._overviewControls[i].timelineStarted(); 654 this._overviewControls[i].timelineStarted();
648 655
649 if (userInitiated) 656 if (userInitiated)
650 WebInspector.userMetrics.TimelineStarted.record(); 657 WebInspector.userMetrics.TimelineStarted.record();
651 this._setUIControlsEnabled(false); 658 this._setUIControlsEnabled(false);
652 }, 659 },
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 }, 996 },
990 997
991 /** 998 /**
992 * @param {!WebInspector.TracingModel.Event} event 999 * @param {!WebInspector.TracingModel.Event} event
993 * @param {!Node} content 1000 * @param {!Node} content
994 */ 1001 */
995 _appendDetailsTabsForTraceEventAndShowDetails: function(event, content) 1002 _appendDetailsTabsForTraceEventAndShowDetails: function(event, content)
996 { 1003 {
997 var title = WebInspector.TracingTimelineUIUtils.eventStyle(event).title; 1004 var title = WebInspector.TracingTimelineUIUtils.eventStyle(event).title;
998 this.showInDetails(title, content); 1005 this.showInDetails(title, content);
999 if (!event.picture) 1006 if (event.picture) {
1000 return; 1007 var paintProfilerView = this._paintProfilerView();
1001 var paintProfilerView = this._paintProfilerView(); 1008 this._detailsView.appendTab("paintProfiler", WebInspector.UIString(" Paint Profiler"), paintProfilerView);
1002 this._detailsView.appendTab("paintProfiler", WebInspector.UIString("Pain t Profiler"), paintProfilerView); 1009 event.picture.requestObject(onGotObject);
1003 event.picture.requestObject(onGotObject); 1010 function onGotObject(result)
1004 function onGotObject(result) 1011 {
1005 { 1012 if (!result || !result["skp64"])
1006 if (!result || !result["skp64"]) 1013 return;
1007 return; 1014 paintProfilerView.setPicture(event.thread.target(), result["skp6 4"]);
1008 paintProfilerView.setPicture(event.thread.target(), result["skp64"]) ; 1015 }
1016 }
1017 if (this._hasCauses(event)) {
1018 var causesView = this._causesView();
1019 causesView.setContentGenerator(function(event, callback) {
caseq 2014/10/06 12:47:48 This looks like a bit too much inversion of contro
pdr. 2014/10/07 04:36:13 Done. In the future generateCausesContent may be
1020 WebInspector.TracingTimelineUIUtils.generateCausesContent(event, this._detailsLinkifier, callback);
1021 }.bind(this, event));
1022 this._detailsView.appendTab("causes", WebInspector.UIString("Causes" ), causesView);
1009 } 1023 }
1010 }, 1024 },
1011 1025
1012 _updateSelectedRangeStats: function() 1026 _updateSelectedRangeStats: function()
1013 { 1027 {
1014 if (this._selection) 1028 if (this._selection)
1015 return; 1029 return;
1016 1030
1017 var startTime = this._windowStartTime; 1031 var startTime = this._windowStartTime;
1018 var endTime = this._windowEndTime; 1032 var endTime = this._windowEndTime;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 1120
1107 /** 1121 /**
1108 * @param {string} title 1122 * @param {string} title
1109 * @param {!Node} node 1123 * @param {!Node} node
1110 */ 1124 */
1111 showInDetails: function(title, node) 1125 showInDetails: function(title, node)
1112 { 1126 {
1113 this._detailsView.setContent(title, node); 1127 this._detailsView.setContent(title, node);
1114 }, 1128 },
1115 1129
1130 /**
1131 * @param {!WebInspector.TracingModel.Event} event
1132 * @return {boolean}
1133 */
1134 _hasCauses: function(event)
1135 {
1136 if (!event)
1137 return false;
1138
1139 // Do not show cause data unless the setting is enabled. This gives us a
1140 // single checkbox and a consistent UI, at the cost of not showing
1141 // initiator data that might be available when the setting is disabled.
1142 var initiator = event.initiator;
1143 return this._captureCausesSetting && this._captureCausesSetting.get()
caseq 2014/10/06 12:47:48 does this._captureCausesSetting ever evaluate to f
pdr. 2014/10/07 04:36:13 I was being too cautious. I don't think we can get
1144 && ((initiator && initiator.stackTrace) || event.stackTrace);
1145 },
1146
1116 __proto__: WebInspector.Panel.prototype 1147 __proto__: WebInspector.Panel.prototype
1117 } 1148 }
1118 1149
1119 /** 1150 /**
1120 * @constructor 1151 * @constructor
1121 * @extends {WebInspector.TabbedPane} 1152 * @extends {WebInspector.TabbedPane}
1122 */ 1153 */
1123 WebInspector.TimelineDetailsView = function() 1154 WebInspector.TimelineDetailsView = function()
1124 { 1155 {
1125 WebInspector.TabbedPane.call(this); 1156 WebInspector.TabbedPane.call(this);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 * @param {string} id 1196 * @param {string} id
1166 * @param {string} tabTitle 1197 * @param {string} tabTitle
1167 * @param {!WebInspector.View} view 1198 * @param {!WebInspector.View} view
1168 * @param {string=} tabTooltip 1199 * @param {string=} tabTooltip
1169 * @param {boolean=} userGesture 1200 * @param {boolean=} userGesture
1170 * @param {boolean=} isCloseable 1201 * @param {boolean=} isCloseable
1171 */ 1202 */
1172 appendTab: function(id, tabTitle, view, tabTooltip, userGesture, isCloseable ) 1203 appendTab: function(id, tabTitle, view, tabTooltip, userGesture, isCloseable )
1173 { 1204 {
1174 WebInspector.TabbedPane.prototype.appendTab.call(this, id, tabTitle, vie w, tabTooltip); 1205 WebInspector.TabbedPane.prototype.appendTab.call(this, id, tabTitle, vie w, tabTooltip);
1206 // FIXME: We should check (this._lastUserSelectedTabId) here so new tabs
caseq 2014/10/06 12:47:48 I think this logic is still producing the effect o
pdr. 2014/10/07 04:36:13 I've pulled this out into https://codereview.chrom
1207 // are not automatically selected.
1175 if (this._lastUserSelectedTabId !== this.selectedTabId) 1208 if (this._lastUserSelectedTabId !== this.selectedTabId)
1176 this.selectTab(id); 1209 this.selectTab(id);
1177 }, 1210 },
1178 1211
1179 _tabSelected: function(event) 1212 _tabSelected: function(event)
1180 { 1213 {
1181 if (!event.data.isUserGesture) 1214 if (!event.data.isUserGesture)
1182 return; 1215 return;
1183 1216
1184 this._lastUserSelectedTabId = event.data.tabId; 1217 this._lastUserSelectedTabId = event.data.tabId;
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 1489
1457 WebInspector.TimelinePanelFactory.prototype = { 1490 WebInspector.TimelinePanelFactory.prototype = {
1458 /** 1491 /**
1459 * @return {!WebInspector.Panel} 1492 * @return {!WebInspector.Panel}
1460 */ 1493 */
1461 createPanel: function() 1494 createPanel: function()
1462 { 1495 {
1463 return WebInspector.TimelinePanel._instance(); 1496 return WebInspector.TimelinePanel._instance();
1464 } 1497 }
1465 } 1498 }
1499
1500 /**
1501 * Display information about an event's direct and indirect causes.
1502 *
1503 * @interface
1504 * @extends {WebInspector.VBox}
1505 */
1506 WebInspector.TimelineCausesView = function()
1507 {
1508 WebInspector.VBox.call(this);
1509 this.element.classList.add("timeline-causes-view");
1510 }
1511
1512 WebInspector.TimelineCausesView.prototype = {
1513 setContentGenerator: function(generator)
1514 {
1515 this._generateContent = generator;
1516 if (this.isShowing())
1517 this._update();
1518 else
1519 this._updateWhenVisible = true;
1520 },
1521
1522 wasShown: function()
1523 {
1524 WebInspector.View.prototype.wasShown.call(this);
1525 if (this._updateWhenVisible) {
1526 this._updateWhenVisible = false;
1527 this._update();
1528 }
1529 },
1530
1531 _update: function()
1532 {
1533 this.element.removeChildren();
1534
1535 if (this._generateContent) {
1536 this._generateContent(function(content) {
1537 var hasContent = content && content.children.length;
1538 var content = hasContent ? content : this._noCauseFoundContent() ;
1539 this.element.appendChild(content);
1540 }.bind(this));
1541 } else {
1542 console.error("No content generator set on TimelineCausesView.");
1543 this.element.appendChild(this._noCauseFoundContent());
1544 }
1545 },
1546
1547 _noCauseFoundContent: function()
caseq 2014/10/06 12:47:48 nit: since it's going to be always the same, just
pdr. 2014/10/07 04:36:13 I wanted to keep this as light as possible, as it
1548 {
1549 var content = this.element.createChild("div", "");
1550 content.textContent =
1551 WebInspector.UIString("No causes reported for this event.");
1552 return content;
1553 },
1554
1555 __proto__: WebInspector.VBox.prototype
1556 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698