Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** This view displays summary statistics on bandwidth usage. */ | 5 /** This view displays summary statistics on bandwidth usage. */ |
| 6 var BandwidthView = (function() { | 6 var BandwidthView = (function() { |
| 7 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 // We inherit from DivView. | 9 // We inherit from DivView. |
| 10 var superClass = DivView; | 10 var superClass = DivView; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 */ | 66 */ |
| 67 updateBandwidthUsageTable_: function() { | 67 updateBandwidthUsageTable_: function() { |
| 68 var sessionNetworkStats = this.sessionNetworkStats_; | 68 var sessionNetworkStats = this.sessionNetworkStats_; |
| 69 var historicNetworkStats = this.historicNetworkStats_; | 69 var historicNetworkStats = this.historicNetworkStats_; |
| 70 if (!sessionNetworkStats || !historicNetworkStats) | 70 if (!sessionNetworkStats || !historicNetworkStats) |
| 71 return false; | 71 return false; |
| 72 | 72 |
| 73 var sessionOriginal = sessionNetworkStats.session_original_content_length; | 73 var sessionOriginal = sessionNetworkStats.session_original_content_length; |
| 74 var sessionReceived = sessionNetworkStats.session_received_content_length; | 74 var sessionReceived = sessionNetworkStats.session_received_content_length; |
| 75 var historicOriginal = | 75 var historicOriginal = |
| 76 historicNetworkStats.historic_original_content_length; | 76 historicNetworkStats.historic_original_content_length + |
| 77 sessionOriginal; | |
| 77 var historicReceived = | 78 var historicReceived = |
| 78 historicNetworkStats.historic_received_content_length; | 79 historicNetworkStats.historic_received_content_length + |
| 80 sessionReceived; | |
|
mmenke
2014/09/15 15:11:02
Why the change? We still include session prefs in
megjablon
2014/09/15 18:19:23
Ah I didn't understand how historic_received_conte
| |
| 79 | 81 |
| 80 var rows = []; | 82 var rows = []; |
| 81 rows.push({ | 83 rows.push({ |
| 82 title: 'Original (KB)', | 84 title: 'Original (KB)', |
| 83 sessionValue: bytesToRoundedKilobytes_(sessionOriginal), | 85 sessionValue: bytesToRoundedKilobytes_(sessionOriginal), |
| 84 historicValue: bytesToRoundedKilobytes_(historicOriginal) | 86 historicValue: bytesToRoundedKilobytes_(historicOriginal) |
| 85 }); | 87 }); |
| 86 rows.push({ | 88 rows.push({ |
| 87 title: 'Received (KB)', | 89 title: 'Received (KB)', |
| 88 sessionValue: bytesToRoundedKilobytes_(sessionReceived), | 90 sessionValue: bytesToRoundedKilobytes_(sessionReceived), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 */ | 122 */ |
| 121 function getPercentSavings_(original, received) { | 123 function getPercentSavings_(original, received) { |
| 122 if (original > 0) { | 124 if (original > 0) { |
| 123 return ((original - received) * 100 / original).toFixed(1); | 125 return ((original - received) * 100 / original).toFixed(1); |
| 124 } | 126 } |
| 125 return '0.0'; | 127 return '0.0'; |
| 126 } | 128 } |
| 127 | 129 |
| 128 return BandwidthView; | 130 return BandwidthView; |
| 129 })(); | 131 })(); |
| OLD | NEW |