Commit 0eac373e authored by allada's avatar allada Committed by Commit bot

[Devtools] Use requestAnimationFrame instead of timer in network

This patch is to increase perceived performance of network panel
by using requestAnimationFrame instead of setTimeout for scheduled
refreshes.

R=lushnikov
BUG=None

Review-Url: https://codereview.chromium.org/2392123002
Cr-Commit-Position: refs/heads/master@{#423039}
parent 063379e6
...@@ -99,8 +99,6 @@ WebInspector.NetworkLogView._isMatchingSearchQuerySymbol = Symbol("isMatchingSea ...@@ -99,8 +99,6 @@ WebInspector.NetworkLogView._isMatchingSearchQuerySymbol = Symbol("isMatchingSea
WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": true, "wss": true}; WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": true, "wss": true};
WebInspector.NetworkLogView._defaultRefreshDelay = 200;
WebInspector.NetworkLogView._waterfallMinOvertime = 1; WebInspector.NetworkLogView._waterfallMinOvertime = 1;
WebInspector.NetworkLogView._waterfallMaxOvertime = 3; WebInspector.NetworkLogView._waterfallMaxOvertime = 3;
...@@ -462,8 +460,8 @@ WebInspector.NetworkLogView.prototype = { ...@@ -462,8 +460,8 @@ WebInspector.NetworkLogView.prototype = {
this._needsRefresh = true; this._needsRefresh = true;
if (this.isShowing() && !this._refreshTimeout) if (this.isShowing() && !this._refreshRequestId)
this._refreshTimeout = setTimeout(this.refresh.bind(this), WebInspector.NetworkLogView._defaultRefreshDelay); this._refreshRequestId = this.element.window().requestAnimationFrame(this.refresh.bind(this));
}, },
/** /**
...@@ -580,9 +578,10 @@ WebInspector.NetworkLogView.prototype = { ...@@ -580,9 +578,10 @@ WebInspector.NetworkLogView.prototype = {
refresh: function() refresh: function()
{ {
this._needsRefresh = false; this._needsRefresh = false;
if (this._refreshTimeout) {
clearTimeout(this._refreshTimeout); if (this._refreshRequestId) {
delete this._refreshTimeout; this.element.window().cancelAnimationFrame(this._refreshRequestId);
delete this._refreshRequestId;
} }
this.removeAllNodeHighlights(); this.removeAllNodeHighlights();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment