haikuwebkit/Websites/perf.webkit.org/browser-tests/index.html

403 lines
15 KiB
HTML
Raw Permalink Normal View History

Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
<!DOCTYPE html>
<html>
<head>
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
<meta charset="utf-8">
Add a mechanism to dispatch and listen to an action https://bugs.webkit.org/show_bug.cgi?id=167191 Reviewed by Antti Koivisto. Added the notion of an action to components. Like DOM events, it can be dispatched or listen to. Also added ComponentBase.prototype.part which finds a sub-component inside a component's shadow tree, and made ComponentBase.prototype.content take an id to find an element that matches it. * browser-tests/close-button-tests.js: Added. Tests for CloseButton. * browser-tests/component-base-tests.js: Added tests for ComponentBase's part(~), content(id), dispatchEvent. * browser-tests/index.html: * public/v3/components/base.js: (ComponentBase): Added this._actionCallbacks, which is a map of an action name to a callback to be invoked. (ComponentBase.prototype.content): Return an element of the given id if one is specified. (ComponentBase.prototype.part): Find a component whose element has the matching id. (ComponentBase.prototype.dispatchAction): Added. (ComponentBase.prototype.listenToAction): Added. (ComponentBase.prototype._ensureShadowTree): Call didConstructShadowTree. (ComponentBase.prototype.didConstructShadowTree): Added. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Copy attributes when instantiating an element for a component when the browser doesn't support custom elements API. (ComponentBase.createLink): (ComponentBase.prototype.createEventHandler): Added. (ComponentBase.createEventHandler): Renamed from createActionHandler. * public/v3/components/button-base.js: (ButtonBase.prototype.didConstructShadowTree): Added. Dispatch "activate" action when the button is clicked. (ButtonBase.prototype.setCallback): Deleted. (ButtonBase.htmlTemplate): Use id instead of class so that this.content() can find it. (ButtonBase.cssTemplate): Updated style rules. * public/v3/pages/chart-pane.js: (ChartPane): (ChartPane.prototype.didConstructShadowTree): Added. Listen to "activate" action on the close button. (ChartPane.prototype.render): Fixed a bug that we were never calling enqueueToRender on the close button. (ChartPane.htmlTemplate): Add the id on the close button. Canonical link: https://commits.webkit.org/184266@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-19 22:58:46 +00:00
<title>In-Browser Tests for Performance Dashboard</title>
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
<script src="../node_modules/mocha/mocha.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/expect.js/0.2.0/expect.min.js"></script>
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
<script>
mocha.setup('bdd');
</script>
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
<script src="../unit-tests/resources/mock-remote-api.js"></script>
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
</head>
<body>
<div id="mocha"></div>
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
<script src="async-task-tests.js"></script>
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
<script src="component-base-tests.js"></script>
<script src="page-tests.js"></script>
<script src="page-router-tests.js"></script>
Add a mechanism to dispatch and listen to an action https://bugs.webkit.org/show_bug.cgi?id=167191 Reviewed by Antti Koivisto. Added the notion of an action to components. Like DOM events, it can be dispatched or listen to. Also added ComponentBase.prototype.part which finds a sub-component inside a component's shadow tree, and made ComponentBase.prototype.content take an id to find an element that matches it. * browser-tests/close-button-tests.js: Added. Tests for CloseButton. * browser-tests/component-base-tests.js: Added tests for ComponentBase's part(~), content(id), dispatchEvent. * browser-tests/index.html: * public/v3/components/base.js: (ComponentBase): Added this._actionCallbacks, which is a map of an action name to a callback to be invoked. (ComponentBase.prototype.content): Return an element of the given id if one is specified. (ComponentBase.prototype.part): Find a component whose element has the matching id. (ComponentBase.prototype.dispatchAction): Added. (ComponentBase.prototype.listenToAction): Added. (ComponentBase.prototype._ensureShadowTree): Call didConstructShadowTree. (ComponentBase.prototype.didConstructShadowTree): Added. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Copy attributes when instantiating an element for a component when the browser doesn't support custom elements API. (ComponentBase.createLink): (ComponentBase.prototype.createEventHandler): Added. (ComponentBase.createEventHandler): Renamed from createActionHandler. * public/v3/components/button-base.js: (ButtonBase.prototype.didConstructShadowTree): Added. Dispatch "activate" action when the button is clicked. (ButtonBase.prototype.setCallback): Deleted. (ButtonBase.htmlTemplate): Use id instead of class so that this.content() can find it. (ButtonBase.cssTemplate): Updated style rules. * public/v3/pages/chart-pane.js: (ChartPane): (ChartPane.prototype.didConstructShadowTree): Added. Listen to "activate" action on the close button. (ChartPane.prototype.render): Fixed a bug that we were never calling enqueueToRender on the close button. (ChartPane.htmlTemplate): Add the id on the close button. Canonical link: https://commits.webkit.org/184266@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-19 22:58:46 +00:00
<script src="close-button-tests.js"></script>
Modernize editable-text component and add tests https://bugs.webkit.org/show_bug.cgi?id=167398 Reviewed by Yusuke Suzuki. Modernized EditableText component to use the action feature added in r210938. * browser-tests/editable-text-tests.js: Added. Added tests for EditableText component. (.waitToRender): * browser-tests/index.html: * public/v3/components/base.js: (ComponentBase.prototype.dispatchAction): Return the result from the callback. * public/v3/components/editable-text.js: (EditableText): Removed a bunch of instance variables that are no longer needed. (EditableText.prototype.didConstructShadowTree): Added. Add event listeners on the Edit/Save button and the host. (EditableText.prototype.editedText): Return the text field's value directly. (EditableText.prototype.text): Added. (EditableText.prototype.setText): Call enqueueToRender automatically instead of relying on the parent component to do so in _startedEditingCallback, which has been removed. (EditableText.prototype.render): Modernized the code. (EditableText.prototype._didClick): No longer prevents the default action manually since that's automatically done in createEventHandler. Handle the case where the update action is not handled. (EditableText.prototype._endEditingMode): Renamed from _didUpdate. (EditableText.htmlTemplate): Added ids on various elements in the shadow tree. (EditableText.cssTemplate): Updated the CSS selectors per above change. * public/v3/main.js: (main): Fixed a typo. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Use the action listener instead of manually setting callbacks. (AnalysisTaskPage.prototype._createTestGroupListItem): Ditto. (AnalysisTaskPage.prototype._didStartEditingTaskName): Deleted. Canonical link: https://commits.webkit.org/184479@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-26 04:00:41 +00:00
<script src="editable-text-tests.js"></script>
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
<script src="time-series-chart-tests.js"></script>
<script src="interactive-time-series-chart-tests.js"></script>
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
<script src="chart-status-evaluator-tests.js"></script>
<script src="chart-revision-range-tests.js"></script>
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
<script src="commit-log-viewer-tests.js"></script>
<script src="test-group-form-tests.js"></script>
Add UI in analysis task page to show commit testability information. https://bugs.webkit.org/show_bug.cgi?id=192972 Reviewed by Ryosuke Niwa. Add UI in custom analysis task configuration and customizable test group form to show testability information. Fix a bug in 'CustomAnalysisTaskConfigurator._updateCommitSetMap' that 'currentComparison' is incorrectly set. SQL to update existing database: ALTER TABLE commits ADD COLUMN IF NOT EXISTS commit_testability varchar(128) DEFAULT NULL; * browser-tests/custom-analysis-task-configurator-tests.js: Added a unit test for the bug in 'CustomAnalysisTaskConfigurator._updateCommitSetMap'. Added a unit test to make sure 'CustomAnalysisTaskConfigurator' still works when commit fetching never returns. * browser-tests/index.html: Imported ''custom-analysis-task-configurator-tests.js'. * init-database.sql: Increase 'commit_testability' field length from 64 characters to 128. * public/v3/components/custom-analysis-task-configurator.js: Added UI to show testability information. (CustomAnalysisTaskConfigurator): (CustomAnalysisTaskConfigurator.prototype._didUpdateSelectedPlatforms): Should reset related field for corresponding repositories that user does not specify revision. (CustomAnalysisTaskConfigurator.prototype._updateMapFromSpecifiedRevisionsForConfiguration): A helper function to update '_specifiedCommits' and '_invalidRevisionsByConfiguration' per '_specifiedRevisions'. (CustomAnalysisTaskConfigurator.prototype.render): (CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Fixed a bug that 'currentComparison' is incorrectly set. (CustomAnalysisTaskConfigurator.prototype._computeCommitSet): (CustomAnalysisTaskConfigurator.prototype.async._fetchCommitsForConfiguration): (CustomAnalysisTaskConfigurator.prototype.async._resolveRevision): (CustomAnalysisTaskConfigurator.prototype._buildRevisionTable): (CustomAnalysisTaskConfigurator.prototype._buildTestabilityList): (CustomAnalysisTaskConfigurator.prototype._selectRepositoryGroup): (CustomAnalysisTaskConfigurator.prototype._buildRevisionInput): (CustomAnalysisTaskConfigurator.cssTemplate): * public/v3/components/customizable-test-group-form.js: Added UI to show testability information. (CustomizableTestGroupForm.prototype._renderCustomRevisionTable): (CustomizableTestGroupForm.prototype._constructTestabilityRows.): (CustomizableTestGroupForm.prototype._constructTestabilityRows): (CustomizableTestGroupForm.prototype._constructRevisionRadioButtons): Changing either revision editor or radio button should trigger a re-render as testability information for updated revision may change. (CustomizableTestGroupForm.cssTemplate): * public/v3/models/commit-set.js: (IntermediateCommitSet.prototype.commitsWithTestability): Renamed from 'commitsWithTestabilityWarnings'. (IntermediateCommitSet.prototype.commitsWithTestabilityWarnings): Deleted. Canonical link: https://commits.webkit.org/208032@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-17 05:56:18 +00:00
<script src="custom-analysis-task-configurator-tests.js"></script>
<script src="customizable-test-group-form-tests.js"></script>
Add the basic support for writing components in node.js https://bugs.webkit.org/show_bug.cgi?id=186299 Reviewed by Antti Koivisto. Add the basic support for writing components in node.js for generating rich email notifications. To do this, this patch introduces MarkupComponentBase and MarkupPage which implement similar API to ComponentBase and Page classes of v3 UI code. This enables us to share code between frontend and the backend in the future. Because there is no support for declarative custom elements or shadow root in HTML, MarkupComponentBase uses a similar but distinct concept of "content" tree to represent the "DOM" tree for a component. When generating the HTML, MarkupComponentBase and MarkupPage collectively transforms stylesheets and flattens the tree into a single HTML. In order to keep this flatteneing logic simple, MarkupComponentBase only supports a very small subset of CSS selectors to select elements by their local names and class names. Specifically, each class name and element name based selectors are replaced by a globally unique class name based selector, and each element which matches the selector is applied of the same globally unique class name. The transformation is applied when constructing the "content" tree as well as calls to renderReplace. Because much of v3 frontend code relies on DOM API, this patch also implements the simplest form of a fake DOM API as MarkupNode, MarkupParentNode, MarkupElement, and MarkupText. In order to avoid reimplementing HTML & CSS parsers, this patch introduces the concept of content and style templates to ComponentBase which are JSON alternatives to HTML & CSS template strings which can be used in both frontend & backend. * browser-tests/close-button-tests.js: Include CommonComponentBase. * browser-tests/commit-log-viewer-tests.js: Ditto. * browser-tests/component-base-tests.js: Ditto. Added a test cases for content & style templates. (async.importComponentBase): Added. * browser-tests/editable-text-tests.js: Include CommonComponentBase. * browser-tests/index.html: * browser-tests/markup-page-tests.js: Added. * browser-tests/page-router-tests.js: Include CommonComponentBase. * browser-tests/page-tests.js: Ditto. * browser-tests/test-group-form-tests.js: Ditto. * public/shared/common-component-base.js: Added. (CommonComponentBase): Extracted out of ComponentBase. (CommonComponentBase.prototype.renderReplace): Added. (CommonComponentBase.renderReplace): Moved from ComponentBase. (CommonComponentBase.prototype._recursivelyUpgradeUnknownElements): Moved and renamed from ComponentBase's _recursivelyReplaceUnknownElementsByComponents. (CommonComponentBase.prototype._upgradeUnknownElement): Extracted out of the same function. (CommonComponentBase._constructStylesheetFromTemplate): Added. (CommonComponentBase._constructNodeTreeFromTemplate): Added. (CommonComponentBase.prototype.createElement): Added. (CommonComponentBase.createElement): Moved from ComponentBase. (CommonComponentBase._addContentToElement): Moved from ComponentBase. (CommonComponentBase.prototype.createLink): Added. (CommonComponentBase.createLink): Moved from ComponentBase. (CommonComponentBase._context): Added. Set to document in a browser and MarkupDocument in node.js. (CommonComponentBase._isNode): Added. Set to a function which does instanceof Node/MarkupNode check. (CommonComponentBase._baseClass): Added. Set to ComponentBase or MarkupComponentBase. * public/v3/components/base.js: (ComponentBase): (ComponentBase.prototype._ensureShadowTree): Added the support for the content and style templates. Also avoid parsing the html template each time a component is instantiated by caching the result. * public/v3/index.html: * tools/js/markup-component.js: Added. (MarkupDocument): Added. A fake Document. (MarkupDocument.prototype.createContentRoot): A substitude for attachShadow. (MarkupDocument.prototype.createElement): (MarkupDocument.prototype.createTextNode): (MarkupDocument.prototype._idForClone): (MarkupDocument.prototype.reset): (MarkupDocument.prototype.markup): (MarkupDocument.prototype.escapeAttributeValue): (MarkupDocument.prototype.escapeNodeData): (MarkupNode): Added. A fake Node. Each node gets an unique ID. (MarkupNode.prototype._markup): (MarkupNode.prototype.clone): Implemented by the leave class. (MarkupNode.prototype._cloneNodeData): (MarkupNode.prototype.remove): (MarkupParentNode): Added. An equivalent of ContainerNode in WebCore. (MarkupParentNode.prototype.get childNodes): (MarkupParentNode.prototype._cloneNodeData): (MarkupParentNode.prototype.appendChild): (MarkupParentNode.prototype.removeChild): (MarkupParentNode.prototype.removeAllChildren): (MarkupParentNode.prototype.replaceChild): (MarkupContentRoot): Added. Used like a shadow tree. (MarkupContentRoot.prototype._markup): Added. (MarkupElement): Added. A fake Element. It also implements a subset of IDL attributes implemented by subclasses such as HTMLInputElement for simplicity. (MarkupElement.prototype.get id): Added. (MarkupElement.prototype.get localName): Added. (MarkupElement.prototype.clone): Added. (MarkupElement.prototype.appendChild): Added. (MarkupElement.prototype.addEventListener): Added. (MarkupElement.prototype.setAttribute): Added. (MarkupElement.prototype.getAttribute): Added. (MarkupElement.prototype.get attributes): Added. (MarkupElement.prototype.get textContent): Added. (MarkupElement.prototype.set textContent): Added. (MarkupElement.prototype._serializeStyle): Added. (MarkupElement.prototype._markup): Added. Flattens the tree with content tree like copy & paste so this can't be used to implement innerHTML. (MarkupElement.prototype.get value): Added. (MarkupElement.prototype.set value): Added. (MarkupElement.prototype.get style): Added. Returns a fake writeonly CSSStyleDeclaration. (MarkupElement.prototype.set style): Added. (MarkupElement.get selfClosingNames): Added. A small list of self-closing tags for the HTML generation. (MarkupText): Added. (MarkupText.prototype.clone): Added. (MarkupText.prototype._markup): Added. (MarkupText.prototype.get data): Added. (MarkupText.prototype.set data): Added. (MarkupComponentBase): Added. (MarkupComponentBase.prototype.element): Added. Like ComponentBase's element. (MarkupComponentBase.prototype.content): Added. Like ComponentBase's content. (MarkupComponentBase.prototype._findElementRecursivelyById): Added. A fake getElementById. (MarkupComponentBase.prototype.render): Added. Like ComponentBase's render. (MarkupComponentBase.prototype.runRenderLoop): Added. In ComponentBase, we use requestAnimationFrame. In MarkupComponentBase, we keep rendering until the queue drains empty. (MarkupComponentBase.prototype.renderReplace): Added. Like ComponentBase's renderReplace but applies the transformation of classes to workaround the lack of shadow tree support in scriptless HTML. (MarkupComponentBase.prototype._applyStyleOverrides): Added. Recursively applies the transformation. (MarkupComponentBase.prototype._ensureContentTree): Added. Like ComponentBase's _ensureShadowTree. (MarkupComponentBase.reset): Added. (MarkupComponentBase._parseTemplates): Added. Parses the content & style templates, and generates the transformed fake DOM tree and stylesheet text whereby selectors in each component is modified to be unique across all components. The function to apply the necessary changes to an element is saved in the global map of components, and later used in renderReplace via _applyStyleOverrides. (MarkupComponentBase.defineElement): Added. Like ComponentBase's defineElement. (MarkupComponentBase.prototype.createEventHandler): Added. (MarkupComponentBase.createEventHandler): Added. (MarkupPage): Added. The top-level component responsible for generating a DOCTYPE, head, and body. (MarkupPage.prototype.pageTitle): Added. (MarkupPage.prototype.content): Added. Overrides the one in MarkupComponentBase to return what would be the content of the body element as opposed to the html element for the connivance of subclasses, and to match the behavior of the frontend Page class. (MarkupPage.prototype.render): Added. (MarkupPage.prototype._updateComponentsStylesheet): Added. Concatenates the transformed stylesheet of all components used. (MarkupPage.get contentTemplate): Added. (MarkupPage.prototype.generateMarkup): Added. Enqueues the page to render, spin the render loop, and generates the HTML. We enqueue the page twice in order to invoke _updateComponentsStylesheet after all subcomponent had finished rendering. * unit-tests/markup-component-base-tests.js: Added. * unit-tests/markup-element-tests.js: Added. (.createElement): Added. * unit-tests/markup-page-tests.js: Added. Canonical link: https://commits.webkit.org/201761@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-07 18:25:35 +00:00
<script src="markup-page-tests.js"></script>
Added sending notification feature when test group finishes. https://bugs.webkit.org/show_bug.cgi?id=184340 Reviewed by Ryosuke Niwa. Added 'testgroup_needs_notification' filed to 'analysis_test_group' table to indicate whether a test group has a pending notification. Added 'testgroup_notification_sent_at' to record the last notification sent time. SQL queries to update existing database are: 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_needs_notification boolean NOT NULL DEFAULT FALSE;' 'ALTER TABLE analysis_test_groups ADD COLUMN testgroup_notification_sent_at timestamp DEFAULT NULL;' Updated 'run-analysis' script to be able to send notification when test group finishes. Added 'Notify on completion' checkbox while creating/retrying/bisecting a test group. * browser-tests/test-group-form-tests.js: Updated existing tests and added a new test. * browser-tests/test-group-result-page-tests.js: Added unit tests for TestGroupResultPage. * init-database.sql: Added 'testgroup_needs_notification' filed to 'analysis_test_group' table. * public/api/test-groups.php: Added '/api/test-groups/ready-for-notification' API to 'test-group' to show all test groups that need to send notification. Only the ones with 'completed', 'failed' or 'cancelled' status and its 'testgroup_needs_notification' is true will be returned by this API. * public/include/build-requests-fetcher.php: Added 'fetch_requests_for_groups' to return test groups with given ids. * public/include/commit-sets-helpers.php: Updated the logic to support setting 'testgroup_needs_notification' while create an analysis_test_groups. * public/privileged-api/create-analysis-task.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/create-test-group.php: Updated the logic to support setting 'testgroup_needs_notification'. * public/privileged-api/update-test-group.php: Updated the logic to support updating 'testgroup_needs_notification'. Extended this API to allow authentication both from CSRF token and slave. * public/v3/components/custom-configuration-test-group-form.js: (CustomConfigurationTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (CustomizableTestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/components/test-group-form.js: (TestGroupForm): Added '_notifyOnCompletion' instance variable. (TestGroupForm.prototype.didConstructShadowTree): Added 'onchange' event for notify on completion checkbox. (TestGroupForm.prototype.startTesting): Pass 'notifyOnCompletion' information which represents 'testgroup_needs_notification' from API perspective. (TestGroupForm.cssTemplate): Added space between 'Notify on completion' checkbox and test group iteration selection list. * public/v3/models/analysis-results.js: Export 'AnalysisResults'. (AnalysisResults.fetch): Update API path to use absolute url. (AnalysisResults): * public/v3/models/analysis-task.js: (AnalysisTask.async.create): Extend this function to take notifyOnCompletion as argument which will be used as 'needsNotification' to send to server. (AnalysisTask): * public/v3/models/test-group.js: (TestGroup): Added '_needsNotification' field. (TestGroup.prototype.updateSingleton): Added logic to update '_needsNotification' field. (TestGroup.prototype.needsNotification): Returns '_needsNotification' field. (TestGroup.prototype.author): Returns author information. (TestGroup.prototype.async.didSendNotification): API that updates 'testgroup_needs_notification' to true. (TestGroup.prototype.async.fetchTask): API to fetch the task when it has not been fetched. (TestGroup.createWithTask): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createWithCustomConfiguration): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.createAndRefetchTestGroups): Updated this function to accept 'notifyOnCompletion' which will be used as 'needsNotification' to send to server. (TestGroup.fetchAllWithNotificationReady): New function that invokes '/api/test-groups/ready-for-notification'. * public/v3/pages/analysis-task-page.js: Update logic to 'notifyOnCompletion' around (AnalysisTaskChartPane.prototype.didConstructShadowTree): (AnalysisTaskResultsPane.prototype.didConstructShadowTree): (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype.didConstructShadowTree): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype.async._bisectCurrentTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList.set const): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): (AnalysisTaskPage.prototype._createCustomTestGroup): * public/v3/pages/chart-pane.js: Added 'Notify on completion' checkbox. (ChartPane.prototype.didConstructShadowTree): (ChartPane.prototype.async._analyzeRange): * public/v3/pages/create-analysis-task-page.js: Adapted API change. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): * server-tests/api-test-groups.js: Added tests for '/api/test-groups/ready-for-notification'. * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests to adapt this change. Added new tests. * server-tests/privileged-api-create-test-group-tests.js: Added new tests. * server-tests/privileged-api-update-test-group-tests.js: Added unit test for 'update-test-group' API. * server-tests/resources/mock-data.js: addMockData should set 'testgroup_needs_notification' to be true. * server-tests/tools-sync-buildbot-integration-tests.js: Updated tests to adapt this change. (async.createTestGroupWihPatch): (createTestGroupWihOwnedCommit): * tools/js/analysis-results-notifier.js: Added notifier to send notification for completed test groups. (AnalysisResultsNotifier): (AnalysisResultsNotifier.prototype.async.sendNotificationsForTestGroups): (AnalysisResultsNotifier.prototype._sendNotification): Invoke remote API to send notification. (AnalysisResultsNotifier.prototype._constructMessageByRules): (AnalysisResultsNotifier._matchesRule): (AnalysisResultsNotifier._applyUpdate): (AnalysisResultsNotifier.async._messageForTestGroup): Build html as message body for a test group. (AnalysisResultsNotifier._URLForAnalysisTask): Returns URL for an analysis task. (AnalysisResultsNotifier._instantiateNotificationTemplate): * tools/js/test-group-result-page.js: Added 'TestGroupResultPage' and 'BarGraph' to show test group result. (TestGroupResultPage): (TestGroupResultPage.prototype.async.setTestGroup): (TestGroupResultPage._urlForAnalysisTask): (TestGroupResultPage.prototype._URLForAnalysisTask): (TestGroupResultPage.prototype.constructTables): (TestGroupResultPage.prototype._constructTableForMetric): (TestGroupResultPage.): (TestGroupResultPage.prototype.get pageContent): (TestGroupResultPage.prototype.get styleTemplate): (BarGraph): (BarGraph.prototype.setWidth): (BarGraph.prototype._constructBarGraph): (BarGraph.prototype.get pageContent): (BarGraph.prototype.get styleTemplate): * tools/js/measurement-set-analyzer.js: Adapted 'AnalysisTask.create' change. (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): (MeasurementSetAnalyzer): * tools/js/v3-models.js: * tools/run-analysis.js: Added the logic that sends notification for completed test groups. (main): (async.analysisLoop): * unit-tests/analysis-task-tests.js: * unit-tests/analysis-results-notifier-tests.js: Added a unit test for 'AnalysisResultsNotifier' and 'NotificationService'. * unit-tests/measurement-set-analyzer-tests.js: Updated unit tests per this change. * unit-tests/test-groups-tests.js: Added unit tests for 'TestGroup.needsNotification'. * unit-tests/resources/mock-remote-api.js: Only set 'privilegedAPI' when it exits. Canonical link: https://commits.webkit.org/201783@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-08 03:44:28 +00:00
<script src="test-group-result-page-tests.js"></script>
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
<script>
afterEach(() => {
BrowsingContext.cleanup();
});
class BrowsingContext {
constructor()
{
let iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.style.position = 'absolute';
iframe.style.left = '0px';
iframe.style.top = '0px';
BrowsingContext._iframes.push(iframe);
ComponentBase should enqueue itself to render when it becomes connected https://bugs.webkit.org/show_bug.cgi?id=169905 Reviewed by Antti Koivisto. When a component becomes connected to a document, enqueue itself to render automatically. Also added the support for boolean attribute to ComponentBase.createElement. * ReadMe.md: Added an instruction to raise the upload limit per r214065. * browser-tests/component-base-tests.js: Added tests for the new behavior and createElement. Also moved the tests related to enqueueToRenderOnResize out of defineElement tests. * browser-tests/index.html: (BrowsingContext.prototype.constructor): Override requestAnimationFrame so that the callback would be involved immediately durign testing. * public/v3/components/base.js: (ComponentBase): Enqueue itself to render during construction if custom elements is not available. (ComponentBase.defineElement): (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Enqueue itself to render when the component's element became connected. (ComponentBase.createElement): Use Array.isArray instead of instanceof to make it work with arrays made in other realms (global objects) during testing. Added the support for boolean attributes. Setting an attribute value to true would set the attribute, and setting it to false would not set the attribute. (ComponentBase.useNativeCustomElements): Added. True iff window.customElements is defined. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.render): No longer need to call enqueueToRender on the commit log viewer. * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype.render): No longer need to call enqueueToRender on the spinner icon. * public/v3/models/time-series.js: (TimeSeries): Made this a proper class declaration now that we don't include data.js after r213300. * public/v3/pages/chart-pane.js: (ChartPane.prototype._renderActionToolbar): No longer need to call enqueueToRender on the close icon. * public/v3/pages/summary-page.js: (SummaryPage.prototype._renderCell): No longer need to call enqueueToRender on the spinner icon. Canonical link: https://commits.webkit.org/186907@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214280 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-22 22:50:57 +00:00
// Expedite calls to callbacks to make tests go faster.
iframe.contentWindow.requestAnimationFrame = (callback) => setTimeout(callback, 0);
// Allow markup-component.js to function.
iframe.contentWindow.require = (module) => {
expect(module).to.be('assert');
return {
ok: (condition) => expect(!!condition).to.be(true)
};
}
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
this.iframe = iframe;
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
this.symbols = {};
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
this.global = this.iframe.contentWindow;
this.document = this.iframe.contentDocument;
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
this._didLoadMockRemote = false;
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
}
Make calls to render() functions async https://bugs.webkit.org/show_bug.cgi?id=167151 Reviewed by Andreas Kling. Make calls to render() async by coalescing calls inside enqueueToRender(), which has been renamed from updateRendering(). We now queue up all the components and wait until the next animation frame to invoke render() on all those components. This reduces render() calls in the summary page of our internal dashboard by 15x from ~9400 to ~600 by eliminating pathological O(n^2) behavior between render() calls. Consolidated TimeSeriesChart's enqueueRender into this newly added feature of ComponentBase along with the support to call render() on a resize event. New implementation makes use of connectedCallback and disconnectedCallback to avoid the work when the component is not in a document tree. The rest of the patch concerns with renaming updateRendering to enqueueToRender and fixing a few minor bugs that I encountered while working on this patch. * browser-tests/component-base-tests.js: Added tests for ComponentBase.enqueueToRender(). * browser-tests/index.html: (BrowserContext.prototype.importScripts): Renamed from importScript; Now supports loading multiple scripts. (BrowserContext.prototype.importScript): Added. (BrowserContext): Removed the unused createWithScripts. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): * public/v3/components/base.js: (ComponentBase): When the browser doesn't support custom elements and (ComponentBase.prototype.enqueueToRender): Renamed from updateRendering. Queues up the component to call render() instead of immediately invoking it. (ComponentBase.renderingTimerDidFire): Call render(). Since render() function often calls enqueueToRender on child components, go ahead and invoke render() on any components enqueued during render() calls. (ComponentBase._connectedComponentToRenderOnResize): Added. (ComponentBase._disconnectedComponentToRenderOnResize): Added. (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Added. This is an optimization to avoid the work when the component is not in the document; e.g. because the entire page component has been detached from the document. The old implementation in TimeSeriesChart was not doing this. (ComponentBase.defineElement.elementClass.prototype.disconnectedCallback): Added. (ComponentBase): Replaced unused static variables with _componentsToRender and _componentsToRenderOnResize. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype.didUpdateAnnotations): Added. Addresses the bug that the annotation bars in the charts shown an an analysis task doesn't update its color when the state is updated in the UI. (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/interactive-time-series-chart.js: * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the logic to update upon resize. See _connectedComponentToRenderOnResize above. (TimeSeriesChart.prototype.get enqueueToRenderOnResize): Added. Returns true. (TimeSeriesChart.prototype.enqueueToRender): Deleted. (TimeSeriesChart._renderEnqueuedCharts): Deleted. (TimeSeriesChart): Call ComponentBase.defineElement to make this a proper component so that the logic in connectedCallback to update upon resize event would work. * public/v3/instrumentation.js: (Instrumentation.dumpStatistics): Sort results by the key names. * public/v3/models/time-series.js: (TimeSeries.prototype.values): Added. This method was never ported to v3 in r198462, and broke the feature to show moving averages, etc... on the charts page. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): Fixed the bug that we were never updating annotation bars in the main chart by calling didUpdateAnnotations. (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._renderTrendLinePopover): Fixed a race condition. Insert a select element as needed before trying to assign the current value on it. (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184216@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-18 21:22:39 +00:00
importScripts(pathList, ...symbolList)
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
{
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
const doc = this.iframe.contentDocument;
const global = this.iframe.contentWindow;
Make calls to render() functions async https://bugs.webkit.org/show_bug.cgi?id=167151 Reviewed by Andreas Kling. Make calls to render() async by coalescing calls inside enqueueToRender(), which has been renamed from updateRendering(). We now queue up all the components and wait until the next animation frame to invoke render() on all those components. This reduces render() calls in the summary page of our internal dashboard by 15x from ~9400 to ~600 by eliminating pathological O(n^2) behavior between render() calls. Consolidated TimeSeriesChart's enqueueRender into this newly added feature of ComponentBase along with the support to call render() on a resize event. New implementation makes use of connectedCallback and disconnectedCallback to avoid the work when the component is not in a document tree. The rest of the patch concerns with renaming updateRendering to enqueueToRender and fixing a few minor bugs that I encountered while working on this patch. * browser-tests/component-base-tests.js: Added tests for ComponentBase.enqueueToRender(). * browser-tests/index.html: (BrowserContext.prototype.importScripts): Renamed from importScript; Now supports loading multiple scripts. (BrowserContext.prototype.importScript): Added. (BrowserContext): Removed the unused createWithScripts. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): * public/v3/components/base.js: (ComponentBase): When the browser doesn't support custom elements and (ComponentBase.prototype.enqueueToRender): Renamed from updateRendering. Queues up the component to call render() instead of immediately invoking it. (ComponentBase.renderingTimerDidFire): Call render(). Since render() function often calls enqueueToRender on child components, go ahead and invoke render() on any components enqueued during render() calls. (ComponentBase._connectedComponentToRenderOnResize): Added. (ComponentBase._disconnectedComponentToRenderOnResize): Added. (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Added. This is an optimization to avoid the work when the component is not in the document; e.g. because the entire page component has been detached from the document. The old implementation in TimeSeriesChart was not doing this. (ComponentBase.defineElement.elementClass.prototype.disconnectedCallback): Added. (ComponentBase): Replaced unused static variables with _componentsToRender and _componentsToRenderOnResize. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype.didUpdateAnnotations): Added. Addresses the bug that the annotation bars in the charts shown an an analysis task doesn't update its color when the state is updated in the UI. (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/interactive-time-series-chart.js: * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the logic to update upon resize. See _connectedComponentToRenderOnResize above. (TimeSeriesChart.prototype.get enqueueToRenderOnResize): Added. Returns true. (TimeSeriesChart.prototype.enqueueToRender): Deleted. (TimeSeriesChart._renderEnqueuedCharts): Deleted. (TimeSeriesChart): Call ComponentBase.defineElement to make this a proper component so that the logic in connectedCallback to update upon resize event would work. * public/v3/instrumentation.js: (Instrumentation.dumpStatistics): Sort results by the key names. * public/v3/models/time-series.js: (TimeSeries.prototype.values): Added. This method was never ported to v3 in r198462, and broke the feature to show moving averages, etc... on the charts page. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): Fixed the bug that we were never updating annotation bars in the main chart by calling didUpdateAnnotations. (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._renderTrendLinePopover): Fixed a race condition. Insert a select element as needed before trying to assign the current value on it. (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184216@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-18 21:22:39 +00:00
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
pathList = pathList.map((path) => `../public/v3/${path}`);
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
if (!this._didLoadMockRemote) {
this._didLoadMockRemote = true;
pathList.unshift('../unit-tests/resources/mock-remote-api.js');
}
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
return Promise.all(pathList.map((path) => {
Make calls to render() functions async https://bugs.webkit.org/show_bug.cgi?id=167151 Reviewed by Andreas Kling. Make calls to render() async by coalescing calls inside enqueueToRender(), which has been renamed from updateRendering(). We now queue up all the components and wait until the next animation frame to invoke render() on all those components. This reduces render() calls in the summary page of our internal dashboard by 15x from ~9400 to ~600 by eliminating pathological O(n^2) behavior between render() calls. Consolidated TimeSeriesChart's enqueueRender into this newly added feature of ComponentBase along with the support to call render() on a resize event. New implementation makes use of connectedCallback and disconnectedCallback to avoid the work when the component is not in a document tree. The rest of the patch concerns with renaming updateRendering to enqueueToRender and fixing a few minor bugs that I encountered while working on this patch. * browser-tests/component-base-tests.js: Added tests for ComponentBase.enqueueToRender(). * browser-tests/index.html: (BrowserContext.prototype.importScripts): Renamed from importScript; Now supports loading multiple scripts. (BrowserContext.prototype.importScript): Added. (BrowserContext): Removed the unused createWithScripts. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): * public/v3/components/base.js: (ComponentBase): When the browser doesn't support custom elements and (ComponentBase.prototype.enqueueToRender): Renamed from updateRendering. Queues up the component to call render() instead of immediately invoking it. (ComponentBase.renderingTimerDidFire): Call render(). Since render() function often calls enqueueToRender on child components, go ahead and invoke render() on any components enqueued during render() calls. (ComponentBase._connectedComponentToRenderOnResize): Added. (ComponentBase._disconnectedComponentToRenderOnResize): Added. (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Added. This is an optimization to avoid the work when the component is not in the document; e.g. because the entire page component has been detached from the document. The old implementation in TimeSeriesChart was not doing this. (ComponentBase.defineElement.elementClass.prototype.disconnectedCallback): Added. (ComponentBase): Replaced unused static variables with _componentsToRender and _componentsToRenderOnResize. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype.didUpdateAnnotations): Added. Addresses the bug that the annotation bars in the charts shown an an analysis task doesn't update its color when the state is updated in the UI. (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/interactive-time-series-chart.js: * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the logic to update upon resize. See _connectedComponentToRenderOnResize above. (TimeSeriesChart.prototype.get enqueueToRenderOnResize): Added. Returns true. (TimeSeriesChart.prototype.enqueueToRender): Deleted. (TimeSeriesChart._renderEnqueuedCharts): Deleted. (TimeSeriesChart): Call ComponentBase.defineElement to make this a proper component so that the logic in connectedCallback to update upon resize event would work. * public/v3/instrumentation.js: (Instrumentation.dumpStatistics): Sort results by the key names. * public/v3/models/time-series.js: (TimeSeries.prototype.values): Added. This method was never ported to v3 in r198462, and broke the feature to show moving averages, etc... on the charts page. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): Fixed the bug that we were never updating annotation bars in the main chart by calling didUpdateAnnotations. (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._renderTrendLinePopover): Fixed a race condition. Insert a select element as needed before trying to assign the current value on it. (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184216@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-18 21:22:39 +00:00
return new Promise((resolve, reject) => {
let script = doc.createElement('script');
script.addEventListener('load', resolve);
script.addEventListener('error', reject);
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
script.src = path;
Add a mechanism to dispatch and listen to an action https://bugs.webkit.org/show_bug.cgi?id=167191 Reviewed by Antti Koivisto. Added the notion of an action to components. Like DOM events, it can be dispatched or listen to. Also added ComponentBase.prototype.part which finds a sub-component inside a component's shadow tree, and made ComponentBase.prototype.content take an id to find an element that matches it. * browser-tests/close-button-tests.js: Added. Tests for CloseButton. * browser-tests/component-base-tests.js: Added tests for ComponentBase's part(~), content(id), dispatchEvent. * browser-tests/index.html: * public/v3/components/base.js: (ComponentBase): Added this._actionCallbacks, which is a map of an action name to a callback to be invoked. (ComponentBase.prototype.content): Return an element of the given id if one is specified. (ComponentBase.prototype.part): Find a component whose element has the matching id. (ComponentBase.prototype.dispatchAction): Added. (ComponentBase.prototype.listenToAction): Added. (ComponentBase.prototype._ensureShadowTree): Call didConstructShadowTree. (ComponentBase.prototype.didConstructShadowTree): Added. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Copy attributes when instantiating an element for a component when the browser doesn't support custom elements API. (ComponentBase.createLink): (ComponentBase.prototype.createEventHandler): Added. (ComponentBase.createEventHandler): Renamed from createActionHandler. * public/v3/components/button-base.js: (ButtonBase.prototype.didConstructShadowTree): Added. Dispatch "activate" action when the button is clicked. (ButtonBase.prototype.setCallback): Deleted. (ButtonBase.htmlTemplate): Use id instead of class so that this.content() can find it. (ButtonBase.cssTemplate): Updated style rules. * public/v3/pages/chart-pane.js: (ChartPane): (ChartPane.prototype.didConstructShadowTree): Added. Listen to "activate" action on the close button. (ChartPane.prototype.render): Fixed a bug that we were never calling enqueueToRender on the close button. (ChartPane.htmlTemplate): Add the id on the close button. Canonical link: https://commits.webkit.org/184266@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-19 22:58:46 +00:00
script.async = false;
Make calls to render() functions async https://bugs.webkit.org/show_bug.cgi?id=167151 Reviewed by Andreas Kling. Make calls to render() async by coalescing calls inside enqueueToRender(), which has been renamed from updateRendering(). We now queue up all the components and wait until the next animation frame to invoke render() on all those components. This reduces render() calls in the summary page of our internal dashboard by 15x from ~9400 to ~600 by eliminating pathological O(n^2) behavior between render() calls. Consolidated TimeSeriesChart's enqueueRender into this newly added feature of ComponentBase along with the support to call render() on a resize event. New implementation makes use of connectedCallback and disconnectedCallback to avoid the work when the component is not in a document tree. The rest of the patch concerns with renaming updateRendering to enqueueToRender and fixing a few minor bugs that I encountered while working on this patch. * browser-tests/component-base-tests.js: Added tests for ComponentBase.enqueueToRender(). * browser-tests/index.html: (BrowserContext.prototype.importScripts): Renamed from importScript; Now supports loading multiple scripts. (BrowserContext.prototype.importScript): Added. (BrowserContext): Removed the unused createWithScripts. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): * public/v3/components/base.js: (ComponentBase): When the browser doesn't support custom elements and (ComponentBase.prototype.enqueueToRender): Renamed from updateRendering. Queues up the component to call render() instead of immediately invoking it. (ComponentBase.renderingTimerDidFire): Call render(). Since render() function often calls enqueueToRender on child components, go ahead and invoke render() on any components enqueued during render() calls. (ComponentBase._connectedComponentToRenderOnResize): Added. (ComponentBase._disconnectedComponentToRenderOnResize): Added. (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Added. This is an optimization to avoid the work when the component is not in the document; e.g. because the entire page component has been detached from the document. The old implementation in TimeSeriesChart was not doing this. (ComponentBase.defineElement.elementClass.prototype.disconnectedCallback): Added. (ComponentBase): Replaced unused static variables with _componentsToRender and _componentsToRenderOnResize. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype.didUpdateAnnotations): Added. Addresses the bug that the annotation bars in the charts shown an an analysis task doesn't update its color when the state is updated in the UI. (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/interactive-time-series-chart.js: * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the logic to update upon resize. See _connectedComponentToRenderOnResize above. (TimeSeriesChart.prototype.get enqueueToRenderOnResize): Added. Returns true. (TimeSeriesChart.prototype.enqueueToRender): Deleted. (TimeSeriesChart._renderEnqueuedCharts): Deleted. (TimeSeriesChart): Call ComponentBase.defineElement to make this a proper component so that the logic in connectedCallback to update upon resize event would work. * public/v3/instrumentation.js: (Instrumentation.dumpStatistics): Sort results by the key names. * public/v3/models/time-series.js: (TimeSeries.prototype.values): Added. This method was never ported to v3 in r198462, and broke the feature to show moving averages, etc... on the charts page. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): Fixed the bug that we were never updating annotation bars in the main chart by calling didUpdateAnnotations. (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._renderTrendLinePopover): Fixed a race condition. Insert a select element as needed before trying to assign the current value on it. (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184216@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-18 21:22:39 +00:00
doc.body.appendChild(script);
});
})).then(() => {
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
const script = doc.createElement('script');
script.textContent = `window.importedSymbols = [${symbolList.join(', ')}];`;
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
global.RemoteAPI = global.MockRemoteAPI;
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
doc.body.appendChild(script);
const importedSymbols = global.importedSymbols;
for (let i = 0; i < symbolList.length; i++)
this.symbols[symbolList[i]] = importedSymbols[i];
return symbolList.length == 1 ? importedSymbols[0] : importedSymbols;
});
}
Make calls to render() functions async https://bugs.webkit.org/show_bug.cgi?id=167151 Reviewed by Andreas Kling. Make calls to render() async by coalescing calls inside enqueueToRender(), which has been renamed from updateRendering(). We now queue up all the components and wait until the next animation frame to invoke render() on all those components. This reduces render() calls in the summary page of our internal dashboard by 15x from ~9400 to ~600 by eliminating pathological O(n^2) behavior between render() calls. Consolidated TimeSeriesChart's enqueueRender into this newly added feature of ComponentBase along with the support to call render() on a resize event. New implementation makes use of connectedCallback and disconnectedCallback to avoid the work when the component is not in a document tree. The rest of the patch concerns with renaming updateRendering to enqueueToRender and fixing a few minor bugs that I encountered while working on this patch. * browser-tests/component-base-tests.js: Added tests for ComponentBase.enqueueToRender(). * browser-tests/index.html: (BrowserContext.prototype.importScripts): Renamed from importScript; Now supports loading multiple scripts. (BrowserContext.prototype.importScript): Added. (BrowserContext): Removed the unused createWithScripts. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): * public/v3/components/base.js: (ComponentBase): When the browser doesn't support custom elements and (ComponentBase.prototype.enqueueToRender): Renamed from updateRendering. Queues up the component to call render() instead of immediately invoking it. (ComponentBase.renderingTimerDidFire): Call render(). Since render() function often calls enqueueToRender on child components, go ahead and invoke render() on any components enqueued during render() calls. (ComponentBase._connectedComponentToRenderOnResize): Added. (ComponentBase._disconnectedComponentToRenderOnResize): Added. (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Added. This is an optimization to avoid the work when the component is not in the document; e.g. because the entire page component has been detached from the document. The old implementation in TimeSeriesChart was not doing this. (ComponentBase.defineElement.elementClass.prototype.disconnectedCallback): Added. (ComponentBase): Replaced unused static variables with _componentsToRender and _componentsToRenderOnResize. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype.didUpdateAnnotations): Added. Addresses the bug that the annotation bars in the charts shown an an analysis task doesn't update its color when the state is updated in the UI. (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/interactive-time-series-chart.js: * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the logic to update upon resize. See _connectedComponentToRenderOnResize above. (TimeSeriesChart.prototype.get enqueueToRenderOnResize): Added. Returns true. (TimeSeriesChart.prototype.enqueueToRender): Deleted. (TimeSeriesChart._renderEnqueuedCharts): Deleted. (TimeSeriesChart): Call ComponentBase.defineElement to make this a proper component so that the logic in connectedCallback to update upon resize event would work. * public/v3/instrumentation.js: (Instrumentation.dumpStatistics): Sort results by the key names. * public/v3/models/time-series.js: (TimeSeries.prototype.values): Added. This method was never ported to v3 in r198462, and broke the feature to show moving averages, etc... on the charts page. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): Fixed the bug that we were never updating annotation bars in the main chart by calling didUpdateAnnotations. (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._renderTrendLinePopover): Fixed a race condition. Insert a select element as needed before trying to assign the current value on it. (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184216@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-18 21:22:39 +00:00
importScript(path, ...symbols)
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
{
Make calls to render() functions async https://bugs.webkit.org/show_bug.cgi?id=167151 Reviewed by Andreas Kling. Make calls to render() async by coalescing calls inside enqueueToRender(), which has been renamed from updateRendering(). We now queue up all the components and wait until the next animation frame to invoke render() on all those components. This reduces render() calls in the summary page of our internal dashboard by 15x from ~9400 to ~600 by eliminating pathological O(n^2) behavior between render() calls. Consolidated TimeSeriesChart's enqueueRender into this newly added feature of ComponentBase along with the support to call render() on a resize event. New implementation makes use of connectedCallback and disconnectedCallback to avoid the work when the component is not in a document tree. The rest of the patch concerns with renaming updateRendering to enqueueToRender and fixing a few minor bugs that I encountered while working on this patch. * browser-tests/component-base-tests.js: Added tests for ComponentBase.enqueueToRender(). * browser-tests/index.html: (BrowserContext.prototype.importScripts): Renamed from importScript; Now supports loading multiple scripts. (BrowserContext.prototype.importScript): Added. (BrowserContext): Removed the unused createWithScripts. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): * public/v3/components/base.js: (ComponentBase): When the browser doesn't support custom elements and (ComponentBase.prototype.enqueueToRender): Renamed from updateRendering. Queues up the component to call render() instead of immediately invoking it. (ComponentBase.renderingTimerDidFire): Call render(). Since render() function often calls enqueueToRender on child components, go ahead and invoke render() on any components enqueued during render() calls. (ComponentBase._connectedComponentToRenderOnResize): Added. (ComponentBase._disconnectedComponentToRenderOnResize): Added. (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Added. This is an optimization to avoid the work when the component is not in the document; e.g. because the entire page component has been detached from the document. The old implementation in TimeSeriesChart was not doing this. (ComponentBase.defineElement.elementClass.prototype.disconnectedCallback): Added. (ComponentBase): Replaced unused static variables with _componentsToRender and _componentsToRenderOnResize. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype.didUpdateAnnotations): Added. Addresses the bug that the annotation bars in the charts shown an an analysis task doesn't update its color when the state is updated in the UI. (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/interactive-time-series-chart.js: * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the logic to update upon resize. See _connectedComponentToRenderOnResize above. (TimeSeriesChart.prototype.get enqueueToRenderOnResize): Added. Returns true. (TimeSeriesChart.prototype.enqueueToRender): Deleted. (TimeSeriesChart._renderEnqueuedCharts): Deleted. (TimeSeriesChart): Call ComponentBase.defineElement to make this a proper component so that the logic in connectedCallback to update upon resize event would work. * public/v3/instrumentation.js: (Instrumentation.dumpStatistics): Sort results by the key names. * public/v3/models/time-series.js: (TimeSeries.prototype.values): Added. This method was never ported to v3 in r198462, and broke the feature to show moving averages, etc... on the charts page. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): Fixed the bug that we were never updating annotation bars in the main chart by calling didUpdateAnnotations. (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._renderTrendLinePopover): Fixed a race condition. Insert a select element as needed before trying to assign the current value on it. (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184216@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-18 21:22:39 +00:00
return this.importScripts([path], ...symbols);
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
}
Make calls to render() functions async https://bugs.webkit.org/show_bug.cgi?id=167151 Reviewed by Andreas Kling. Make calls to render() async by coalescing calls inside enqueueToRender(), which has been renamed from updateRendering(). We now queue up all the components and wait until the next animation frame to invoke render() on all those components. This reduces render() calls in the summary page of our internal dashboard by 15x from ~9400 to ~600 by eliminating pathological O(n^2) behavior between render() calls. Consolidated TimeSeriesChart's enqueueRender into this newly added feature of ComponentBase along with the support to call render() on a resize event. New implementation makes use of connectedCallback and disconnectedCallback to avoid the work when the component is not in a document tree. The rest of the patch concerns with renaming updateRendering to enqueueToRender and fixing a few minor bugs that I encountered while working on this patch. * browser-tests/component-base-tests.js: Added tests for ComponentBase.enqueueToRender(). * browser-tests/index.html: (BrowserContext.prototype.importScripts): Renamed from importScript; Now supports loading multiple scripts. (BrowserContext.prototype.importScript): Added. (BrowserContext): Removed the unused createWithScripts. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): * public/v3/components/base.js: (ComponentBase): When the browser doesn't support custom elements and (ComponentBase.prototype.enqueueToRender): Renamed from updateRendering. Queues up the component to call render() instead of immediately invoking it. (ComponentBase.renderingTimerDidFire): Call render(). Since render() function often calls enqueueToRender on child components, go ahead and invoke render() on any components enqueued during render() calls. (ComponentBase._connectedComponentToRenderOnResize): Added. (ComponentBase._disconnectedComponentToRenderOnResize): Added. (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Added. This is an optimization to avoid the work when the component is not in the document; e.g. because the entire page component has been detached from the document. The old implementation in TimeSeriesChart was not doing this. (ComponentBase.defineElement.elementClass.prototype.disconnectedCallback): Added. (ComponentBase): Replaced unused static variables with _componentsToRender and _componentsToRenderOnResize. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype.didUpdateAnnotations): Added. Addresses the bug that the annotation bars in the charts shown an an analysis task doesn't update its color when the state is updated in the UI. (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/interactive-time-series-chart.js: * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the logic to update upon resize. See _connectedComponentToRenderOnResize above. (TimeSeriesChart.prototype.get enqueueToRenderOnResize): Added. Returns true. (TimeSeriesChart.prototype.enqueueToRender): Deleted. (TimeSeriesChart._renderEnqueuedCharts): Deleted. (TimeSeriesChart): Call ComponentBase.defineElement to make this a proper component so that the logic in connectedCallback to update upon resize event would work. * public/v3/instrumentation.js: (Instrumentation.dumpStatistics): Sort results by the key names. * public/v3/models/time-series.js: (TimeSeries.prototype.values): Added. This method was never ported to v3 in r198462, and broke the feature to show moving averages, etc... on the charts page. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): Fixed the bug that we were never updating annotation bars in the main chart by calling didUpdateAnnotations. (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._renderTrendLinePopover): Fixed a race condition. Insert a select element as needed before trying to assign the current value on it. (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184216@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-18 21:22:39 +00:00
static cleanup()
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
{
Make calls to render() functions async https://bugs.webkit.org/show_bug.cgi?id=167151 Reviewed by Andreas Kling. Make calls to render() async by coalescing calls inside enqueueToRender(), which has been renamed from updateRendering(). We now queue up all the components and wait until the next animation frame to invoke render() on all those components. This reduces render() calls in the summary page of our internal dashboard by 15x from ~9400 to ~600 by eliminating pathological O(n^2) behavior between render() calls. Consolidated TimeSeriesChart's enqueueRender into this newly added feature of ComponentBase along with the support to call render() on a resize event. New implementation makes use of connectedCallback and disconnectedCallback to avoid the work when the component is not in a document tree. The rest of the patch concerns with renaming updateRendering to enqueueToRender and fixing a few minor bugs that I encountered while working on this patch. * browser-tests/component-base-tests.js: Added tests for ComponentBase.enqueueToRender(). * browser-tests/index.html: (BrowserContext.prototype.importScripts): Renamed from importScript; Now supports loading multiple scripts. (BrowserContext.prototype.importScript): Added. (BrowserContext): Removed the unused createWithScripts. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): * public/v3/components/base.js: (ComponentBase): When the browser doesn't support custom elements and (ComponentBase.prototype.enqueueToRender): Renamed from updateRendering. Queues up the component to call render() instead of immediately invoking it. (ComponentBase.renderingTimerDidFire): Call render(). Since render() function often calls enqueueToRender on child components, go ahead and invoke render() on any components enqueued during render() calls. (ComponentBase._connectedComponentToRenderOnResize): Added. (ComponentBase._disconnectedComponentToRenderOnResize): Added. (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Added. This is an optimization to avoid the work when the component is not in the document; e.g. because the entire page component has been detached from the document. The old implementation in TimeSeriesChart was not doing this. (ComponentBase.defineElement.elementClass.prototype.disconnectedCallback): Added. (ComponentBase): Replaced unused static variables with _componentsToRender and _componentsToRenderOnResize. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype.didUpdateAnnotations): Added. Addresses the bug that the annotation bars in the charts shown an an analysis task doesn't update its color when the state is updated in the UI. (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/interactive-time-series-chart.js: * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the logic to update upon resize. See _connectedComponentToRenderOnResize above. (TimeSeriesChart.prototype.get enqueueToRenderOnResize): Added. Returns true. (TimeSeriesChart.prototype.enqueueToRender): Deleted. (TimeSeriesChart._renderEnqueuedCharts): Deleted. (TimeSeriesChart): Call ComponentBase.defineElement to make this a proper component so that the logic in connectedCallback to update upon resize event would work. * public/v3/instrumentation.js: (Instrumentation.dumpStatistics): Sort results by the key names. * public/v3/models/time-series.js: (TimeSeries.prototype.values): Added. This method was never ported to v3 in r198462, and broke the feature to show moving averages, etc... on the charts page. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): Fixed the bug that we were never updating annotation bars in the main chart by calling didUpdateAnnotations. (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._renderTrendLinePopover): Fixed a race condition. Insert a select element as needed before trying to assign the current value on it. (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184216@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-18 21:22:39 +00:00
BrowsingContext._iframes.forEach((iframe) => { iframe.remove(); });
BrowsingContext._iframes = [];
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
}
}
BrowsingContext._iframes = [];
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
function waitForComponentsToRender(context)
{
if (!context._dummyComponent) {
const ComponentBase = context.symbols.ComponentBase;
context._dummyComponent = class SomeComponent extends ComponentBase {
constructor(resolve)
{
super();
this._resolve = resolve;
}
render() { setTimeout(this._resolve, 0); }
}
ComponentBase.defineElement('dummy-component', context._dummyComponent);
}
return new Promise((resolve) => {
const instance = new context._dummyComponent(resolve);
context.document.body.appendChild(instance.element());
Add tests for InteractiveTimeSeriesChart and adopt actions https://bugs.webkit.org/show_bug.cgi?id=168750 Reviewed by Chris Dumez. Added tests for InteractiveTimeSeriesChart. Also replaced selection.onchange, selection.onzoom, indicator.onchange, annotations.onclick callbacks by "selectionChange", "zoom", "indicatorChange", and "annotationClick" actions respectively. Also fixed various bugs and bad code I encountered while writing these tests. * browser-tests/index.html: (waitForComponentsToRender): Delay the call to enqueueToRender until the next run loop because there might be outstanding promises that just got resolved. e.g. for fetching measurement sets JSONs. Let all those promises get resolved first. Otherwise, some tests become racy. (canvasImageData): Extracted from time-series-chart-tests.js. (canvasRefTest): Ditto. (CanvasTest): Ditto. (CanvasTest.fillCanvasBeforeRedrawCheck): Ditto. (CanvasTest.hasCanvasBeenRedrawn): Ditto. (CanvasTest.canvasImageData): Ditto. (CanvasTest.expectCanvasesMatch): Ditto. (CanvasTest.expectCanvasesMismatch): Ditto. * browser-tests/time-series-chart-tests.js: Fixed some test cases where dpr multipler was not doing the right thing anymore in Safari under a high DPI screen. Also added a lot of test cases for interactive time series chart and one for rendering annotations. (scripts): Moved. (posixTime): Added. A helper function for sampleCluster. (dayInMilliseconds): Ditto. (sampleCluster): Moved here. Made the same cluster more artifical for an easier testing. (createChartWithSampleCluster): Moved out of one of the tests. (respondWithSampleCluster): Ditto. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): Adopted new actions in InteractiveTimeSeriesChart. * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): Removed a superflous console.log. * public/v3/components/chart-styles.js: (ChartStyles.mainChartOptions): Set zoomButton to true. InteractiveTimeSeriesChart used to determine whether to show the zoom button or not based on the precense of the zoom callback. We made it explicit. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.setIndicator): Explicitly call _notifySelectionChanged with false instead of relying on undefined to be treated as falsey. (InteractiveTimeSeriesChart.prototype._createCanvas): Use id instead of selector to find elements. (InteractiveTimeSeriesChart.htmlTemplate): (InteractiveTimeSeriesChart.cssTemplate): (InteractiveTimeSeriesChart.prototype._mouseMove): Explicitly call _startOrContinueDragging with false instead of relying on undefined treated as falsey. Also added the missing call to enqueueToRender found by new tests. This was working fine on the dashboard due to other components invoking enqueueToRender but won't work in a standalone instance of InteractiveTimeSeriesChart. (InteractiveTimeSeriesChart.prototype._mouseLeave): Ditto, adding the missing call to enqueueToRender. (InteractiveTimeSeriesChart.prototype._click): Removed the assignment to _forceRender when calling _mouseMove in an early exist, which does set this flag and invokes enqueueToRender, and added the missing call to enqueueToRender in the other code path. (InteractiveTimeSeriesChart.prototype._startOrContinueDragging): Replaced annotations.onclick callback by the newly added "annotationClick" action, and added the missing call to enqueueToRender. (InteractiveTimeSeriesChart.prototype._endDragging): Use arrow function. (InteractiveTimeSeriesChart.prototype._notifyIndicatorChanged): Replaced indicator.onchange callback by the newly added "indicatorChange" action. (InteractiveTimeSeriesChart.prototype._notifySelectionChanged): Replaced selection.onchange callback by the newly added "selectionChange" action. (InteractiveTimeSeriesChart.prototype._renderChartContent): Show the zoom button when options.zoomButton is set instead of relying on the presence of selection.onzoom especially now that the callback has been replaced by the "zoom" action. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.setAnnotations): Added the missing call to enqueueToRender. * public/v3/main.js: Canonical link: https://commits.webkit.org/185800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-23 21:39:55 +00:00
setTimeout(() => {
instance.enqueueToRender();
}, 0);
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
});
}
function waitForElementResize(element)
{
return new Promise((resolve) => {
const observer = new ResizeObserver(() => {
observer.disconnect();
resolve();
});
observer.observe(element);
})
}
Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Canonical link: https://commits.webkit.org/185522@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-17 09:15:55 +00:00
function wait(milliseconds)
{
return new Promise((resolve) => {
setTimeout(resolve, milliseconds);
});
}
Add tests for InteractiveTimeSeriesChart and adopt actions https://bugs.webkit.org/show_bug.cgi?id=168750 Reviewed by Chris Dumez. Added tests for InteractiveTimeSeriesChart. Also replaced selection.onchange, selection.onzoom, indicator.onchange, annotations.onclick callbacks by "selectionChange", "zoom", "indicatorChange", and "annotationClick" actions respectively. Also fixed various bugs and bad code I encountered while writing these tests. * browser-tests/index.html: (waitForComponentsToRender): Delay the call to enqueueToRender until the next run loop because there might be outstanding promises that just got resolved. e.g. for fetching measurement sets JSONs. Let all those promises get resolved first. Otherwise, some tests become racy. (canvasImageData): Extracted from time-series-chart-tests.js. (canvasRefTest): Ditto. (CanvasTest): Ditto. (CanvasTest.fillCanvasBeforeRedrawCheck): Ditto. (CanvasTest.hasCanvasBeenRedrawn): Ditto. (CanvasTest.canvasImageData): Ditto. (CanvasTest.expectCanvasesMatch): Ditto. (CanvasTest.expectCanvasesMismatch): Ditto. * browser-tests/time-series-chart-tests.js: Fixed some test cases where dpr multipler was not doing the right thing anymore in Safari under a high DPI screen. Also added a lot of test cases for interactive time series chart and one for rendering annotations. (scripts): Moved. (posixTime): Added. A helper function for sampleCluster. (dayInMilliseconds): Ditto. (sampleCluster): Moved here. Made the same cluster more artifical for an easier testing. (createChartWithSampleCluster): Moved out of one of the tests. (respondWithSampleCluster): Ditto. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): Adopted new actions in InteractiveTimeSeriesChart. * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): Removed a superflous console.log. * public/v3/components/chart-styles.js: (ChartStyles.mainChartOptions): Set zoomButton to true. InteractiveTimeSeriesChart used to determine whether to show the zoom button or not based on the precense of the zoom callback. We made it explicit. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.setIndicator): Explicitly call _notifySelectionChanged with false instead of relying on undefined to be treated as falsey. (InteractiveTimeSeriesChart.prototype._createCanvas): Use id instead of selector to find elements. (InteractiveTimeSeriesChart.htmlTemplate): (InteractiveTimeSeriesChart.cssTemplate): (InteractiveTimeSeriesChart.prototype._mouseMove): Explicitly call _startOrContinueDragging with false instead of relying on undefined treated as falsey. Also added the missing call to enqueueToRender found by new tests. This was working fine on the dashboard due to other components invoking enqueueToRender but won't work in a standalone instance of InteractiveTimeSeriesChart. (InteractiveTimeSeriesChart.prototype._mouseLeave): Ditto, adding the missing call to enqueueToRender. (InteractiveTimeSeriesChart.prototype._click): Removed the assignment to _forceRender when calling _mouseMove in an early exist, which does set this flag and invokes enqueueToRender, and added the missing call to enqueueToRender in the other code path. (InteractiveTimeSeriesChart.prototype._startOrContinueDragging): Replaced annotations.onclick callback by the newly added "annotationClick" action, and added the missing call to enqueueToRender. (InteractiveTimeSeriesChart.prototype._endDragging): Use arrow function. (InteractiveTimeSeriesChart.prototype._notifyIndicatorChanged): Replaced indicator.onchange callback by the newly added "indicatorChange" action. (InteractiveTimeSeriesChart.prototype._notifySelectionChanged): Replaced selection.onchange callback by the newly added "selectionChange" action. (InteractiveTimeSeriesChart.prototype._renderChartContent): Show the zoom button when options.zoomButton is set instead of relying on the presence of selection.onzoom especially now that the callback has been replaced by the "zoom" action. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.setAnnotations): Added the missing call to enqueueToRender. * public/v3/main.js: Canonical link: https://commits.webkit.org/185800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-23 21:39:55 +00:00
function canvasImageData(canvas)
{
return canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height);
}
function canvasRefTest(canvas1, canvas2, shouldMatch)
{
expect(canvas1.offsetWidth).to.be(canvas2.offsetWidth);
expect(canvas2.offsetHeight).to.be(canvas2.offsetHeight);
const data1 = canvasImageData(canvas1).data;
const data2 = canvasImageData(canvas2).data;
expect(data1.length).to.be.a('number');
expect(data1.length).to.be(data2.length);
let match = true;
for (let i = 0; i < data1.length; i++) {
if (data1[i] != data2[i]) {
match = false;
break;
}
}
if (match == shouldMatch)
return;
[canvas1, canvas2].forEach((canvas) => {
let image = document.createElement('img');
image.src = canvas.toDataURL();
image.style.display = 'block';
document.body.appendChild(image);
});
throw new Error(shouldMatch ? 'Canvas contents were different' : 'Canvas contents were identical');
}
const CanvasTest = {
fillCanvasBeforeRedrawCheck(canvas)
{
const canvasContext = canvas.getContext('2d');
canvasContext.fillStyle = 'white';
canvasContext.fillRect(0, 0, canvas.width, canvas.height);
},
hasCanvasBeenRedrawn(canvas)
{
return canvasImageData(canvas).data.some((value) => value != 255);
},
canvasImageData(canvas) { return canvasImageData(canvas); },
New sampling algorithm shows very few points when zoomed out https://bugs.webkit.org/show_bug.cgi?id=168813 Reviewed by Saam Barati. When a chart is zoomed out to a large time interval, the new sampling algorithm introduced in r212853 can hide most of the data points because the difference between the preceding point's time and the succeeding point's time of most points will be below the threshold we computed. Instead, rank each data point based on the aforementioned time interval difference, and pick the first M data points when M data points are to be shown. This makes the new algorithm behave like our old algorithm while keeping it stable still. Note that this algorithm still biases data points without a close neighboring point but this seems to work out in practice because such a point tends to be an important sample anyway, and we don't have a lot of space between data points since we aim to show about one point per pixel. * browser-tests/index.html: (CanvasTest.canvasContainsColor): Extracted from one of the test cases and generalized. Returns true when the specified region of the canvas contains a specified color (alpha is optional). * browser-tests/time-series-chart-tests.js: Added a test case for sampling. It checks that sampling happens and that we always show some data point even when zoomed out to a large time interval. (createChartWithSampleCluster): * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype._sampleTimeSeries): * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._ensureSampledTimeSeries): M, the number of data points we pick must be computed based on the width of data points we're about to draw constrained by the canvas size. e.g. when the canvas is only half filled, we shouldn't be showing two points per pixel in the filled region. (TimeSeriesChart.prototype._sampleTimeSeries): Refined the algorithm. First, compute the time difference or the rank for each N data points. Sort those ranks in descending order (in the order we prefer), and include all data points above the M-th rank in the sample. (TimeSeriesChart.prototype.computeTimeGrid): Revert the inadvertent change in r212935. * public/v3/models/time-series.js: (TimeSeriesView.prototype.filter): Fixed a bug that the indices passed onto the callback were shifted by the starting index. * unit-tests/time-series-tests.js: Added a test case to ensure callbacks are called with correct data points and indices. Canonical link: https://commits.webkit.org/185818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-24 06:57:04 +00:00
canvasContainsColor(canvas, color, rect = {})
{
const content = canvas.getContext('2d').getImageData(rect.x || 0, rect.y || 0, rect.width || canvas.width, rect.height || canvas.height);
let found = false;
const data = content.data;
for (let startOfPixel = 0; startOfPixel < data.length; startOfPixel += 4) {
let r = data[startOfPixel];
let g = data[startOfPixel + 1];
let b = data[startOfPixel + 2];
let a = data[startOfPixel + 3];
if (r == color.r && g == color.g && b == color.b && (color.a == undefined || a == color.a))
return true;
}
return false;
},
Add tests for InteractiveTimeSeriesChart and adopt actions https://bugs.webkit.org/show_bug.cgi?id=168750 Reviewed by Chris Dumez. Added tests for InteractiveTimeSeriesChart. Also replaced selection.onchange, selection.onzoom, indicator.onchange, annotations.onclick callbacks by "selectionChange", "zoom", "indicatorChange", and "annotationClick" actions respectively. Also fixed various bugs and bad code I encountered while writing these tests. * browser-tests/index.html: (waitForComponentsToRender): Delay the call to enqueueToRender until the next run loop because there might be outstanding promises that just got resolved. e.g. for fetching measurement sets JSONs. Let all those promises get resolved first. Otherwise, some tests become racy. (canvasImageData): Extracted from time-series-chart-tests.js. (canvasRefTest): Ditto. (CanvasTest): Ditto. (CanvasTest.fillCanvasBeforeRedrawCheck): Ditto. (CanvasTest.hasCanvasBeenRedrawn): Ditto. (CanvasTest.canvasImageData): Ditto. (CanvasTest.expectCanvasesMatch): Ditto. (CanvasTest.expectCanvasesMismatch): Ditto. * browser-tests/time-series-chart-tests.js: Fixed some test cases where dpr multipler was not doing the right thing anymore in Safari under a high DPI screen. Also added a lot of test cases for interactive time series chart and one for rendering annotations. (scripts): Moved. (posixTime): Added. A helper function for sampleCluster. (dayInMilliseconds): Ditto. (sampleCluster): Moved here. Made the same cluster more artifical for an easier testing. (createChartWithSampleCluster): Moved out of one of the tests. (respondWithSampleCluster): Ditto. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): Adopted new actions in InteractiveTimeSeriesChart. * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): Removed a superflous console.log. * public/v3/components/chart-styles.js: (ChartStyles.mainChartOptions): Set zoomButton to true. InteractiveTimeSeriesChart used to determine whether to show the zoom button or not based on the precense of the zoom callback. We made it explicit. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.setIndicator): Explicitly call _notifySelectionChanged with false instead of relying on undefined to be treated as falsey. (InteractiveTimeSeriesChart.prototype._createCanvas): Use id instead of selector to find elements. (InteractiveTimeSeriesChart.htmlTemplate): (InteractiveTimeSeriesChart.cssTemplate): (InteractiveTimeSeriesChart.prototype._mouseMove): Explicitly call _startOrContinueDragging with false instead of relying on undefined treated as falsey. Also added the missing call to enqueueToRender found by new tests. This was working fine on the dashboard due to other components invoking enqueueToRender but won't work in a standalone instance of InteractiveTimeSeriesChart. (InteractiveTimeSeriesChart.prototype._mouseLeave): Ditto, adding the missing call to enqueueToRender. (InteractiveTimeSeriesChart.prototype._click): Removed the assignment to _forceRender when calling _mouseMove in an early exist, which does set this flag and invokes enqueueToRender, and added the missing call to enqueueToRender in the other code path. (InteractiveTimeSeriesChart.prototype._startOrContinueDragging): Replaced annotations.onclick callback by the newly added "annotationClick" action, and added the missing call to enqueueToRender. (InteractiveTimeSeriesChart.prototype._endDragging): Use arrow function. (InteractiveTimeSeriesChart.prototype._notifyIndicatorChanged): Replaced indicator.onchange callback by the newly added "indicatorChange" action. (InteractiveTimeSeriesChart.prototype._notifySelectionChanged): Replaced selection.onchange callback by the newly added "selectionChange" action. (InteractiveTimeSeriesChart.prototype._renderChartContent): Show the zoom button when options.zoomButton is set instead of relying on the presence of selection.onzoom especially now that the callback has been replaced by the "zoom" action. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.setAnnotations): Added the missing call to enqueueToRender. * public/v3/main.js: Canonical link: https://commits.webkit.org/185800@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-23 21:39:55 +00:00
expectCanvasesMatch(canvas1, canvas2) { return canvasRefTest(canvas1, canvas2, true); },
expectCanvasesMismatch(canvas1, canvas2) { return canvasRefTest(canvas1, canvas2, false); },
}
const dayInMilliseconds = 24 * 3600 * 1000;
function posixTime(string) { return +new Date(string); }
const ChartTest = {
importChartScripts(context)
{
return context.importScripts([
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
'async-task.js',
'../shared/statistics.js',
Make it possible to view results for sub tests and metrics in A/B testing https://bugs.webkit.org/show_bug.cgi?id=170975 Reviewed by Chris Dumez. Replaced TestGroupResultsTable, which was a single table that presented the test results with a set of revisions each build request used, with TestGroupResultsViewer and TestGroupRevisionTable. TestGroupResultsViewer provides an UI to look the results of sub-tests and sub-metrics and TestGroupRevisionTable provides an UI to display the set of revisions each build request used. TestGroupRevisionTable can also show the list of custom roots now that we've added UI to schedule an analysis task with a custom test group. This patch extends BarGraphGroup to show multiple bars per SingleBarGraph using a canvas with bars indicating their mean and confidence interval. * browser-tests/index.html: (ChartTest.importChartScripts): Include lazily-evaluated-function.js now that Test model object uses LazilyEvaluatedFunction. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.TestGroupStackingBlock.prototype._valuesForCommitSet): (AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus): * public/v3/components/bar-graph-group.js: (BarGraphGroup): No longer takes formatter. Added _computeRangeLazily and _showLabels as instance variables. (BarGraphGroup.prototype.addBar): Now takes a list of values, their labels, mean, confidence interval, and the colors of bar graphs shown for each value and the mean indicator. (BarGraphGroup.prototype.showLabels): Added. (BarGraphGroup.prototype.setShowLabels): Added. (BarGraphGroup.prototype.range): Added. (BarGraphGroup.prototype._computeRange): Renamed from updateGroupRendering. Now returns the range instead off setting it to each bar, and each SingleBarGraph's render function uses the value via BarGraphGroup's range. (BarGraph): Renamed from SingleBarGraph. Added various arguments introduced in addBar, and now stores various lazily evaluated functions used for rendering. (BarGraph.prototype.render): Rewritten to use canvas to draw bar graphs and show a label when group's showLabels() returns true. (BarGraph.prototype._resizeCanvas): Added. (BarGraph.prototype._renderCanvas): Added. (BarGraph.prototype._renderLabels): Added. We align the top of each label to the middle of each bar and shift it back up by half the height of the label (0.4rem) using margin-top in css. (BarGraph.htmlTemplate): Uses a canvas now. (BarGraph.cssTemplate): * public/v3/components/results-table.js: (ResultsTable.prototype.renderTable): Updated per code changes to BarGraphGroup. (ResultsTableRow.prototype.resultContent): Ditto. * public/v3/components/test-group-results-table.js: Removed. * public/v3/components/test-group-results-viewer.js: Added. (TestGroupResultsViewer): Added. Shows a list of test results with bar graphs with mean and confidence interval indicators. The results of sub tests and metrics can be expanded via "(Breakdown)" link shown below each test. (TestGroupResultsViewer.prototype.setTestGroup): Added. (TestGroupResultsViewer.prototype.setAnalysisResults): Added. (TestGroupResultsViewer.prototype.render): Added. (TestGroupResultsViewer.prototype._renderResultsTable): Compute the depth of the test tree we show, and construct the header rows. Each sub test is "indented" by a new column. (TestGroupResultsViewer.prototype._buildRowForTest): Added. Build rows for metrics of the given test. Expand the list of its child tests if it's in expandedTests. Otherwise add a link to "Breakdown" if it has any child tests. (TestGroupResultsViewer.prototype._buildRowForMetric): Added. Builds rows of table cells to show the results for the given metric for each configuration. (TestGroupResultsViewer.prototype._buildRowForMetric.createConfigurationRow): Added. A helper to build cells for a given configuration represented by a requested commit set. (TestGroupResultsViewer.prototype._buildValueMap): Added. Creates a mappting between a requested commit set, and the list of values, mean, etc... associated with the results for the commit set. (TestGroupResultsViewer.prototype._buildEmptyCells): Added. A helper to create empty cells to indent sub tests. (TestGroupResultsViewer.prototype._expandCurrentMetrics): Added. Highlights the current metrics and renders the label for each bar in the results. (TestGroupResultsViewer.htmlTemplate): Added. (TestGroupResultsViewer.cssTemplate): Added. * public/v3/components/test-group-revision-table.js: Added. (TestGroupRevisionTable): Added. Renders the list of revisions requested for each test configuration as well as ones used in actual testing, and additional repositories being reported (e.g. repositories for helper scripts). (TestGroupRevisionTable.prototype.setTestGroup): Added. (TestGroupRevisionTable.prototype.setAnalysisResults): Added. (TestGroupRevisionTable.prototype.render): Added. (TestGroupRevisionTable.prototype._renderTable): Added. The basic algorithm here is to first create a row entry object for each build request, merge cells that use the same revision of the same repository, and then render the entire table. (TestGroupRevisionTable.prototype._buildCommitCell): Added. (TestGroupRevisionTable.prototype._buildCustomRootsCell): Added. (TestGroupRevisionTable.prototype._mergeCellsWithSameCommitsAcrossRows): Added. Compute rowspan for each cell by traversing the rows that use the same revision per repository, and store it in rowCountByRepository while adding the repository to each succeeding row's repositoriesToSkip. (TestGroupRevisionTable.htmlTemplate): Added. (TestGroupRevisionTable.cssTemplate): Added. * public/v3/index.html: * public/v3/models/analysis-results.js: (AnalysisResults): Added _metricIds and _lazilyComputedHighestTests as instance variables. (AnalysisResults.prototype.findResult): Renamed from find. (AnalysisResults.prototype.highestTests): Added. (AnalysisResults.prototype._computeHighestTests): Added. Finds the root tests for this analysis result. (AnalysisResults.prototype.add): Update _metricIds. (AnalysisResults.prototype.commitSetForRequest): Added. Returns the reported commit set for the build request. This commit set contains the set of revisions reported to /api/report by A/B testers. (AnalysisResultsView.prototype.resultForRequest): Renamed from resultForBuildId. * public/v3/models/metric.js: (Metric.prototype.relativeName): Added. Computes the relative name given the test/metric path. This function is used to determine the label for each test/metric in TestGroupResultsViewer. (Metric.prototype.aggregatorLabel): Extracted from label. (Metric.prototype.label): (Metric.makeFormatter): Added the default value of false to alwaysShowSign. * public/v3/models/test-group.js: (TestGroup.prototype.compareTestResults): Now takes a metric instead of retrieving it from the analysis task since a custom analysis task may not have a metric associated with it. * public/v3/models/test.js: (Test): Added _computePathLazily as an instance variable. (Test.prototype.path): Lazily computes the path now that this function can be called on the same test for many times in TestGroupResultsViewer while computing relative names of tests and metrics. (Test.prototype._computePath): Extracted path. (Test.prototype.fullName): Modernized the code. (Test.prototype.relativeName): Added. * public/v3/models/uploaded-file.js: (UploadedFile): (UploadedFile.prototype.deletedAt): Added. (UploadedFile.prototype.label): Added. (UploadedFile.prototype.url): Added. * public/v3/pages/analysis-task-page.js: (AnalysisTaskTestGroupPane.prototype.setTestGroups): (AnalysisTaskTestGroupPane.prototype.setAnalysisResults): Replaced setAnalysisResultsView. Now takes an analysisResults instead of its view. (AnalysisTaskTestGroupPane.prototype.render): No longer enqueues the results table and the retry form to render since the results table no longer exists, and the retry form re-renders itself as needed. (AnalysisTaskTestGroupPane.htmlTemplate): Now uses test-group-results-viewer and test-group-revision-table instead of test-group-results-table, which has been removed. (AnalysisTaskTestGroupPane.cssTemplate): (AnalysisTaskPage.prototype._assignTestResultsIfPossible): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): Removed superflous console.log's. * tools/js/v3-models.js: Import LazilyEvaluatedFunction now that it's used in the Test model. * unit-tests/test-model-tests.js: Added. Canonical link: https://commits.webkit.org/188037@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215633 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-21 20:20:05 +00:00
'lazily-evaluated-function.js',
'instrumentation.js',
'models/data-model.js',
'models/time-series.js',
'models/measurement-set.js',
'models/measurement-cluster.js',
'models/measurement-adaptor.js',
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
'models/repository.js',
'models/platform.js',
'models/test.js',
'models/metric.js',
Rename RootSet to CommitSet https://bugs.webkit.org/show_bug.cgi?id=169580 Rubber-stamped by Chris Dumez. Renamed root_sets to commit_sets and roots to commit_set_relationships in the database schema, and renamed related classes in public/v3/ and tools accordingly. RootSet, MeasurementRootSet, and CustomRootSet are respectively renamed to CommitSet, MeasurementCommitSet, and CustomCommitSet. In order to migrate the database, run: ``` BEGIN; ALTER TABLE root_sets RENAME TO commit_sets; ALTER TABLE commit_sets RENAME COLUMN rootset_id TO commitset_id; ALTER TABLE roots RENAME TO commit_set_relationships; ALTER TABLE commit_set_relationships RENAME COLUMN root_set TO commitset_set; ALTER TABLE commit_set_relationships RENAME COLUMN root_commit TO commitset_commit; ALTER TABLE build_requests RENAME COLUMN request_root_set TO request_commit_set; END; ``` * browser-tests/index.html: * init-database.sql: * public/api/build-requests.php: (main): * public/api/test-groups.php: (main): (format_test_group): * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::__construct): (BuildRequestsFetcher::results_internal): (BuildRequestsFetcher::commit_sets): Renamed from root_sets. (BuildRequestsFetcher::commits): Renamed from roots. (BuildRequestsFetcher::fetch_commits_for_set_if_needed): Renamed from fetch_roots_for_set_if_needed. * public/privileged-api/create-test-group.php: (main): (ensure_commit_sets): Renamed from commit_sets_from_root_sets. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype.buildRowGroups): (AnalysisResultsViewer.prototype._collectCommitSetsInTestGroups): Renamed from _collectRootSetsInTestGroups. (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): (AnalysisResultsViewer.CommitSetInTestGroup): Renamed from RootSetInTestGroup. (AnalysisResultsViewer.CommitSetInTestGroup.prototype.constructor): (AnalysisResultsViewer.CommitSetInTestGroup.prototype.commitSet): Renamed from rootSet. (AnalysisResultsViewer.CommitSetInTestGroup.prototype.succeedingCommitSet): Renamed from succeedingRootSet. (AnalysisResultsViewer.TestGroupStackingBlock.prototype.constructor): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.addRowIndex): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.isComplete): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.startRowIndex): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.endRowIndex): (AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus): * public/v3/components/chart-revision-range.js: (ChartRevisionRange.prototype._revisionForPoint): (ChartRevisionRange.prototype._computeRevisionList): * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.constructor): (CustomizableTestGroupForm.prototype.setCommitSetMap): Renamed from setRootSetMap. (CustomizableTestGroupForm.prototype._submitted): (CustomizableTestGroupForm.prototype._computeCommitSetMap): Renamed from _computeRootSetMap. (CustomizableTestGroupForm.prototype.render): Renamed from render. (CustomizableTestGroupForm.prototype._constructRevisionRadioButtons): * public/v3/components/results-table.js: (ResultsTable.prototype.render): (ResultsTable.prototype._createRevisionListCells): (ResultsTable.prototype._computeRepositoryList): (ResultsTableRow.prototype.constructor): (ResultsTableRow.prototype.commitSet): Renamed from rootSet. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): * public/v3/index.html: * public/v3/models/build-request.js: (BuildRequest.prototype.constructor): (BuildRequest.prototype.updateSingleton): (BuildRequest.prototype.commitSet): Renamed from rootSet. (BuildRequest.constructBuildRequestsFromData): * public/v3/models/commit-set.js: Renamed from public/v3/models/root-set.js. (CommitSet): Renamed from RootSet. (CommitSet.containsMultipleCommitsForRepository): (MeasurementCommitSet): Renamed from MeasurementRootSet. (MeasurementCommitSet.prototype.namedStaticMap): (MeasurementCommitSet.prototype.ensureNamedStaticMap): (MeasurementCommitSet.namedStaticMap): (MeasurementCommitSet.ensureNamedStaticMap): (MeasurementCommitSet.ensureSingleton): (CustomCommitSet): Renamed from CustomRootSet. * public/v3/models/measurement-adaptor.js: (MeasurementAdaptor.prototype.applyTo): * public/v3/models/test-group.js: (TestGroup.prototype.constructor): (TestGroup.prototype.addBuildRequest): (TestGroup.prototype.repetitionCount): (TestGroup.prototype.requestedCommitSets): Renamed from requestedRootSets. (TestGroup.prototype.requestsForCommitSet): Renamed from requestsForRootSet. (TestGroup.prototype.labelForCommitSet): Renamed from labelForRootSet. (TestGroup.prototype.didSetResult): (TestGroup.prototype.compareTestResults): (TestGroup.prototype._valuesForCommitSet): Renamed from _valuesForRootSet. (TestGroup.prototype.createAndRefetchTestGroups): * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype._createNewTestGroupFromChart): (AnalysisTaskPage.prototype._createNewTestGroupFromViewer): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): * server-tests/api-build-requests-tests.js: * server-tests/resources/mock-data.js: (MockData.resetV3Models): (MockData.addMockData): (MockData.addAnotherMockTestGroup): * tools/detect-changes.js: (createAnalysisTaskAndNotify): * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype._propertiesForBuildRequest): (BuildbotSyncer.prototype._revisionSetFromCommitSetWithExclusionList): * tools/js/database.js: (tableToPrefixMap): * tools/js/v3-models.js: * tools/sync-buildbot.js: (syncLoop): * tools/sync-with-buildbot.py: Deleted. No longer used. * unit-tests/analysis-task-tests.js: * unit-tests/build-request-tests.js: (sampleBuildRequestData): * unit-tests/buildbot-syncer-tests.js: (sampleCommitSetData): * unit-tests/measurement-adaptor-tests.js: * unit-tests/measurement-set-tests.js: * unit-tests/resources/mock-v3-models.js: (MockModels.inject): * unit-tests/test-groups-tests.js: (sampleTestGroup): Canonical link: https://commits.webkit.org/186635@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-14 23:06:40 +00:00
'models/commit-set.js',
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
'models/commit-log.js',
Add the basic support for writing components in node.js https://bugs.webkit.org/show_bug.cgi?id=186299 Reviewed by Antti Koivisto. Add the basic support for writing components in node.js for generating rich email notifications. To do this, this patch introduces MarkupComponentBase and MarkupPage which implement similar API to ComponentBase and Page classes of v3 UI code. This enables us to share code between frontend and the backend in the future. Because there is no support for declarative custom elements or shadow root in HTML, MarkupComponentBase uses a similar but distinct concept of "content" tree to represent the "DOM" tree for a component. When generating the HTML, MarkupComponentBase and MarkupPage collectively transforms stylesheets and flattens the tree into a single HTML. In order to keep this flatteneing logic simple, MarkupComponentBase only supports a very small subset of CSS selectors to select elements by their local names and class names. Specifically, each class name and element name based selectors are replaced by a globally unique class name based selector, and each element which matches the selector is applied of the same globally unique class name. The transformation is applied when constructing the "content" tree as well as calls to renderReplace. Because much of v3 frontend code relies on DOM API, this patch also implements the simplest form of a fake DOM API as MarkupNode, MarkupParentNode, MarkupElement, and MarkupText. In order to avoid reimplementing HTML & CSS parsers, this patch introduces the concept of content and style templates to ComponentBase which are JSON alternatives to HTML & CSS template strings which can be used in both frontend & backend. * browser-tests/close-button-tests.js: Include CommonComponentBase. * browser-tests/commit-log-viewer-tests.js: Ditto. * browser-tests/component-base-tests.js: Ditto. Added a test cases for content & style templates. (async.importComponentBase): Added. * browser-tests/editable-text-tests.js: Include CommonComponentBase. * browser-tests/index.html: * browser-tests/markup-page-tests.js: Added. * browser-tests/page-router-tests.js: Include CommonComponentBase. * browser-tests/page-tests.js: Ditto. * browser-tests/test-group-form-tests.js: Ditto. * public/shared/common-component-base.js: Added. (CommonComponentBase): Extracted out of ComponentBase. (CommonComponentBase.prototype.renderReplace): Added. (CommonComponentBase.renderReplace): Moved from ComponentBase. (CommonComponentBase.prototype._recursivelyUpgradeUnknownElements): Moved and renamed from ComponentBase's _recursivelyReplaceUnknownElementsByComponents. (CommonComponentBase.prototype._upgradeUnknownElement): Extracted out of the same function. (CommonComponentBase._constructStylesheetFromTemplate): Added. (CommonComponentBase._constructNodeTreeFromTemplate): Added. (CommonComponentBase.prototype.createElement): Added. (CommonComponentBase.createElement): Moved from ComponentBase. (CommonComponentBase._addContentToElement): Moved from ComponentBase. (CommonComponentBase.prototype.createLink): Added. (CommonComponentBase.createLink): Moved from ComponentBase. (CommonComponentBase._context): Added. Set to document in a browser and MarkupDocument in node.js. (CommonComponentBase._isNode): Added. Set to a function which does instanceof Node/MarkupNode check. (CommonComponentBase._baseClass): Added. Set to ComponentBase or MarkupComponentBase. * public/v3/components/base.js: (ComponentBase): (ComponentBase.prototype._ensureShadowTree): Added the support for the content and style templates. Also avoid parsing the html template each time a component is instantiated by caching the result. * public/v3/index.html: * tools/js/markup-component.js: Added. (MarkupDocument): Added. A fake Document. (MarkupDocument.prototype.createContentRoot): A substitude for attachShadow. (MarkupDocument.prototype.createElement): (MarkupDocument.prototype.createTextNode): (MarkupDocument.prototype._idForClone): (MarkupDocument.prototype.reset): (MarkupDocument.prototype.markup): (MarkupDocument.prototype.escapeAttributeValue): (MarkupDocument.prototype.escapeNodeData): (MarkupNode): Added. A fake Node. Each node gets an unique ID. (MarkupNode.prototype._markup): (MarkupNode.prototype.clone): Implemented by the leave class. (MarkupNode.prototype._cloneNodeData): (MarkupNode.prototype.remove): (MarkupParentNode): Added. An equivalent of ContainerNode in WebCore. (MarkupParentNode.prototype.get childNodes): (MarkupParentNode.prototype._cloneNodeData): (MarkupParentNode.prototype.appendChild): (MarkupParentNode.prototype.removeChild): (MarkupParentNode.prototype.removeAllChildren): (MarkupParentNode.prototype.replaceChild): (MarkupContentRoot): Added. Used like a shadow tree. (MarkupContentRoot.prototype._markup): Added. (MarkupElement): Added. A fake Element. It also implements a subset of IDL attributes implemented by subclasses such as HTMLInputElement for simplicity. (MarkupElement.prototype.get id): Added. (MarkupElement.prototype.get localName): Added. (MarkupElement.prototype.clone): Added. (MarkupElement.prototype.appendChild): Added. (MarkupElement.prototype.addEventListener): Added. (MarkupElement.prototype.setAttribute): Added. (MarkupElement.prototype.getAttribute): Added. (MarkupElement.prototype.get attributes): Added. (MarkupElement.prototype.get textContent): Added. (MarkupElement.prototype.set textContent): Added. (MarkupElement.prototype._serializeStyle): Added. (MarkupElement.prototype._markup): Added. Flattens the tree with content tree like copy & paste so this can't be used to implement innerHTML. (MarkupElement.prototype.get value): Added. (MarkupElement.prototype.set value): Added. (MarkupElement.prototype.get style): Added. Returns a fake writeonly CSSStyleDeclaration. (MarkupElement.prototype.set style): Added. (MarkupElement.get selfClosingNames): Added. A small list of self-closing tags for the HTML generation. (MarkupText): Added. (MarkupText.prototype.clone): Added. (MarkupText.prototype._markup): Added. (MarkupText.prototype.get data): Added. (MarkupText.prototype.set data): Added. (MarkupComponentBase): Added. (MarkupComponentBase.prototype.element): Added. Like ComponentBase's element. (MarkupComponentBase.prototype.content): Added. Like ComponentBase's content. (MarkupComponentBase.prototype._findElementRecursivelyById): Added. A fake getElementById. (MarkupComponentBase.prototype.render): Added. Like ComponentBase's render. (MarkupComponentBase.prototype.runRenderLoop): Added. In ComponentBase, we use requestAnimationFrame. In MarkupComponentBase, we keep rendering until the queue drains empty. (MarkupComponentBase.prototype.renderReplace): Added. Like ComponentBase's renderReplace but applies the transformation of classes to workaround the lack of shadow tree support in scriptless HTML. (MarkupComponentBase.prototype._applyStyleOverrides): Added. Recursively applies the transformation. (MarkupComponentBase.prototype._ensureContentTree): Added. Like ComponentBase's _ensureShadowTree. (MarkupComponentBase.reset): Added. (MarkupComponentBase._parseTemplates): Added. Parses the content & style templates, and generates the transformed fake DOM tree and stylesheet text whereby selectors in each component is modified to be unique across all components. The function to apply the necessary changes to an element is saved in the global map of components, and later used in renderReplace via _applyStyleOverrides. (MarkupComponentBase.defineElement): Added. Like ComponentBase's defineElement. (MarkupComponentBase.prototype.createEventHandler): Added. (MarkupComponentBase.createEventHandler): Added. (MarkupPage): Added. The top-level component responsible for generating a DOCTYPE, head, and body. (MarkupPage.prototype.pageTitle): Added. (MarkupPage.prototype.content): Added. Overrides the one in MarkupComponentBase to return what would be the content of the body element as opposed to the html element for the connivance of subclasses, and to match the behavior of the frontend Page class. (MarkupPage.prototype.render): Added. (MarkupPage.prototype._updateComponentsStylesheet): Added. Concatenates the transformed stylesheet of all components used. (MarkupPage.get contentTemplate): Added. (MarkupPage.prototype.generateMarkup): Added. Enqueues the page to render, spin the render loop, and generates the HTML. We enqueue the page twice in order to invoke _updateComponentsStylesheet after all subcomponent had finished rendering. * unit-tests/markup-component-base-tests.js: Added. * unit-tests/markup-element-tests.js: Added. (.createElement): Added. * unit-tests/markup-page-tests.js: Added. Canonical link: https://commits.webkit.org/201761@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-07 18:25:35 +00:00
'../shared/common-component-base.js',
'components/base.js',
'components/time-series-chart.js',
'components/interactive-time-series-chart.js'],
Add the basic support for writing components in node.js https://bugs.webkit.org/show_bug.cgi?id=186299 Reviewed by Antti Koivisto. Add the basic support for writing components in node.js for generating rich email notifications. To do this, this patch introduces MarkupComponentBase and MarkupPage which implement similar API to ComponentBase and Page classes of v3 UI code. This enables us to share code between frontend and the backend in the future. Because there is no support for declarative custom elements or shadow root in HTML, MarkupComponentBase uses a similar but distinct concept of "content" tree to represent the "DOM" tree for a component. When generating the HTML, MarkupComponentBase and MarkupPage collectively transforms stylesheets and flattens the tree into a single HTML. In order to keep this flatteneing logic simple, MarkupComponentBase only supports a very small subset of CSS selectors to select elements by their local names and class names. Specifically, each class name and element name based selectors are replaced by a globally unique class name based selector, and each element which matches the selector is applied of the same globally unique class name. The transformation is applied when constructing the "content" tree as well as calls to renderReplace. Because much of v3 frontend code relies on DOM API, this patch also implements the simplest form of a fake DOM API as MarkupNode, MarkupParentNode, MarkupElement, and MarkupText. In order to avoid reimplementing HTML & CSS parsers, this patch introduces the concept of content and style templates to ComponentBase which are JSON alternatives to HTML & CSS template strings which can be used in both frontend & backend. * browser-tests/close-button-tests.js: Include CommonComponentBase. * browser-tests/commit-log-viewer-tests.js: Ditto. * browser-tests/component-base-tests.js: Ditto. Added a test cases for content & style templates. (async.importComponentBase): Added. * browser-tests/editable-text-tests.js: Include CommonComponentBase. * browser-tests/index.html: * browser-tests/markup-page-tests.js: Added. * browser-tests/page-router-tests.js: Include CommonComponentBase. * browser-tests/page-tests.js: Ditto. * browser-tests/test-group-form-tests.js: Ditto. * public/shared/common-component-base.js: Added. (CommonComponentBase): Extracted out of ComponentBase. (CommonComponentBase.prototype.renderReplace): Added. (CommonComponentBase.renderReplace): Moved from ComponentBase. (CommonComponentBase.prototype._recursivelyUpgradeUnknownElements): Moved and renamed from ComponentBase's _recursivelyReplaceUnknownElementsByComponents. (CommonComponentBase.prototype._upgradeUnknownElement): Extracted out of the same function. (CommonComponentBase._constructStylesheetFromTemplate): Added. (CommonComponentBase._constructNodeTreeFromTemplate): Added. (CommonComponentBase.prototype.createElement): Added. (CommonComponentBase.createElement): Moved from ComponentBase. (CommonComponentBase._addContentToElement): Moved from ComponentBase. (CommonComponentBase.prototype.createLink): Added. (CommonComponentBase.createLink): Moved from ComponentBase. (CommonComponentBase._context): Added. Set to document in a browser and MarkupDocument in node.js. (CommonComponentBase._isNode): Added. Set to a function which does instanceof Node/MarkupNode check. (CommonComponentBase._baseClass): Added. Set to ComponentBase or MarkupComponentBase. * public/v3/components/base.js: (ComponentBase): (ComponentBase.prototype._ensureShadowTree): Added the support for the content and style templates. Also avoid parsing the html template each time a component is instantiated by caching the result. * public/v3/index.html: * tools/js/markup-component.js: Added. (MarkupDocument): Added. A fake Document. (MarkupDocument.prototype.createContentRoot): A substitude for attachShadow. (MarkupDocument.prototype.createElement): (MarkupDocument.prototype.createTextNode): (MarkupDocument.prototype._idForClone): (MarkupDocument.prototype.reset): (MarkupDocument.prototype.markup): (MarkupDocument.prototype.escapeAttributeValue): (MarkupDocument.prototype.escapeNodeData): (MarkupNode): Added. A fake Node. Each node gets an unique ID. (MarkupNode.prototype._markup): (MarkupNode.prototype.clone): Implemented by the leave class. (MarkupNode.prototype._cloneNodeData): (MarkupNode.prototype.remove): (MarkupParentNode): Added. An equivalent of ContainerNode in WebCore. (MarkupParentNode.prototype.get childNodes): (MarkupParentNode.prototype._cloneNodeData): (MarkupParentNode.prototype.appendChild): (MarkupParentNode.prototype.removeChild): (MarkupParentNode.prototype.removeAllChildren): (MarkupParentNode.prototype.replaceChild): (MarkupContentRoot): Added. Used like a shadow tree. (MarkupContentRoot.prototype._markup): Added. (MarkupElement): Added. A fake Element. It also implements a subset of IDL attributes implemented by subclasses such as HTMLInputElement for simplicity. (MarkupElement.prototype.get id): Added. (MarkupElement.prototype.get localName): Added. (MarkupElement.prototype.clone): Added. (MarkupElement.prototype.appendChild): Added. (MarkupElement.prototype.addEventListener): Added. (MarkupElement.prototype.setAttribute): Added. (MarkupElement.prototype.getAttribute): Added. (MarkupElement.prototype.get attributes): Added. (MarkupElement.prototype.get textContent): Added. (MarkupElement.prototype.set textContent): Added. (MarkupElement.prototype._serializeStyle): Added. (MarkupElement.prototype._markup): Added. Flattens the tree with content tree like copy & paste so this can't be used to implement innerHTML. (MarkupElement.prototype.get value): Added. (MarkupElement.prototype.set value): Added. (MarkupElement.prototype.get style): Added. Returns a fake writeonly CSSStyleDeclaration. (MarkupElement.prototype.set style): Added. (MarkupElement.get selfClosingNames): Added. A small list of self-closing tags for the HTML generation. (MarkupText): Added. (MarkupText.prototype.clone): Added. (MarkupText.prototype._markup): Added. (MarkupText.prototype.get data): Added. (MarkupText.prototype.set data): Added. (MarkupComponentBase): Added. (MarkupComponentBase.prototype.element): Added. Like ComponentBase's element. (MarkupComponentBase.prototype.content): Added. Like ComponentBase's content. (MarkupComponentBase.prototype._findElementRecursivelyById): Added. A fake getElementById. (MarkupComponentBase.prototype.render): Added. Like ComponentBase's render. (MarkupComponentBase.prototype.runRenderLoop): Added. In ComponentBase, we use requestAnimationFrame. In MarkupComponentBase, we keep rendering until the queue drains empty. (MarkupComponentBase.prototype.renderReplace): Added. Like ComponentBase's renderReplace but applies the transformation of classes to workaround the lack of shadow tree support in scriptless HTML. (MarkupComponentBase.prototype._applyStyleOverrides): Added. Recursively applies the transformation. (MarkupComponentBase.prototype._ensureContentTree): Added. Like ComponentBase's _ensureShadowTree. (MarkupComponentBase.reset): Added. (MarkupComponentBase._parseTemplates): Added. Parses the content & style templates, and generates the transformed fake DOM tree and stylesheet text whereby selectors in each component is modified to be unique across all components. The function to apply the necessary changes to an element is saved in the global map of components, and later used in renderReplace via _applyStyleOverrides. (MarkupComponentBase.defineElement): Added. Like ComponentBase's defineElement. (MarkupComponentBase.prototype.createEventHandler): Added. (MarkupComponentBase.createEventHandler): Added. (MarkupPage): Added. The top-level component responsible for generating a DOCTYPE, head, and body. (MarkupPage.prototype.pageTitle): Added. (MarkupPage.prototype.content): Added. Overrides the one in MarkupComponentBase to return what would be the content of the body element as opposed to the html element for the connivance of subclasses, and to match the behavior of the frontend Page class. (MarkupPage.prototype.render): Added. (MarkupPage.prototype._updateComponentsStylesheet): Added. Concatenates the transformed stylesheet of all components used. (MarkupPage.get contentTemplate): Added. (MarkupPage.prototype.generateMarkup): Added. Enqueues the page to render, spin the render loop, and generates the HTML. We enqueue the page twice in order to invoke _updateComponentsStylesheet after all subcomponent had finished rendering. * unit-tests/markup-component-base-tests.js: Added. * unit-tests/markup-element-tests.js: Added. (.createElement): Added. * unit-tests/markup-page-tests.js: Added. Canonical link: https://commits.webkit.org/201761@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-07 18:25:35 +00:00
'CommonComponentBase', 'ComponentBase', 'TimeSeriesChart', 'InteractiveTimeSeriesChart',
Write a script that detects chart changes by using v3 API. https://bugs.webkit.org/show_bug.cgi?id=184419 Reviewed by Ryosuke Niwa. Added a script that detects chart changes and schedule confirming analysis task. * browser-tests/async-task-tests.js: Added a unit test for 'AsyncTask'. * browser-tests/index.html: Added import for 'AsyncTask' for testing. * public/shared/statistics.js: Make 'findRangesForChangeDetectionsWithWelchsTTest' defaults to 0.99 one sided possibility. (Statistics.new.this.findRangesForChangeDetectionsWithWelchsTTest): * public/v3/async-task.js: (AsyncTask.isAvailable): Helper function to determine whether AsyncTask is available or not as 'Worker' is not available in nodejs. (AsyncTask): * public/v3/models/bug.js: Export as a module. * public/v3/models/measurement-set.js: (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added a check to avoid using AsyncTask when running in NodeJs. (MeasurementSet): * server-tests/resources/common-operations.js: Added a helper function to assert certain exception is thrown. (async.assertThrows): * tools/js/measurement-set-analyzer.js: Added 'MeasurementSetAnalyzer' module for analyzing measurement set. (MeasurementSetAnalyzer): (MeasurementSetAnalyzer.prototype.async.analyzeOnce): (MeasurementSetAnalyzer.measurementSetListForAnalysis): (MeasurementSetAnalyzer.prototype.async._analyzeMeasurementSet): * tools/js/v3-models.js: Added import for 'Bug' object. * tools/run-analysis.js: Added this script to detect measurement set changes. (main): (async.analysisLoop): * unit-tests/measurement-set-analyzer-tests.js: Added unit tests for 'MeasurementSetAnalyzer'. * unit-tests/resources/mock-v3-models.js: Reset 'MeasurementSet._set' every time. Update mock platform to include lastModifiedByMetric information. (MockModels.inject): Canonical link: https://commits.webkit.org/200671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-02 06:16:16 +00:00
'Platform', 'Metric', 'Test', 'Repository', 'MeasurementSet', 'MockRemoteAPI', 'AsyncTask').then(() => {
return context.symbols.TimeSeriesChart;
})
},
posixTime: posixTime,
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
get sampleCluster() { return this.makeSampleCluster(); },
makeModelObjectsForSampleCluster(context)
{
const test = context.symbols.Test.ensureSingleton(2, {name: 'Test'});
const metric = context.symbols.Metric.ensureSingleton(1, {name: 'Time', test})
const platform = context.symbols.Platform.ensureSingleton(1,
{name: 'SomePlatform', metrics: [metric], lastModifiedByMetric: [posixTime('2016-01-18T00:00:00Z')]});
metric.addPlatform(platform);
context.symbols.Repository.ensureSingleton(1, {name: 'SomeApp'});
context.symbols.Repository.ensureSingleton(2, {name: 'macOS'});
},
makeSampleCluster(options = {})
{
const baselineStart = options.baselineIsSmaller ? 30 : 130;
const targetStart = options.targetIsBigger ? 120 : 90;
return {
"clusterStart": posixTime('2016-01-01T00:00:00Z'),
"clusterSize": 7 * dayInMilliseconds,
"startTime": posixTime('2016-01-01T00:00:00Z'),
"endTime": posixTime('2016-01-08T00:00:00Z'),
"lastModified": posixTime('2016-01-18T00:00:00Z'),
"clusterCount": 1,
"status": "OK",
"formatMap": [
"id", "mean", "iterationCount", "sum", "squareSum", "markedOutlier",
"revisions",
Refactor "builds" table "build_number" row to "build_tag" to fit more generic use cases. https://bugs.webkit.org/show_bug.cgi?id=203270 Reviewed by Ryosuke Niwa. Rename "build_number" to "build_tag" to fit more generic use cases. Add support to be backward compatible to accept reports contain either "buildNumber" or "buildTag". * browser-tests/index.html: * init-database.sql: * migrate-database.sql: Updated migration sql for this change. * public/admin/test-configurations.php: * public/api/measurement-set.php: * public/api/runs.php: * public/api/upload-root.php: Added support for both "buildNumber" and "buildTag". * public/include/report-processor.php: Added support for both "buildNumber" and "buildTag". * public/v3/models/builder.js: (Builder.prototype.urlForBuild): (Builder): (Build): (Build.prototype.buildTag): (Build.prototype.label): (Build.prototype.url): (Build.prototype.buildNumber): Deleted. * public/v3/models/measurement-adaptor.js: (MeasurementAdaptor): (MeasurementAdaptor.prototype.applyTo.return.build): * public/v3/pages/chart-pane-status-view.js: * public/v3/pages/test-freshness-page.js: (TestFreshnessPage.prototype._renderTooltip): * server-tests/admin-platforms-tests.js: (reportsForDifferentPlatforms): * server-tests/admin-reprocess-report-tests.js: * server-tests/api-commits-tests.js: * server-tests/api-manifest-tests.js: * server-tests/api-measurement-set-tests.js: * server-tests/api-report-tests.js: Added unit tests for testing "buildNumber" and "buildTag". (emptyReport): (reportWitMismatchingCommitTime): (reportWithOneSecondCommitTimeDifference): (emptySlaveReport): (makeReport): (reportWithSameSubtestName): * server-tests/api-upload-root-tests.js: Added unit tests for testing "buildNumber" and "buildTag". * server-tests/privileged-api-add-build-requests-tests.js: * server-tests/privileged-api-create-analysis-task-tests.js: * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): * server-tests/privileged-api-upate-run-status.js: * server-tests/privileged-api-update-test-group-tests.js: (async.createAnalysisTask): * server-tests/resources/mock-data.js: (MockData.addMockConfiguration): (MockData.sampleBuildData): (MockData.finishedBuildData): * server-tests/tools-sync-buildbot-integration-tests.js: * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.initialize): (BuildbotBuildEntry.prototype.buildTag): (BuildbotBuildEntry.prototype.url): (BuildbotSyncer.prototype.urlForBuildTag): (BuildbotBuildEntry.prototype.buildNumber): Deleted. (BuildbotSyncer.prototype.urlForBuildNumber): Deleted. * unit-tests/analysis-task-tests.js: (measurementCluster): * unit-tests/buildbot-syncer-tests.js: * unit-tests/measurement-adaptor-tests.js: * unit-tests/measurement-set-analyzer-tests.js: * unit-tests/measurement-set-tests.js: * unit-tests/resources/mock-v3-models.js: Canonical link: https://commits.webkit.org/216795@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251564 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-24 22:00:37 +00:00
"commitTime", "build", "buildTime", "buildTag", "builder"
],
"configurations": {
"current": [
[
1000, 100, 1, 100, 100 * 100, false,
[ [2000, 1, "4000", null, posixTime('2016-01-05T17:35:00Z')], [3000, 2, "15B42", null, 0, 0] ],
posixTime('2016-01-05T17:35:00Z'), 5000, posixTime('2016-01-05T19:23:00Z'), "10", 7
],
[
1001, 131, 1, 131, 131 * 131, true,
[ [2001, 1, "4001", null, posixTime('2016-01-05T18:43:01Z')], [3000, 2, "15B42", null, 0, 0] ],
posixTime('2016-01-05T18:43:01Z'), 5001, posixTime('2016-01-05T20:58:01Z'), "11", 7
],
[
1002, 122, 1, 122, 122 * 122, false,
[ [2002, 1, "4002", null, posixTime('2016-01-05T20:01:02Z')], [3000, 2, "15B42", null, 0, 0] ],
posixTime('2016-01-05T20:01:02Z'), 5002, posixTime('2016-01-05T22:37:02Z'), "12", 7
],
[
1003, 113, 1, 113, 113 * 113, false,
[ [2003, 1, "4003", null, posixTime('2016-01-05T23:19:03Z')], [3000, 2, "15B42", null, 0, 0] ],
posixTime('2016-01-05T23:19:03Z'), 5003, posixTime('2016-01-06T23:19:03Z'), "13", 7
],
[
1004, 124, 1, 124, 124 * 124, false,
[ [2004, 1, "4004", null, posixTime('2016-01-06T01:52:04Z')], [3001, 2, "15C50", null, 0, 0] ],
posixTime('2016-01-06T01:52:04Z'), 5004, posixTime('2016-01-06T02:42:04Z'), "14", 7
],
[
1005, 115, 1, 115, 115 * 115, true,
[ [2005, 1, "4005", null, posixTime('2016-01-06T03:22:05Z')], [3001, 2, "15C50", null, 0, 0] ],
posixTime('2016-01-06T03:22:05Z'), 5005, posixTime('2016-01-06T06:01:05Z'), "15", 7
],
[
1006, 116, 1, 116, 116 * 116, false,
[ [2006, 1, "4006", null, posixTime('2016-01-06T05:59:06Z')], [3001, 2, "15C50", null, 0, 0] ],
posixTime('2016-01-06T05:59:06Z'), 5006, posixTime('2016-01-06T08:34:06Z'), "16", 7
]
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
],
"baseline": [
[
7000, baselineStart, 1, baselineStart, baselineStart * baselineStart, false,
[ ],
posixTime('2016-01-05T12:00:30Z'), 5030, posixTime('2016-01-05T12:00:30Z'), "30", 7
],
[
7001, baselineStart + 1, 1, baselineStart + 1, Math.pow(baselineStart + 1, 2), false,
[ ],
posixTime('2016-01-06T00:00:31Z'), 5031, posixTime('2016-01-06T00:00:31Z'), "31", 7
],
],
"target": [
[
8000, targetStart, 1, targetStart, targetStart * targetStart, false,
[ ],
posixTime('2016-01-05T12:00:30Z'), 5030, posixTime('2016-01-05T12:00:30Z'), "90", 7
],
[
8001, targetStart + 1, 1, targetStart + 1, Math.pow(targetStart + 1, 2), false,
[ ],
posixTime('2016-01-06T00:00:31Z'), 5031, posixTime('2016-01-06T00:00:31Z'), "91", 7
],
]
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
}};
},
createChartWithSampleCluster(context, sourceList = null, chartOptions = {}, className = 'TimeSeriesChart')
{
const TimeSeriesChart = context.symbols[className];
const MeasurementSet = context.symbols.MeasurementSet;
if (sourceList == null)
sourceList = [{type: 'current'}];
const sampleCluster = MeasurementSet.findSet(1, 1, 0);
for (let source of sourceList) {
if (!source.type)
source.type = 'current';
source.measurementSet = sampleCluster;
}
const chart = new TimeSeriesChart(sourceList, chartOptions);
const element = chart.element();
element.style.width = chartOptions.width || '300px';
element.style.height = chartOptions.height || '100px';
context.document.body.appendChild(element);
return chart;
},
createInteractiveChartWithSampleCluster(context, sourceList = null, chartOptions = {})
{
if (sourceList == null)
sourceList = [{type: 'current', interactive: true}];
return this.createChartWithSampleCluster(context, sourceList, chartOptions, 'InteractiveTimeSeriesChart');
},
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
respondWithSampleCluster(request, options)
{
expect(request.url).to.be('/data/measurement-set-1-1.json');
expect(request.method).to.be('GET');
Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 <rdar://problem/29209427> Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. Canonical link: https://commits.webkit.org/186092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
request.resolve(this.makeSampleCluster(options));
},
};
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
mocha.checkLeaks();
mocha.globals(['expect', 'BrowsingContext', 'CanvasTest', 'ChartTest', 'wait', 'waitForComponentsToRender', 'waitForElementResize']);
Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): Canonical link: https://commits.webkit.org/184156@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-16 00:12:22 +00:00
mocha.run();
</script>
</body>
</html>