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

Unified Diff: remoting/webapp/app_remoting/js/app_remoting.js

Issue 1010053002: [Webapp Refactor] Implements remoting.ConnectionInfo. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/webapp/base/js/application.js » ('j') | remoting/webapp/crd/js/session_connector.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/app_remoting/js/app_remoting.js
diff --git a/remoting/webapp/app_remoting/js/app_remoting.js b/remoting/webapp/app_remoting/js/app_remoting.js
index 3d3b58566dc50bdee4b5e19897d15abb322564af..5ddd95c6d915438dccdd1e1d1d8831b6c81ba47c 100644
--- a/remoting/webapp/app_remoting/js/app_remoting.js
+++ b/remoting/webapp/app_remoting/js/app_remoting.js
@@ -30,8 +30,8 @@ remoting.AppRemoting = function(app) {
/** @private {remoting.WindowActivationMenu} */
this.windowActivationMenu_ = null;
- /** @private {number} */
- this.pingTimerId_ = 0;
+ /** @private {base.RepeatingTimer} */
garykac 2015/03/16 20:43:33 Nice!
+ this.pingTimer_ = null;
};
/**
@@ -216,10 +216,10 @@ remoting.AppRemoting.prototype.getDefaultRemapKeys = function() {
/**
* Called when a new session has been connected.
*
- * @param {remoting.ClientSession} clientSession
+ * @param {remoting.ConnectionInfo} connectionInfo
* @return {void} Nothing.
*/
-remoting.AppRemoting.prototype.handleConnected = function(clientSession) {
+remoting.AppRemoting.prototype.handleConnected = function(connectionInfo) {
remoting.identity.getUserInfo().then(
function(userInfo) {
remoting.clientSession.sendClientMessage(
@@ -227,13 +227,12 @@ remoting.AppRemoting.prototype.handleConnected = function(clientSession) {
JSON.stringify({fullName: userInfo.name}));
});
+ var clientSession = connectionInfo.session();
// Set up a ping at 10-second intervals to test the connection speed.
- function ping() {
+ this.pingTimer_ = new base.RepeatingTimer(function () {
var message = { timestamp: new Date().getTime() };
clientSession.sendClientMessage('pingRequest', JSON.stringify(message));
- };
- ping();
- this.pingTimerId_ = window.setInterval(ping, 10 * 1000);
+ }, 10 * 1000);
garykac 2015/03/16 20:43:33 Can we move this into a constant (with a descripti
kelvinp 2015/03/16 21:00:21 Done.
};
/**
@@ -243,7 +242,8 @@ remoting.AppRemoting.prototype.handleConnected = function(clientSession) {
*/
remoting.AppRemoting.prototype.handleDisconnected = function() {
// Cancel the ping when the connection closes.
- window.clearInterval(this.pingTimerId_);
+ base.dispose(this.pingTimer_);
+ this.pingTimer_ = null;
chrome.app.window.current().close();
};
« no previous file with comments | « no previous file | remoting/webapp/base/js/application.js » ('j') | remoting/webapp/crd/js/session_connector.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698