| 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 /** | 5 /** |
| 6 * This class provides a "bridge" for communicating between the javascript and | 6 * This class provides a "bridge" for communicating between the javascript and |
| 7 * the browser. | 7 * the browser. |
| 8 */ | 8 */ |
| 9 var BrowserBridge = (function() { | 9 var BrowserBridge = (function() { |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 this.sendGetHostResolverInfo.bind(this)); | 47 this.sendGetHostResolverInfo.bind(this)); |
| 48 this.pollableDataHelpers_.socketPoolInfo = | 48 this.pollableDataHelpers_.socketPoolInfo = |
| 49 new PollableDataHelper('onSocketPoolInfoChanged', | 49 new PollableDataHelper('onSocketPoolInfoChanged', |
| 50 this.sendGetSocketPoolInfo.bind(this)); | 50 this.sendGetSocketPoolInfo.bind(this)); |
| 51 this.pollableDataHelpers_.sessionNetworkStats = | 51 this.pollableDataHelpers_.sessionNetworkStats = |
| 52 new PollableDataHelper('onSessionNetworkStatsChanged', | 52 new PollableDataHelper('onSessionNetworkStatsChanged', |
| 53 this.sendGetSessionNetworkStats.bind(this)); | 53 this.sendGetSessionNetworkStats.bind(this)); |
| 54 this.pollableDataHelpers_.historicNetworkStats = | 54 this.pollableDataHelpers_.historicNetworkStats = |
| 55 new PollableDataHelper('onHistoricNetworkStatsChanged', | 55 new PollableDataHelper('onHistoricNetworkStatsChanged', |
| 56 this.sendGetHistoricNetworkStats.bind(this)); | 56 this.sendGetHistoricNetworkStats.bind(this)); |
| 57 this.pollableDataHelpers_.quicInfo = |
| 58 new PollableDataHelper('onQuicInfoChanged', |
| 59 this.sendGetQuicInfo.bind(this)); |
| 57 this.pollableDataHelpers_.spdySessionInfo = | 60 this.pollableDataHelpers_.spdySessionInfo = |
| 58 new PollableDataHelper('onSpdySessionInfoChanged', | 61 new PollableDataHelper('onSpdySessionInfoChanged', |
| 59 this.sendGetSpdySessionInfo.bind(this)); | 62 this.sendGetSpdySessionInfo.bind(this)); |
| 60 this.pollableDataHelpers_.spdyStatus = | 63 this.pollableDataHelpers_.spdyStatus = |
| 61 new PollableDataHelper('onSpdyStatusChanged', | 64 new PollableDataHelper('onSpdyStatusChanged', |
| 62 this.sendGetSpdyStatus.bind(this)); | 65 this.sendGetSpdyStatus.bind(this)); |
| 63 this.pollableDataHelpers_.spdyAlternateProtocolMappings = | 66 this.pollableDataHelpers_.spdyAlternateProtocolMappings = |
| 64 new PollableDataHelper('onSpdyAlternateProtocolMappingsChanged', | 67 new PollableDataHelper('onSpdyAlternateProtocolMappingsChanged', |
| 65 this.sendGetSpdyAlternateProtocolMappings.bind( | 68 this.sendGetSpdyAlternateProtocolMappings.bind( |
| 66 this)); | 69 this)); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 }, | 208 }, |
| 206 | 209 |
| 207 sendCloseIdleSockets: function() { | 210 sendCloseIdleSockets: function() { |
| 208 this.send('closeIdleSockets'); | 211 this.send('closeIdleSockets'); |
| 209 }, | 212 }, |
| 210 | 213 |
| 211 sendFlushSocketPools: function() { | 214 sendFlushSocketPools: function() { |
| 212 this.send('flushSocketPools'); | 215 this.send('flushSocketPools'); |
| 213 }, | 216 }, |
| 214 | 217 |
| 218 sendGetQuicInfo: function() { |
| 219 this.send('getQuicInfo'); |
| 220 }, |
| 221 |
| 215 sendGetSpdySessionInfo: function() { | 222 sendGetSpdySessionInfo: function() { |
| 216 this.send('getSpdySessionInfo'); | 223 this.send('getSpdySessionInfo'); |
| 217 }, | 224 }, |
| 218 | 225 |
| 219 sendGetSpdyStatus: function() { | 226 sendGetSpdyStatus: function() { |
| 220 this.send('getSpdyStatus'); | 227 this.send('getSpdyStatus'); |
| 221 }, | 228 }, |
| 222 | 229 |
| 223 sendGetSpdyAlternateProtocolMappings: function() { | 230 sendGetSpdyAlternateProtocolMappings: function() { |
| 224 this.send('getSpdyAlternateProtocolMappings'); | 231 this.send('getSpdyAlternateProtocolMappings'); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 327 |
| 321 receivedSessionNetworkStats: function(sessionNetworkStats) { | 328 receivedSessionNetworkStats: function(sessionNetworkStats) { |
| 322 this.pollableDataHelpers_.sessionNetworkStats.update(sessionNetworkStats); | 329 this.pollableDataHelpers_.sessionNetworkStats.update(sessionNetworkStats); |
| 323 }, | 330 }, |
| 324 | 331 |
| 325 receivedHistoricNetworkStats: function(historicNetworkStats) { | 332 receivedHistoricNetworkStats: function(historicNetworkStats) { |
| 326 this.pollableDataHelpers_.historicNetworkStats.update( | 333 this.pollableDataHelpers_.historicNetworkStats.update( |
| 327 historicNetworkStats); | 334 historicNetworkStats); |
| 328 }, | 335 }, |
| 329 | 336 |
| 337 receivedQuicInfo: function(quicInfo) { |
| 338 this.pollableDataHelpers_.quicInfo.update(quicInfo); |
| 339 }, |
| 340 |
| 330 receivedSpdySessionInfo: function(spdySessionInfo) { | 341 receivedSpdySessionInfo: function(spdySessionInfo) { |
| 331 this.pollableDataHelpers_.spdySessionInfo.update(spdySessionInfo); | 342 this.pollableDataHelpers_.spdySessionInfo.update(spdySessionInfo); |
| 332 }, | 343 }, |
| 333 | 344 |
| 334 receivedSpdyStatus: function(spdyStatus) { | 345 receivedSpdyStatus: function(spdyStatus) { |
| 335 this.pollableDataHelpers_.spdyStatus.update(spdyStatus); | 346 this.pollableDataHelpers_.spdyStatus.update(spdyStatus); |
| 336 }, | 347 }, |
| 337 | 348 |
| 338 receivedSpdyAlternateProtocolMappings: | 349 receivedSpdyAlternateProtocolMappings: |
| 339 function(spdyAlternateProtocolMappings) { | 350 function(spdyAlternateProtocolMappings) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 * called back when data is received, through: | 509 * called back when data is received, through: |
| 499 * | 510 * |
| 500 * observer.onHistoricNetworkStatsChanged(historicNetworkStats) | 511 * observer.onHistoricNetworkStatsChanged(historicNetworkStats) |
| 501 */ | 512 */ |
| 502 addHistoricNetworkStatsObserver: function(observer, ignoreWhenUnchanged) { | 513 addHistoricNetworkStatsObserver: function(observer, ignoreWhenUnchanged) { |
| 503 this.pollableDataHelpers_.historicNetworkStats.addObserver( | 514 this.pollableDataHelpers_.historicNetworkStats.addObserver( |
| 504 observer, ignoreWhenUnchanged); | 515 observer, ignoreWhenUnchanged); |
| 505 }, | 516 }, |
| 506 | 517 |
| 507 /** | 518 /** |
| 519 * Adds a listener of the QUIC info. |observer| will be called back |
| 520 * when data is received, through: |
| 521 * |
| 522 * observer.onQuicInfoChanged(quicInfo) |
| 523 */ |
| 524 addQuicInfoObserver: function(observer, ignoreWhenUnchanged) { |
| 525 this.pollableDataHelpers_.quicInfo.addObserver( |
| 526 observer, ignoreWhenUnchanged); |
| 527 }, |
| 528 |
| 529 /** |
| 508 * Adds a listener of the SPDY info. |observer| will be called back | 530 * Adds a listener of the SPDY info. |observer| will be called back |
| 509 * when data is received, through: | 531 * when data is received, through: |
| 510 * | 532 * |
| 511 * observer.onSpdySessionInfoChanged(spdySessionInfo) | 533 * observer.onSpdySessionInfoChanged(spdySessionInfo) |
| 512 */ | 534 */ |
| 513 addSpdySessionInfoObserver: function(observer, ignoreWhenUnchanged) { | 535 addSpdySessionInfoObserver: function(observer, ignoreWhenUnchanged) { |
| 514 this.pollableDataHelpers_.spdySessionInfo.addObserver( | 536 this.pollableDataHelpers_.spdySessionInfo.addObserver( |
| 515 observer, ignoreWhenUnchanged); | 537 observer, ignoreWhenUnchanged); |
| 516 }, | 538 }, |
| 517 | 539 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 helper.removeObserver(this); | 826 helper.removeObserver(this); |
| 805 --this.observingCount_; | 827 --this.observingCount_; |
| 806 this.updatedData_[name] = data; | 828 this.updatedData_[name] = data; |
| 807 if (this.observingCount_ == 0) | 829 if (this.observingCount_ == 0) |
| 808 this.callback_(this.updatedData_); | 830 this.callback_(this.updatedData_); |
| 809 } | 831 } |
| 810 }; | 832 }; |
| 811 | 833 |
| 812 return BrowserBridge; | 834 return BrowserBridge; |
| 813 })(); | 835 })(); |
| OLD | NEW |