Bug 1408085 - resizeWaterfall via requestIdleCallback;r=Honza
authorgasolin <gasolin@gmail.com>
Mon, 16 Oct 2017 10:05:59 +0800
changeset 386786 bb545de71336d026a474541f6930f8eef46d2334
parent 386785 c94d9d435a0de59b65e89aee2a9ff8d06698dec2
child 386787 7f841ee580b9745b6d75649619411295e863ed6e
push id96311
push userarchaeopteryx@coole-files.de
push dateWed, 18 Oct 2017 09:52:02 +0000
treeherdermozilla-inbound@a8a1e8cc1980 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1408085
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1408085 - resizeWaterfall via requestIdleCallback;r=Honza MozReview-Commit-ID: Fws5LrQGhlv
devtools/client/netmonitor/src/components/request-list-header.js
--- a/devtools/client/netmonitor/src/components/request-list-header.js
+++ b/devtools/client/netmonitor/src/components/request-list-header.js
@@ -82,19 +82,19 @@ const RequestListHeader = createClass({
     this.background.draw(props);
   },
 
   resizeWaterfall() {
     let waterfallHeader = this.refs.waterfallHeader;
     if (waterfallHeader) {
       // Measure its width and update the 'waterfallWidth' property in the store.
       // The 'waterfallWidth' will be further updated on every window resize.
-      setTimeout(() => {
-        this.props.resizeWaterfall(waterfallHeader.getBoundingClientRect().width);
-      }, 500);
+      window.cancelIdleCallback(this._resizeTimerId);
+      this._resizeTimerId = window.requestIdleCallback(() =>
+        this.props.resizeWaterfall(waterfallHeader.getBoundingClientRect().width));
     }
   },
 
   render() {
     let { columns, scale, sort, sortBy, waterfallWidth } = this.props;
 
     return (
       div({ className: "devtools-toolbar requests-list-headers" },