| Index: mojo/public/bindings/js/connection.js
|
| diff --git a/tools/memory_inspector/memory_inspector/frontends/www_content/js/timers.js b/mojo/public/bindings/js/connection.js
|
| similarity index 20%
|
| copy from tools/memory_inspector/memory_inspector/frontends/www_content/js/timers.js
|
| copy to mojo/public/bindings/js/connection.js
|
| index b26955780033c94b881d3416215a3fd5d565cf6b..96c7419decb9771ac8f34f1af95bcc906b346086 100644
|
| --- a/tools/memory_inspector/memory_inspector/frontends/www_content/js/timers.js
|
| +++ b/mojo/public/bindings/js/connection.js
|
| @@ -2,37 +2,29 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -timers = new (function() {
|
| -
|
| -this.timers_ = {};
|
| -
|
| -this.start = function(name, callback, intervalSeconds) {
|
| - this.stop(name);
|
| -
|
| - var timerId = setInterval(callback, intervalSeconds * 1000);
|
| +define("mojo/public/bindings/js/connection", [
|
| + "mojo/public/bindings/js/router",
|
| +], function(router) {
|
| +
|
| + function Connection(handle, localFactory, remoteFactory) {
|
| + this.router_ = new router.Router(handle);
|
| + this.remote = new remoteFactory(this.router_);
|
| + this.local = new localFactory(this.remote);
|
| + this.router_.setIncomingReceiver(this.local);
|
| + }
|
|
|
| - this.timers_[name] = {
|
| - name: name,
|
| - callback: callback,
|
| - timerId: timerId,
|
| - intervalSeconds: intervalSeconds
|
| + Connection.prototype.close = function() {
|
| + this.router_.close();
|
| + this.router_ = null;
|
| + this.local = null;
|
| + this.remote = null;
|
| };
|
|
|
| - callback();
|
| -};
|
| -
|
| -this.stop = function(name) {
|
| - if (name in this.timers_) {
|
| - clearInterval(this.timers_[name].timerId);
|
| - delete this.timers_[name];
|
| - }
|
| -};
|
| -
|
| -this.stopAll = function() {
|
| - for (var name in this.timers_) {
|
| - clearInterval(this.timers_[name].timerId);
|
| - }
|
| - this.timers_ = {};
|
| -};
|
| + Connection.prototype.encounteredError = function() {
|
| + return this.router_.encounteredError();
|
| + };
|
|
|
| -})();
|
| + var exports = {};
|
| + exports.Connection = Connection;
|
| + return exports;
|
| +});
|
|
|