OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 Loading... | |
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 Loading... | |
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.setContent( | |
1020 WebInspector.TracingTimelineUIUtils.generateCauses(event, this._ detailsLinkifier)); | |
1021 this._detailsView.appendTab("causes", WebInspector.UIString("Causes" ), causesView); | |
1009 } | 1022 } |
1010 }, | 1023 }, |
1011 | 1024 |
1012 _updateSelectedRangeStats: function() | 1025 _updateSelectedRangeStats: function() |
1013 { | 1026 { |
1014 if (this._selection) | 1027 if (this._selection) |
1015 return; | 1028 return; |
1016 | 1029 |
1017 var startTime = this._windowStartTime; | 1030 var startTime = this._windowStartTime; |
1018 var endTime = this._windowEndTime; | 1031 var endTime = this._windowEndTime; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1106 | 1119 |
1107 /** | 1120 /** |
1108 * @param {string} title | 1121 * @param {string} title |
1109 * @param {!Node} node | 1122 * @param {!Node} node |
1110 */ | 1123 */ |
1111 showInDetails: function(title, node) | 1124 showInDetails: function(title, node) |
1112 { | 1125 { |
1113 this._detailsView.setContent(title, node); | 1126 this._detailsView.setContent(title, node); |
1114 }, | 1127 }, |
1115 | 1128 |
1129 /** | |
1130 * @param {!WebInspector.TracingModel.Event} event | |
1131 * @return {boolean} | |
1132 */ | |
1133 _hasCauses: function(event) | |
1134 { | |
1135 // Do not show cause data unless the setting is enabled. This gives us a | |
1136 // single checkbox and a consistent UI, at the cost of not showing | |
1137 // initiator data that might be available when the setting is disabled. | |
1138 if (!event || !this._captureCausesSetting.get()) | |
caseq
2014/10/07 09:50:07
nit: drop !event check
| |
1139 return false; | |
1140 | |
1141 var initiatorHasStack = event.initiator && event.initiator.stackTrace; | |
1142 return initiatorHasStack || event.stackTrace; | |
1143 }, | |
1144 | |
1116 __proto__: WebInspector.Panel.prototype | 1145 __proto__: WebInspector.Panel.prototype |
1117 } | 1146 } |
1118 | 1147 |
1119 /** | 1148 /** |
1120 * @constructor | 1149 * @constructor |
1121 * @extends {WebInspector.TabbedPane} | 1150 * @extends {WebInspector.TabbedPane} |
1122 */ | 1151 */ |
1123 WebInspector.TimelineDetailsView = function() | 1152 WebInspector.TimelineDetailsView = function() |
1124 { | 1153 { |
1125 WebInspector.TabbedPane.call(this); | 1154 WebInspector.TabbedPane.call(this); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1456 | 1485 |
1457 WebInspector.TimelinePanelFactory.prototype = { | 1486 WebInspector.TimelinePanelFactory.prototype = { |
1458 /** | 1487 /** |
1459 * @return {!WebInspector.Panel} | 1488 * @return {!WebInspector.Panel} |
1460 */ | 1489 */ |
1461 createPanel: function() | 1490 createPanel: function() |
1462 { | 1491 { |
1463 return WebInspector.TimelinePanel._instance(); | 1492 return WebInspector.TimelinePanel._instance(); |
1464 } | 1493 } |
1465 } | 1494 } |
1495 | |
1496 /** | |
1497 * Display information about an event's direct and indirect causes. | |
1498 * | |
1499 * @interface | |
caseq
2014/10/07 09:50:08
s/@interface/@constructor/
| |
1500 * @extends {WebInspector.VBox} | |
1501 */ | |
1502 WebInspector.TimelineCausesView = function() | |
1503 { | |
1504 WebInspector.VBox.call(this); | |
1505 this.element.classList.add("timeline-causes-view"); | |
caseq
2014/10/07 09:50:07
unused?
| |
1506 } | |
1507 | |
1508 WebInspector.TimelineCausesView.prototype = { | |
1509 setContent: function(content) | |
caseq
2014/10/07 09:50:08
Please annotate @type for content.
| |
1510 { | |
1511 this.element.removeChildren(); | |
1512 if (!content || !content.children || !content.children.length) { | |
1513 console.error("No content generator set on TimelineCausesView."); | |
1514 content = this.element.createChild("div", ""); | |
1515 content.textContent = | |
1516 WebInspector.UIString("No causes reported for this event."); | |
1517 } | |
1518 this.element.appendChild(content); | |
caseq
2014/10/07 09:50:08
This will throw if (!content), so perhaps put unde
| |
1519 }, | |
1520 | |
1521 __proto__: WebInspector.VBox.prototype | |
1522 }; | |
OLD | NEW |