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

Unified Diff: remoting/webapp/crd/js/it2me_host_facade.js

Issue 895723006: Fix It2Me Host doesn't kill the native process after canceling a share (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: remoting/webapp/crd/js/it2me_host_facade.js
diff --git a/remoting/webapp/crd/js/it2me_host_facade.js b/remoting/webapp/crd/js/it2me_host_facade.js
index 621befb53caf332abc8487ee976f903d0a75d2cd..c33f8ebdf8872fcb02cb9c4c9b03508a538549ed 100644
--- a/remoting/webapp/crd/js/it2me_host_facade.js
+++ b/remoting/webapp/crd/js/it2me_host_facade.js
@@ -7,51 +7,39 @@
* Class to communicate with the It2me Host component via Native Messaging.
*/
-'use strict';
-
/** @suppress {duplicate} */
var remoting = remoting || {};
+(function() {
+
+'use strict';
+
/**
* @constructor
+ * @implements {base.Disposable}
*/
remoting.It2MeHostFacade = function() {
- /**
- * @type {number}
- * @private
- */
+ /** @private {number} */
this.nextId_ = 0;
- /**
- * @type {?chrome.runtime.Port}
- * @private
- */
+ /** @private {?chrome.runtime.Port} */
this.port_ = null;
- /**
- * @type {string}
- * @private
- */
+ /** @private {string} */
this.accessCode_ = '';
- /**
- * @type {number}
- * @private
- */
+ /** @private {number} */
this.accessCodeLifetime_ = 0;
- /**
- * @type {string}
- * @private
- */
+ /** @private {string} */
this.clientId_ = '';
- /**
- * @type {boolean}
- * @private
- */
+ /** @private {boolean} */
this.initialized_ = false;
+ /** @private {base.Disposables} */
+ this.eventHooks_ = null;
+
/**
* @type {?function():void}
* @private
@@ -85,6 +73,15 @@ remoting.It2MeHostFacade = function() {
this.onNatPolicyChanged_ = function() {};
};
+remoting.It2MeHostFacade.prototype.dispose = function() {
+ base.dispose(this.eventHooks_);
+ this.eventHooks_ = null;
+ if (this.port_) {
+ this.port_.disconnect();
+ this.port_ = null;
+ }
+};
+
/**
* Sets up connection to the Native Messaging host process and exchanges
* 'hello' messages. If Native Messaging is not supported or if the it2me
@@ -105,8 +102,11 @@ remoting.It2MeHostFacade.prototype.initialize =
try {
this.port_ = chrome.runtime.connectNative(
'com.google.chrome.remote_assistance');
- this.port_.onMessage.addListener(this.onIncomingMessage_.bind(this));
- this.port_.onDisconnect.addListener(this.onHostDisconnect_.bind(this));
+ this.eventHooks_ = new base.Disposables(
+ new base.ChromeEventHook(this.port_.onMessage,
+ this.onIncomingMessage_.bind(this)),
+ new base.ChromeEventHook(this.port_.onDisconnect,
+ this.onHostDisconnect_.bind(this)));
this.port_.postMessage({type: 'hello'});
} catch (/** @type {*} */ err) {
console.log('Native Messaging initialization failed: ', err);
@@ -328,4 +328,6 @@ remoting.It2MeHostFacade.prototype.onHostDisconnect_ = function() {
this.port_ = null;
this.onError_(remoting.Error.UNEXPECTED);
}
-}
+};
+
+})();
« remoting/webapp/crd/js/host_session.js ('K') | « remoting/webapp/crd/js/host_session.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698