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

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

Issue 953223002: Include time elapsed since start of a remoting session in each log entry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove now unnecessary session duration logging. 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
« no previous file with comments | « no previous file | remoting/webapp/crd/js/log_to_server.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /**
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 this.primaryConnectTimerId_ = 0; 105 this.primaryConnectTimerId_ = 0;
106 106
107 /** 107 /**
108 * @type {remoting.LogToServer} 108 * @type {remoting.LogToServer}
109 * @private 109 * @private
110 */ 110 */
111 this.logToServer_ = null; 111 this.logToServer_ = null;
112 112
113 /** 113 /**
114 * @type {Array<{strategyType: remoting.SignalStrategy.Type, 114 * @type {Array<{strategyType: remoting.SignalStrategy.Type,
115 progress: remoting.FallbackSignalStrategy.Progress, 115 progress: remoting.FallbackSignalStrategy.Progress}>}
116 * elapsed: number}>}
117 */ 116 */
118 this.connectionSetupResults_ = []; 117 this.connectionSetupResults_ = [];
119 118
120 /**
121 * @type {number}
122 * @private
123 */
124 this.startTime_ = 0;
125 }; 119 };
126 120
127 /** 121 /**
128 * @enum {string} 122 * @enum {string}
129 */ 123 */
130 remoting.FallbackSignalStrategy.Progress = { 124 remoting.FallbackSignalStrategy.Progress = {
131 SUCCEEDED: 'succeeded', 125 SUCCEEDED: 'succeeded',
132 FAILED: 'failed', 126 FAILED: 'failed',
133 TIMED_OUT: 'timed-out', 127 TIMED_OUT: 'timed-out',
134 SUCCEEDED_LATE: 'succeeded-late', 128 SUCCEEDED_LATE: 'succeeded-late',
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 * @param {string} authToken 165 * @param {string} authToken
172 */ 166 */
173 remoting.FallbackSignalStrategy.prototype.connect = 167 remoting.FallbackSignalStrategy.prototype.connect =
174 function(server, username, authToken) { 168 function(server, username, authToken) {
175 base.debug.assert(this.state_ == this.State.NOT_CONNECTED); 169 base.debug.assert(this.state_ == this.State.NOT_CONNECTED);
176 base.debug.assert(this.onStateChangedCallback_ != null); 170 base.debug.assert(this.onStateChangedCallback_ != null);
177 this.server_ = server; 171 this.server_ = server;
178 this.username_ = username; 172 this.username_ = username;
179 this.authToken_ = authToken; 173 this.authToken_ = authToken;
180 this.state_ = this.State.PRIMARY_PENDING; 174 this.state_ = this.State.PRIMARY_PENDING;
181 this.startTime_ = new Date().getTime();
182 this.primary_.setIncomingStanzaCallback(this.onIncomingStanzaCallback_); 175 this.primary_.setIncomingStanzaCallback(this.onIncomingStanzaCallback_);
183 this.primary_.connect(server, username, authToken); 176 this.primary_.connect(server, username, authToken);
184 this.primaryConnectTimerId_ = 177 this.primaryConnectTimerId_ =
185 window.setTimeout(this.onPrimaryTimeout_.bind(this), 178 window.setTimeout(this.onPrimaryTimeout_.bind(this),
186 this.PRIMARY_CONNECT_TIMEOUT_MS_); 179 this.PRIMARY_CONNECT_TIMEOUT_MS_);
187 }; 180 };
188 181
189 /** 182 /**
190 * Sends a message. Can be called only in CONNECTED state. 183 * Sends a message. Can be called only in CONNECTED state.
191 * @param {string} message 184 * @param {string} message
(...skipping 12 matching lines...) Expand all
204 function(logToServer) { 197 function(logToServer) {
205 this.logToServer_ = logToServer; 198 this.logToServer_ = logToServer;
206 this.sendConnectionSetupResultsInternal_(); 199 this.sendConnectionSetupResultsInternal_();
207 } 200 }
208 201
209 remoting.FallbackSignalStrategy.prototype.sendConnectionSetupResultsInternal_ = 202 remoting.FallbackSignalStrategy.prototype.sendConnectionSetupResultsInternal_ =
210 function() { 203 function() {
211 for (var i = 0; i < this.connectionSetupResults_.length; ++i) { 204 for (var i = 0; i < this.connectionSetupResults_.length; ++i) {
212 var result = this.connectionSetupResults_[i]; 205 var result = this.connectionSetupResults_[i];
213 this.logToServer_.logSignalStrategyProgress(result.strategyType, 206 this.logToServer_.logSignalStrategyProgress(result.strategyType,
214 result.progress, 207 result.progress);
215 result.elapsed);
216 } 208 }
217 this.connectionSetupResults_ = []; 209 this.connectionSetupResults_ = [];
218 }; 210 };
219 211
220 /** @return {remoting.SignalStrategy.State} Current state */ 212 /** @return {remoting.SignalStrategy.State} Current state */
221 remoting.FallbackSignalStrategy.prototype.getState = function() { 213 remoting.FallbackSignalStrategy.prototype.getState = function() {
222 return (this.externalState_ === null) 214 return (this.externalState_ === null)
223 ? remoting.SignalStrategy.State.NOT_CONNECTED 215 ? remoting.SignalStrategy.State.NOT_CONNECTED
224 : this.externalState_; 216 : this.externalState_;
225 }; 217 };
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 * @param {remoting.SignalStrategy} strategy 376 * @param {remoting.SignalStrategy} strategy
385 * @param {remoting.FallbackSignalStrategy.Progress} progress 377 * @param {remoting.FallbackSignalStrategy.Progress} progress
386 * @private 378 * @private
387 */ 379 */
388 remoting.FallbackSignalStrategy.prototype.updateProgress_ = function( 380 remoting.FallbackSignalStrategy.prototype.updateProgress_ = function(
389 strategy, progress) { 381 strategy, progress) {
390 console.log('FallbackSignalStrategy progress: ' + strategy.getType() + ' ' + 382 console.log('FallbackSignalStrategy progress: ' + strategy.getType() + ' ' +
391 progress); 383 progress);
392 this.connectionSetupResults_.push({ 384 this.connectionSetupResults_.push({
393 'strategyType': strategy.getType(), 385 'strategyType': strategy.getType(),
394 'progress': progress, 386 'progress': progress
395 'elapsed': new Date().getTime() - this.startTime_
396 }); 387 });
397 if (this.logToServer_) { 388 if (this.logToServer_) {
398 this.sendConnectionSetupResultsInternal_(); 389 this.sendConnectionSetupResultsInternal_();
399 } 390 }
400 }; 391 };
OLDNEW
« no previous file with comments | « no previous file | remoting/webapp/crd/js/log_to_server.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698