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

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

Issue 983023002: [Chromoting] Use compact notation for javascript @private types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /**
11 * A signal strategy encapsulating a primary and a back-up strategy. If the 11 * A signal strategy encapsulating a primary and a back-up strategy. If the
12 * primary fails or times out, then the secondary is used. Information about 12 * primary fails or times out, then the secondary is used. Information about
13 * which strategy was used, and why, is returned via |onProgressCallback|. 13 * which strategy was used, and why, is returned via |onProgressCallback|.
14 * 14 *
15 * @param {remoting.SignalStrategy} primary 15 * @param {remoting.SignalStrategy} primary
16 * @param {remoting.SignalStrategy} secondary 16 * @param {remoting.SignalStrategy} secondary
17 * 17 *
18 * @implements {remoting.SignalStrategy} 18 * @implements {remoting.SignalStrategy}
19 * @constructor 19 * @constructor
20 */ 20 */
21 remoting.FallbackSignalStrategy = function(primary, 21 remoting.FallbackSignalStrategy = function(primary,
22 secondary) { 22 secondary) {
23 /** 23 /** @private {remoting.SignalStrategy} */
24 * @type {remoting.SignalStrategy}
25 * @private
26 */
27 this.primary_ = primary; 24 this.primary_ = primary;
28 this.primary_.setStateChangedCallback(this.onPrimaryStateChanged_.bind(this)); 25 this.primary_.setStateChangedCallback(this.onPrimaryStateChanged_.bind(this));
29 26
30 /** 27 /** @private {remoting.SignalStrategy} */
31 * @type {remoting.SignalStrategy}
32 * @private
33 */
34 this.secondary_ = secondary; 28 this.secondary_ = secondary;
35 this.secondary_.setStateChangedCallback( 29 this.secondary_.setStateChangedCallback(
36 this.onSecondaryStateChanged_.bind(this)); 30 this.onSecondaryStateChanged_.bind(this));
37 31
38 /** 32 /** @private {?function(remoting.SignalStrategy.State)} */
39 * @type {?function(remoting.SignalStrategy.State)}
40 * @private
41 */
42 this.onStateChangedCallback_ = null; 33 this.onStateChangedCallback_ = null;
43 34
44 /** 35 /** @private {?function(Element):void} */
45 * @type {?function(Element):void}
46 * @private
47 */
48 this.onIncomingStanzaCallback_ = null; 36 this.onIncomingStanzaCallback_ = null;
49 37
50 /** 38 /**
51 * @type {number} 39 * @private {number}
52 * @private
53 * @const 40 * @const
54 */ 41 */
55 this.PRIMARY_CONNECT_TIMEOUT_MS_ = 10 * 1000; 42 this.PRIMARY_CONNECT_TIMEOUT_MS_ = 10 * 1000;
56 43
57 /** 44 /**
58 * @enum {string} 45 * @enum {string}
59 * @private 46 * @private
60 */ 47 */
61 this.State = { 48 this.State = {
62 NOT_CONNECTED: 'not-connected', 49 NOT_CONNECTED: 'not-connected',
63 PRIMARY_PENDING: 'primary-pending', 50 PRIMARY_PENDING: 'primary-pending',
64 PRIMARY_SUCCEEDED: 'primary-succeeded', 51 PRIMARY_SUCCEEDED: 'primary-succeeded',
65 SECONDARY_PENDING: 'secondary-pending', 52 SECONDARY_PENDING: 'secondary-pending',
66 SECONDARY_SUCCEEDED: 'secondary-succeeded', 53 SECONDARY_SUCCEEDED: 'secondary-succeeded',
67 SECONDARY_FAILED: 'secondary-failed', 54 SECONDARY_FAILED: 'secondary-failed',
68 CLOSED: 'closed' 55 CLOSED: 'closed'
69 }; 56 };
70 57
71 /** 58 /** @private {string} */
72 * @type {string}
73 * @private
74 */
75 this.state_ = this.State.NOT_CONNECTED; 59 this.state_ = this.State.NOT_CONNECTED;
76 60
77 /** 61 /** @private {?remoting.SignalStrategy.State} */
78 * @type {?remoting.SignalStrategy.State}
79 * @private
80 */
81 this.externalState_ = null; 62 this.externalState_ = null;
82 63
83 /** 64 /** @private {string} */
84 * @type {string}
85 * @private
86 */
87 this.server_ = ''; 65 this.server_ = '';
88 66
89 /** 67 /** @private {string} */
90 * @type {string}
91 * @private
92 */
93 this.username_ = ''; 68 this.username_ = '';
94 69
95 /** 70 /** @private {string} */
96 * @type {string}
97 * @private
98 */
99 this.authToken_ = ''; 71 this.authToken_ = '';
100 72
101 /** 73 /** @private {number} */
102 * @type {number}
103 * @private
104 */
105 this.primaryConnectTimerId_ = 0; 74 this.primaryConnectTimerId_ = 0;
106 75
107 /** 76 /** @private {remoting.LogToServer} */
108 * @type {remoting.LogToServer}
109 * @private
110 */
111 this.logToServer_ = null; 77 this.logToServer_ = null;
112 78
113 /** 79 /**
114 * @type {Array<{strategyType: remoting.SignalStrategy.Type, 80 * @type {Array<{strategyType: remoting.SignalStrategy.Type,
115 progress: remoting.FallbackSignalStrategy.Progress}>} 81 progress: remoting.FallbackSignalStrategy.Progress}>}
116 */ 82 */
117 this.connectionSetupResults_ = []; 83 this.connectionSetupResults_ = [];
118 84
119 }; 85 };
120 86
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 console.log('FallbackSignalStrategy progress: ' + strategy.getType() + ' ' + 348 console.log('FallbackSignalStrategy progress: ' + strategy.getType() + ' ' +
383 progress); 349 progress);
384 this.connectionSetupResults_.push({ 350 this.connectionSetupResults_.push({
385 'strategyType': strategy.getType(), 351 'strategyType': strategy.getType(),
386 'progress': progress 352 'progress': progress
387 }); 353 });
388 if (this.logToServer_) { 354 if (this.logToServer_) {
389 this.sendConnectionSetupResultsInternal_(); 355 this.sendConnectionSetupResultsInternal_();
390 } 356 }
391 }; 357 };
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/dns_blackhole_checker.js ('k') | remoting/webapp/crd/js/fullscreen_v1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698