OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * @fileoverview | 6 * @fileoverview |
7 * Class handling creation and teardown of a remoting client session. | 7 * Class handling creation and teardown of a remoting client session. |
8 * | 8 * |
9 * This abstracts a <embed> element and controls the plugin which does the | 9 * This abstracts a <embed> element and controls the plugin which does the |
10 * actual remoting work. There should be no UI code inside this class. It | 10 * actual remoting work. There should be no UI code inside this class. It |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 this.clientJid = remoting.wcs.getJid(); | 265 this.clientJid = remoting.wcs.getJid(); |
266 if (this.clientJid == '') { | 266 if (this.clientJid == '') { |
267 remoting.debug.log('Tried to connect without a full JID.'); | 267 remoting.debug.log('Tried to connect without a full JID.'); |
268 } | 268 } |
269 remoting.debug.setJids(this.clientJid, this.hostJid); | 269 remoting.debug.setJids(this.clientJid, this.hostJid); |
270 /** @type {remoting.ClientSession} */ | 270 /** @type {remoting.ClientSession} */ |
271 var that = this; | 271 var that = this; |
272 /** @param {string} stanza The IQ stanza received. */ | 272 /** @param {string} stanza The IQ stanza received. */ |
273 var onIq = function(stanza) { | 273 var onIq = function(stanza) { |
274 remoting.debug.logIq(false, stanza); | 274 remoting.debug.logIq(false, stanza); |
275 that.plugin.onIq(stanza); | 275 if (that.plugin.onIq) { |
| 276 that.plugin.onIq(stanza); |
| 277 } else { |
| 278 // plugin.onIq may not be set after the plugin has been shut |
| 279 // down. Particularly this happens when we receive response to |
| 280 // session-terminate stanza. |
| 281 remoting.debug.log( |
| 282 'plugin.onIq is not set so dropping incoming message.'); |
| 283 } |
276 } | 284 } |
277 remoting.wcs.setOnIq(onIq); | 285 remoting.wcs.setOnIq(onIq); |
278 that.plugin.connect(this.hostJid, this.hostPublicKey, this.clientJid, | 286 that.plugin.connect(this.hostJid, this.hostPublicKey, this.clientJid, |
279 this.accessCode); | 287 this.accessCode); |
280 }; | 288 }; |
281 | 289 |
282 /** | 290 /** |
283 * Callback that the plugin invokes to indicate that the connection | 291 * Callback that the plugin invokes to indicate that the connection |
284 * status has changed. | 292 * status has changed. |
285 */ | 293 */ |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 return { | 416 return { |
409 'video_bandwidth': this.plugin.videoBandwidth, | 417 'video_bandwidth': this.plugin.videoBandwidth, |
410 'video_frame_rate': this.plugin.videoFrameRate, | 418 'video_frame_rate': this.plugin.videoFrameRate, |
411 'capture_latency': this.plugin.videoCaptureLatency, | 419 'capture_latency': this.plugin.videoCaptureLatency, |
412 'encode_latency': this.plugin.videoEncodeLatency, | 420 'encode_latency': this.plugin.videoEncodeLatency, |
413 'decode_latency': this.plugin.videoDecodeLatency, | 421 'decode_latency': this.plugin.videoDecodeLatency, |
414 'render_latency': this.plugin.videoRenderLatency, | 422 'render_latency': this.plugin.videoRenderLatency, |
415 'roundtrip_latency': this.plugin.roundTripLatency | 423 'roundtrip_latency': this.plugin.roundTripLatency |
416 }; | 424 }; |
417 }; | 425 }; |
OLD | NEW |