Commit 74741f87 authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

cr-network-list-item: Only fire 'network-connected' on change

Currently 'network-connected' is fired much to often, causing
significant slowdowns on slower devices, especially in
chrome://network (debugging) but potentially to a lesser degree
in oobe and Settings.

Bug: none
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I171e2015b7257f9e19b383687ae20282c0eb6c4c
Reviewed-on: https://chromium-review.googlesource.com/747077Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513267}
parent b009a8f9
......@@ -50,6 +50,12 @@ Polymer({
reflectToAttribute: true,
computed: 'getItemName_(item)',
},
/**
* The cached ConnectionState for the network.
* @type {!CrOnc.ConnectionState|undefined}
*/
connectionState_: String,
},
behaviors: [CrPolicyNetworkBehavior],
......@@ -66,10 +72,14 @@ Polymer({
/** @private */
networkStateChanged_: function() {
if (this.networkState &&
this.networkState.ConnectionState == CrOnc.ConnectionState.CONNECTED) {
if (!this.networkState)
return;
var connectionState = this.networkState.ConnectionState;
if (connectionState == this.connectionState_)
return;
this.connectionState_ = connectionState;
if (connectionState == CrOnc.ConnectionState.CONNECTED)
this.fire('network-connected', this.networkState);
}
},
/**
......
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