Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Side by Side Diff: remoting/webapp/crd/js/buffered_signal_strategy.js

Issue 1285213006: Send connection setup results using XHRs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 'use strict'; 5 'use strict';
6 6
7 /** @suppress {duplicate} */ 7 /** @suppress {duplicate} */
8 var remoting = remoting || {}; 8 var remoting = remoting || {};
9 9
10 /** 10 /**
(...skipping 25 matching lines...) Expand all
36 /** 36 /**
37 * Sends a message. Can be called only in CONNECTED state. 37 * Sends a message. Can be called only in CONNECTED state.
38 * @param {string} message 38 * @param {string} message
39 */ 39 */
40 remoting.BufferedSignalStrategy.prototype.sendMessage = function(message) { 40 remoting.BufferedSignalStrategy.prototype.sendMessage = function(message) {
41 this.pendingMessages_.push(message); 41 this.pendingMessages_.push(message);
42 this.flush_(); 42 this.flush_();
43 }; 43 };
44 44
45 /** 45 /**
46 * Send any messages accumulated during connection set-up.
47 *
48 * @param {remoting.Logger} logger The Logger instance for the connection.
49 */
50 remoting.BufferedSignalStrategy.prototype.sendConnectionSetupResults =
51 function(logger) {
52 this.underlying_.sendConnectionSetupResults(logger);
53 };
54
55 /**
56 * If the underlying implementation is connected, flush all pending messages. 46 * If the underlying implementation is connected, flush all pending messages.
57 * @private 47 * @private
58 */ 48 */
59 remoting.BufferedSignalStrategy.prototype.flush_ = function() { 49 remoting.BufferedSignalStrategy.prototype.flush_ = function() {
60 if (this.underlying_.getState() !== remoting.SignalStrategy.State.CONNECTED) { 50 if (this.underlying_.getState() !== remoting.SignalStrategy.State.CONNECTED) {
61 return; 51 return;
62 } 52 }
63 for (var i = 0; i < this.pendingMessages_.length; ++i) { 53 for (var i = 0; i < this.pendingMessages_.length; ++i) {
64 this.underlying_.sendMessage(this.pendingMessages_[i]); 54 this.underlying_.sendMessage(this.pendingMessages_[i]);
65 } 55 }
(...skipping 26 matching lines...) Expand all
92 console.error('Unexpected getError().'); 82 console.error('Unexpected getError().');
93 }; 83 };
94 84
95 remoting.BufferedSignalStrategy.prototype.getJid = function() { 85 remoting.BufferedSignalStrategy.prototype.getJid = function() {
96 console.error('Unexpected getJid().'); 86 console.error('Unexpected getJid().');
97 }; 87 };
98 88
99 remoting.BufferedSignalStrategy.prototype.getType = function() { 89 remoting.BufferedSignalStrategy.prototype.getType = function() {
100 console.error('Unexpected getType().'); 90 console.error('Unexpected getType().');
101 }; 91 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698