| 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 14 matching lines...) Expand all Loading... |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * @constructor | 33 * @constructor |
| 34 * @extends {WebInspector.Panel} | 34 * @extends {WebInspector.Panel} |
| 35 * @implements {WebInspector.TimelineLifecycleDelegate} |
| 35 * @implements {WebInspector.TimelineModeViewDelegate} | 36 * @implements {WebInspector.TimelineModeViewDelegate} |
| 36 * @implements {WebInspector.Searchable} | 37 * @implements {WebInspector.Searchable} |
| 37 */ | 38 */ |
| 38 WebInspector.TimelinePanel = function() | 39 WebInspector.TimelinePanel = function() |
| 39 { | 40 { |
| 40 WebInspector.Panel.call(this, "timeline"); | 41 WebInspector.Panel.call(this, "timeline"); |
| 41 this.registerRequiredCSS("timeline/timelinePanel.css"); | 42 this.registerRequiredCSS("timeline/timelinePanel.css"); |
| 42 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f
alse); | 43 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f
alse); |
| 43 this._dropTarget = new WebInspector.DropTarget(this.element, [WebInspector.D
ropTarget.Types.Files, WebInspector.DropTarget.Types.URIList], WebInspector.UISt
ring("Drop timeline file or URL here"), this._handleDrop.bind(this)); | 44 this._dropTarget = new WebInspector.DropTarget(this.element, [WebInspector.D
ropTarget.Types.Files, WebInspector.DropTarget.Types.URIList], WebInspector.UISt
ring("Drop timeline file or URL here"), this._handleDrop.bind(this)); |
| 44 | 45 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 if (Runtime.experiments.isEnabled("timelineRecordingPerspectives") && pe
rspectiveSetting.get() === WebInspector.TimelinePanel.Perspectives.Load) { | 382 if (Runtime.experiments.isEnabled("timelineRecordingPerspectives") && pe
rspectiveSetting.get() === WebInspector.TimelinePanel.Perspectives.Load) { |
| 382 this._reloadButton = new WebInspector.ToolbarButton(WebInspector.UIS
tring("Record & Reload"), "refresh-toolbar-item"); | 383 this._reloadButton = new WebInspector.ToolbarButton(WebInspector.UIS
tring("Record & Reload"), "refresh-toolbar-item"); |
| 383 this._reloadButton.addEventListener("click", () => WebInspector.targ
etManager.reloadPage()); | 384 this._reloadButton.addEventListener("click", () => WebInspector.targ
etManager.reloadPage()); |
| 384 this._panelToolbar.appendToolbarItem(this._reloadButton); | 385 this._panelToolbar.appendToolbarItem(this._reloadButton); |
| 385 } else { | 386 } else { |
| 386 this._panelToolbar.appendToolbarItem(WebInspector.Toolbar.createActi
onButton(this._toggleRecordAction)); | 387 this._panelToolbar.appendToolbarItem(WebInspector.Toolbar.createActi
onButton(this._toggleRecordAction)); |
| 387 } | 388 } |
| 388 | 389 |
| 389 this._updateTimelineControls(); | 390 this._updateTimelineControls(); |
| 390 var clearButton = new WebInspector.ToolbarButton(WebInspector.UIString("
Clear recording"), "clear-toolbar-item"); | 391 var clearButton = new WebInspector.ToolbarButton(WebInspector.UIString("
Clear recording"), "clear-toolbar-item"); |
| 391 clearButton.addEventListener("click", this._onClearButtonClick, this); | 392 clearButton.addEventListener("click", this._clear, this); |
| 392 this._panelToolbar.appendToolbarItem(clearButton); | 393 this._panelToolbar.appendToolbarItem(clearButton); |
| 393 | 394 |
| 394 this._panelToolbar.appendSeparator(); | 395 this._panelToolbar.appendSeparator(); |
| 395 | 396 |
| 396 this._panelToolbar.appendText(WebInspector.UIString("Capture:")); | 397 this._panelToolbar.appendText(WebInspector.UIString("Capture:")); |
| 397 | 398 |
| 398 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, th
is); | 399 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, th
is); |
| 399 if (!Runtime.experiments.isEnabled("timelineRecordingPerspectives") || p
erspectiveSetting.get() === WebInspector.TimelinePanel.Perspectives.Custom) { | 400 if (!Runtime.experiments.isEnabled("timelineRecordingPerspectives") || p
erspectiveSetting.get() === WebInspector.TimelinePanel.Perspectives.Custom) { |
| 400 if (Runtime.experiments.isEnabled("networkRequestsOnTimeline")) { | 401 if (Runtime.experiments.isEnabled("networkRequestsOnTimeline")) { |
| 401 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox
(WebInspector.UIString("Network"), | 402 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox
(WebInspector.UIString("Network"), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 var option = this._cpuThrottlingCombobox.createOption(name, "",
String(value)); | 438 var option = this._cpuThrottlingCombobox.createOption(name, "",
String(value)); |
| 438 this._cpuThrottlingCombobox.addOption(option); | 439 this._cpuThrottlingCombobox.addOption(option); |
| 439 if (value === this._cpuThrottlingManager.rate()) | 440 if (value === this._cpuThrottlingManager.rate()) |
| 440 this._cpuThrottlingCombobox.select(option); | 441 this._cpuThrottlingCombobox.select(option); |
| 441 } | 442 } |
| 442 addGroupingOption.call(this, WebInspector.UIString("No CPU throttlin
g"), 1); | 443 addGroupingOption.call(this, WebInspector.UIString("No CPU throttlin
g"), 1); |
| 443 for (var rate of [1.2, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20,
30, 50]) | 444 for (var rate of [1.2, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20,
30, 50]) |
| 444 addGroupingOption.call(this, WebInspector.UIString("%fx slowdown
", rate), rate); | 445 addGroupingOption.call(this, WebInspector.UIString("%fx slowdown
", rate), rate); |
| 445 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); | 446 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); |
| 446 } | 447 } |
| 447 | |
| 448 this._progressToolbarItem = new WebInspector.ToolbarItem(createElement("
div")); | |
| 449 this._progressToolbarItem.setVisible(false); | |
| 450 this._panelToolbar.appendToolbarItem(this._progressToolbarItem); | |
| 451 }, | 448 }, |
| 452 | 449 |
| 453 /** | |
| 454 * @return {!WebInspector.Progress} | |
| 455 */ | |
| 456 _prepareToLoadTimeline: function() | 450 _prepareToLoadTimeline: function() |
| 457 { | 451 { |
| 458 /** | 452 console.assert(this._state === WebInspector.TimelinePanel.State.Idle); |
| 459 * @this {!WebInspector.TimelinePanel} | 453 this._setState(WebInspector.TimelinePanel.State.Loading); |
| 460 */ | |
| 461 function finishLoading() | |
| 462 { | |
| 463 this._setState(WebInspector.TimelinePanel.State.Idle); | |
| 464 this._progressToolbarItem.setVisible(false); | |
| 465 this._progressToolbarItem.element.removeChildren(); | |
| 466 this._hideRecordingHelpMessage(); | |
| 467 } | |
| 468 console.assert(this._state === WebInspector.TimelinePanel.State.Idle); | |
| 469 this._setState(WebInspector.TimelinePanel.State.Loading); | |
| 470 var progressIndicator = new WebInspector.ProgressIndicator(); | |
| 471 this._progressToolbarItem.setVisible(true); | |
| 472 this._progressToolbarItem.element.appendChild(progressIndicator.element)
; | |
| 473 return new WebInspector.ProgressProxy(progressIndicator, finishLoading.b
ind(this)); | |
| 474 }, | 454 }, |
| 475 | 455 |
| 476 _createFileSelector: function() | 456 _createFileSelector: function() |
| 477 { | 457 { |
| 478 if (this._fileSelectorElement) | 458 if (this._fileSelectorElement) |
| 479 this._fileSelectorElement.remove(); | 459 this._fileSelectorElement.remove(); |
| 480 this._fileSelectorElement = WebInspector.createFileSelectorElement(this.
_loadFromFile.bind(this)); | 460 this._fileSelectorElement = WebInspector.createFileSelectorElement(this.
_loadFromFile.bind(this)); |
| 481 this.element.appendChild(this._fileSelectorElement); | 461 this.element.appendChild(this._fileSelectorElement); |
| 482 }, | 462 }, |
| 483 | 463 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 return true; | 509 return true; |
| 530 }, | 510 }, |
| 531 | 511 |
| 532 /** | 512 /** |
| 533 * @param {!File} file | 513 * @param {!File} file |
| 534 */ | 514 */ |
| 535 _loadFromFile: function(file) | 515 _loadFromFile: function(file) |
| 536 { | 516 { |
| 537 if (this._state !== WebInspector.TimelinePanel.State.Idle) | 517 if (this._state !== WebInspector.TimelinePanel.State.Idle) |
| 538 return; | 518 return; |
| 539 WebInspector.TimelineLoader.loadFromFile(this._model, file, this._prepar
eToLoadTimeline()); | 519 this._prepareToLoadTimeline(); |
| 520 this._loader = WebInspector.TimelineLoader.loadFromFile(this._tracingMod
el, file, this); |
| 540 this._createFileSelector(); | 521 this._createFileSelector(); |
| 541 }, | 522 }, |
| 542 | 523 |
| 543 /** | 524 /** |
| 544 * @param {string} url | 525 * @param {string} url |
| 545 */ | 526 */ |
| 546 _loadFromURL: function(url) | 527 _loadFromURL: function(url) |
| 547 { | 528 { |
| 548 if (this._state !== WebInspector.TimelinePanel.State.Idle) | 529 if (this._state !== WebInspector.TimelinePanel.State.Idle) |
| 549 return; | 530 return; |
| 550 WebInspector.TimelineLoader.loadFromURL(this._model, url, this._prepareT
oLoadTimeline()); | 531 this._prepareToLoadTimeline(); |
| 532 this._loader = WebInspector.TimelineLoader.loadFromURL(this._tracingMode
l, url, this); |
| 551 }, | 533 }, |
| 552 | 534 |
| 553 _refreshViews: function() | 535 _refreshViews: function() |
| 554 { | 536 { |
| 555 for (var i = 0; i < this._currentViews.length; ++i) { | 537 for (var i = 0; i < this._currentViews.length; ++i) { |
| 556 var view = this._currentViews[i]; | 538 var view = this._currentViews[i]; |
| 557 view.refreshRecords(); | 539 view.refreshRecords(); |
| 558 } | 540 } |
| 559 this._updateSelectionDetails(); | 541 this._updateSelectionDetails(); |
| 560 }, | 542 }, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 this._recordingOptionUIControls.forEach(handler); | 612 this._recordingOptionUIControls.forEach(handler); |
| 631 }, | 613 }, |
| 632 | 614 |
| 633 /** | 615 /** |
| 634 * @param {boolean} userInitiated | 616 * @param {boolean} userInitiated |
| 635 */ | 617 */ |
| 636 _startRecording: function(userInitiated) | 618 _startRecording: function(userInitiated) |
| 637 { | 619 { |
| 638 console.assert(!this._statusPane, "Status pane is already opened."); | 620 console.assert(!this._statusPane, "Status pane is already opened."); |
| 639 this._setState(WebInspector.TimelinePanel.State.StartPending); | 621 this._setState(WebInspector.TimelinePanel.State.StartPending); |
| 640 this._statusPane = new WebInspector.TimelinePanel.StatusPane(); | 622 this._statusPane = new WebInspector.TimelinePanel.StatusPane(true, this.
_stopRecording.bind(this)); |
| 641 this._statusPane.addEventListener(WebInspector.TimelinePanel.StatusPane.
Events.Finish, this._stopRecording, this); | |
| 642 this._statusPane.showPane(this._statusPaneContainer); | 623 this._statusPane.showPane(this._statusPaneContainer); |
| 643 this._statusPane.updateStatus(WebInspector.UIString("Initializing record
ing\u2026")); | 624 this._statusPane.updateStatus(WebInspector.UIString("Initializing record
ing\u2026")); |
| 644 | 625 |
| 645 this._autoRecordGeneration = userInitiated ? null : Symbol("Generation")
; | 626 this._autoRecordGeneration = userInitiated ? null : Symbol("Generation")
; |
| 646 this._model.startRecording(true, this._captureJSProfileSetting.get(), th
is._captureMemorySetting.get(), this._captureLayersAndPicturesSetting.get(), thi
s._captureFilmStripSetting && this._captureFilmStripSetting.get()); | 627 this._model.startRecording(true, this._captureJSProfileSetting.get(), th
is._captureMemorySetting.get(), this._captureLayersAndPicturesSetting.get(), thi
s._captureFilmStripSetting && this._captureFilmStripSetting.get()); |
| 647 | 628 |
| 648 for (var i = 0; i < this._overviewControls.length; ++i) | 629 for (var i = 0; i < this._overviewControls.length; ++i) |
| 649 this._overviewControls[i].timelineStarted(); | 630 this._overviewControls[i].timelineStarted(); |
| 650 | 631 |
| 651 if (userInitiated) | 632 if (userInitiated) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 this._stopRecording(); | 672 this._stopRecording(); |
| 692 }, | 673 }, |
| 693 | 674 |
| 694 _garbageCollectButtonClicked: function() | 675 _garbageCollectButtonClicked: function() |
| 695 { | 676 { |
| 696 var targets = WebInspector.targetManager.targets(); | 677 var targets = WebInspector.targetManager.targets(); |
| 697 for (var i = 0; i < targets.length; ++i) | 678 for (var i = 0; i < targets.length; ++i) |
| 698 targets[i].heapProfilerAgent().collectGarbage(); | 679 targets[i].heapProfilerAgent().collectGarbage(); |
| 699 }, | 680 }, |
| 700 | 681 |
| 701 _onClearButtonClick: function() | 682 _clear: function() |
| 702 { | 683 { |
| 703 this._tracingModel.reset(); | 684 this._tracingModel.reset(); |
| 704 this._model.reset(); | 685 this._model.reset(); |
| 705 this._showRecordingHelpMessage(); | 686 this._showRecordingHelpMessage(); |
| 706 }, | 687 }, |
| 707 | 688 |
| 708 _onRecordsCleared: function() | 689 _onRecordsCleared: function() |
| 709 { | 690 { |
| 710 this.requestWindowTimes(0, Infinity); | 691 this.requestWindowTimes(0, Infinity); |
| 711 delete this._selection; | 692 delete this._selection; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 this._setMarkers(); | 790 this._setMarkers(); |
| 810 this._overviewPane.scheduleUpdate(); | 791 this._overviewPane.scheduleUpdate(); |
| 811 this._updateSearchHighlight(false, true); | 792 this._updateSearchHighlight(false, true); |
| 812 if (this._statusPane) { | 793 if (this._statusPane) { |
| 813 this._statusPane.hide(); | 794 this._statusPane.hide(); |
| 814 delete this._statusPane; | 795 delete this._statusPane; |
| 815 } | 796 } |
| 816 this._detailsSplitWidget.showBoth(); | 797 this._detailsSplitWidget.showBoth(); |
| 817 }, | 798 }, |
| 818 | 799 |
| 800 /** |
| 801 * @override |
| 802 */ |
| 803 loadingStarted: function() |
| 804 { |
| 805 this._hideRecordingHelpMessage(); |
| 806 this._model.startCollectingTraceEvents(true); |
| 807 |
| 808 if (this._statusPane) |
| 809 this._statusPane.hide(); |
| 810 this._statusPane = new WebInspector.TimelinePanel.StatusPane(false, this
._cancelLoading.bind(this)); |
| 811 this._statusPane.showPane(this._statusPaneContainer); |
| 812 this._statusPane.updateStatus(WebInspector.UIString("Loading timeline\u2
026")); |
| 813 this.loadingProgress(0); |
| 814 }, |
| 815 |
| 816 /** |
| 817 * @override |
| 818 * @param {number=} progress |
| 819 */ |
| 820 loadingProgress: function(progress) |
| 821 { |
| 822 if (typeof progress === "number") |
| 823 this._statusPane.updateProgressBar(WebInspector.UIString("Received")
, progress * 100); |
| 824 }, |
| 825 |
| 826 /** |
| 827 * @override |
| 828 * @param {boolean} success |
| 829 */ |
| 830 loadingComplete: function(success) |
| 831 { |
| 832 if (!success) { |
| 833 this._onRecordingStopped(); |
| 834 this._clear(); |
| 835 } else { |
| 836 this._model.tracingComplete(); |
| 837 } |
| 838 delete this._loader; |
| 839 }, |
| 840 |
| 841 _cancelLoading: function() |
| 842 { |
| 843 if (this._loader) |
| 844 this._loader.cancel(); |
| 845 }, |
| 846 |
| 819 _setMarkers: function() | 847 _setMarkers: function() |
| 820 { | 848 { |
| 821 var markers = new Map(); | 849 var markers = new Map(); |
| 822 var recordTypes = WebInspector.TimelineModel.RecordType; | 850 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 823 var zeroTime = this._model.minimumRecordTime(); | 851 var zeroTime = this._model.minimumRecordTime(); |
| 824 for (var record of this._model.eventDividerRecords()) { | 852 for (var record of this._model.eventDividerRecords()) { |
| 825 if (record.type() === recordTypes.TimeStamp || record.type() === rec
ordTypes.ConsoleTime) | 853 if (record.type() === recordTypes.TimeStamp || record.type() === rec
ordTypes.ConsoleTime) |
| 826 continue; | 854 continue; |
| 827 markers.set(record.startTime(), WebInspector.TimelineUIUtils.createD
ividerForRecord(record, zeroTime, 0)); | 855 markers.set(record.startTime(), WebInspector.TimelineUIUtils.createD
ividerForRecord(record, zeroTime, 0)); |
| 828 } | 856 } |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 leftTime = Math.max(leftTime - 0.05 * span, this._tracingModel.minim
umRecordTime()); | 1266 leftTime = Math.max(leftTime - 0.05 * span, this._tracingModel.minim
umRecordTime()); |
| 1239 rightTime = Math.min(rightTime + 0.05 * span, this._tracingModel.max
imumRecordTime()); | 1267 rightTime = Math.min(rightTime + 0.05 * span, this._tracingModel.max
imumRecordTime()); |
| 1240 } | 1268 } |
| 1241 this.requestWindowTimes(leftTime, rightTime); | 1269 this.requestWindowTimes(leftTime, rightTime); |
| 1242 }, | 1270 }, |
| 1243 | 1271 |
| 1244 __proto__: WebInspector.Panel.prototype | 1272 __proto__: WebInspector.Panel.prototype |
| 1245 } | 1273 } |
| 1246 | 1274 |
| 1247 /** | 1275 /** |
| 1276 * @interface |
| 1277 */ |
| 1278 WebInspector.TimelineLifecycleDelegate = function() |
| 1279 { |
| 1280 } |
| 1281 |
| 1282 WebInspector.TimelineLifecycleDelegate.prototype = { |
| 1283 loadingStarted: function() {}, |
| 1284 |
| 1285 /** |
| 1286 * @param {number=} progress |
| 1287 */ |
| 1288 loadingProgress: function(progress) {}, |
| 1289 |
| 1290 /** |
| 1291 * @param {boolean} success |
| 1292 */ |
| 1293 loadingComplete: function(success) {}, |
| 1294 }; |
| 1295 |
| 1296 |
| 1297 /** |
| 1248 * @constructor | 1298 * @constructor |
| 1249 * @extends {WebInspector.VBox} | 1299 * @extends {WebInspector.VBox} |
| 1250 * @implements {WebInspector.TimelineModeView} | 1300 * @implements {WebInspector.TimelineModeView} |
| 1251 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 1301 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
| 1252 * @param {!WebInspector.TimelineTreeView} innerTreeView | 1302 * @param {!WebInspector.TimelineTreeView} innerTreeView |
| 1253 */ | 1303 */ |
| 1254 WebInspector.TimelineTreeModeView = function(delegate, innerTreeView) | 1304 WebInspector.TimelineTreeModeView = function(delegate, innerTreeView) |
| 1255 { | 1305 { |
| 1256 WebInspector.VBox.call(this); | 1306 WebInspector.VBox.call(this); |
| 1257 this._treeView = innerTreeView; | 1307 this._treeView = innerTreeView; |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1733 return true; | 1783 return true; |
| 1734 } | 1784 } |
| 1735 }, | 1785 }, |
| 1736 | 1786 |
| 1737 __proto__: WebInspector.TimelineModel.Filter.prototype | 1787 __proto__: WebInspector.TimelineModel.Filter.prototype |
| 1738 } | 1788 } |
| 1739 | 1789 |
| 1740 /** | 1790 /** |
| 1741 * @constructor | 1791 * @constructor |
| 1742 * @extends {WebInspector.VBox} | 1792 * @extends {WebInspector.VBox} |
| 1793 * @param {boolean} showTimer |
| 1794 * @param {function()} stopCallback |
| 1743 */ | 1795 */ |
| 1744 WebInspector.TimelinePanel.StatusPane = function() | 1796 WebInspector.TimelinePanel.StatusPane = function(showTimer, stopCallback) |
| 1745 { | 1797 { |
| 1746 WebInspector.VBox.call(this, true); | 1798 WebInspector.VBox.call(this, true); |
| 1747 this.registerRequiredCSS("timeline/timelineStatusDialog.css"); | 1799 this.registerRequiredCSS("timeline/timelineStatusDialog.css"); |
| 1748 this.contentElement.classList.add("timeline-status-dialog"); | 1800 this.contentElement.classList.add("timeline-status-dialog"); |
| 1749 | 1801 |
| 1750 var statusLine = this.contentElement.createChild("div", "status-dialog-line
status"); | 1802 var statusLine = this.contentElement.createChild("div", "status-dialog-line
status"); |
| 1751 statusLine.createChild("div", "label").textContent = WebInspector.UIString("
Status"); | 1803 statusLine.createChild("div", "label").textContent = WebInspector.UIString("
Status"); |
| 1752 this._status = statusLine.createChild("div", "content"); | 1804 this._status = statusLine.createChild("div", "content"); |
| 1753 | 1805 |
| 1754 var timeLine = this.contentElement.createChild("div", "status-dialog-line ti
me"); | 1806 if (showTimer) { |
| 1755 timeLine.createChild("div", "label").textContent = WebInspector.UIString("Ti
me"); | 1807 var timeLine = this.contentElement.createChild("div", "status-dialog-lin
e time"); |
| 1756 this._time = timeLine.createChild("div", "content"); | 1808 timeLine.createChild("div", "label").textContent = WebInspector.UIString
("Time"); |
| 1757 | 1809 this._time = timeLine.createChild("div", "content"); |
| 1810 } |
| 1758 var progressLine = this.contentElement.createChild("div", "status-dialog-lin
e progress"); | 1811 var progressLine = this.contentElement.createChild("div", "status-dialog-lin
e progress"); |
| 1759 this._progressLabel = progressLine.createChild("div", "label"); | 1812 this._progressLabel = progressLine.createChild("div", "label"); |
| 1760 this._progressBar = progressLine.createChild("div", "indicator-container").c
reateChild("div", "indicator"); | 1813 this._progressBar = progressLine.createChild("div", "indicator-container").c
reateChild("div", "indicator"); |
| 1761 | 1814 |
| 1762 this._stopButton = createTextButton(WebInspector.UIString("Finish"), this._o
nFinish.bind(this)); | 1815 this._stopButton = createTextButton(WebInspector.UIString("Stop"), stopCallb
ack); |
| 1763 this.contentElement.createChild("div", "stop-button").appendChild(this._stop
Button); | 1816 this.contentElement.createChild("div", "stop-button").appendChild(this._stop
Button); |
| 1764 } | 1817 } |
| 1765 | 1818 |
| 1766 WebInspector.TimelinePanel.StatusPane.Events = { | |
| 1767 Finish: "Finish" | |
| 1768 } | |
| 1769 | |
| 1770 WebInspector.TimelinePanel.StatusPane.prototype = { | 1819 WebInspector.TimelinePanel.StatusPane.prototype = { |
| 1771 finish: function() | 1820 finish: function() |
| 1772 { | 1821 { |
| 1773 this._stopTimer(); | 1822 this._stopTimer(); |
| 1774 this._stopButton.disabled = true; | 1823 this._stopButton.disabled = true; |
| 1775 }, | 1824 }, |
| 1776 | 1825 |
| 1777 hide: function() | 1826 hide: function() |
| 1778 { | 1827 { |
| 1779 this.element.parentNode.classList.remove("tinted"); | 1828 this.element.parentNode.classList.remove("tinted"); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1801 * @param {string} activity | 1850 * @param {string} activity |
| 1802 * @param {number} percent | 1851 * @param {number} percent |
| 1803 */ | 1852 */ |
| 1804 updateProgressBar: function(activity, percent) | 1853 updateProgressBar: function(activity, percent) |
| 1805 { | 1854 { |
| 1806 this._progressLabel.textContent = activity; | 1855 this._progressLabel.textContent = activity; |
| 1807 this._progressBar.style.width = percent.toFixed(1) + "%"; | 1856 this._progressBar.style.width = percent.toFixed(1) + "%"; |
| 1808 this._updateTimer(); | 1857 this._updateTimer(); |
| 1809 }, | 1858 }, |
| 1810 | 1859 |
| 1811 _onFinish: function() | |
| 1812 { | |
| 1813 this.dispatchEventToListeners(WebInspector.TimelinePanel.StatusPane.Even
ts.Finish); | |
| 1814 }, | |
| 1815 | |
| 1816 startTimer: function() | 1860 startTimer: function() |
| 1817 { | 1861 { |
| 1818 this._startTime = Date.now(); | 1862 this._startTime = Date.now(); |
| 1819 this._timeUpdateTimer = setInterval(this._updateTimer.bind(this, false),
1000); | 1863 this._timeUpdateTimer = setInterval(this._updateTimer.bind(this, false),
1000); |
| 1820 this._updateTimer(); | 1864 this._updateTimer(); |
| 1821 }, | 1865 }, |
| 1822 | 1866 |
| 1823 _stopTimer: function() | 1867 _stopTimer: function() |
| 1824 { | 1868 { |
| 1825 if (!this._timeUpdateTimer) | 1869 if (!this._timeUpdateTimer) |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2116 * @override | 2160 * @override |
| 2117 * @param {!WebInspector.Target} target | 2161 * @param {!WebInspector.Target} target |
| 2118 */ | 2162 */ |
| 2119 targetRemoved: function(target) | 2163 targetRemoved: function(target) |
| 2120 { | 2164 { |
| 2121 this._targets.remove(target, true); | 2165 this._targets.remove(target, true); |
| 2122 }, | 2166 }, |
| 2123 | 2167 |
| 2124 __proto__: WebInspector.Object.prototype | 2168 __proto__: WebInspector.Object.prototype |
| 2125 } | 2169 } |
| OLD | NEW |