| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | |
| 5 /** @interface */ | 4 /** @interface */ |
| 6 WebInspector.LiveLocation = function() {}; | 5 WebInspector.LiveLocation = function() {}; |
| 7 | 6 |
| 8 WebInspector.LiveLocation.prototype = { | 7 WebInspector.LiveLocation.prototype = { |
| 9 update: function() {}, | 8 update: function() {}, |
| 10 | 9 |
| 11 /** | 10 /** |
| 12 * @return {?WebInspector.UILocation} | 11 * @return {?WebInspector.UILocation} |
| 13 */ | 12 */ |
| 14 uiLocation: function() {}, | 13 uiLocation: function() {}, |
| 15 | 14 |
| 16 dispose: function() {}, | 15 dispose: function() {}, |
| 17 | 16 |
| 18 /** | 17 /** |
| 19 * @return {boolean} | 18 * @return {boolean} |
| 20 */ | 19 */ |
| 21 isBlackboxed: function() {} | 20 isBlackboxed: function() {} |
| 22 }; | 21 }; |
| 23 | 22 |
| 24 /** | 23 /** |
| 25 * @constructor | |
| 26 * @implements {WebInspector.LiveLocation} | 24 * @implements {WebInspector.LiveLocation} |
| 27 * @param {function(!WebInspector.LiveLocation)} updateDelegate | 25 * @unrestricted |
| 28 * @param {!WebInspector.LiveLocationPool} locationPool | |
| 29 */ | 26 */ |
| 30 WebInspector.LiveLocationWithPool = function(updateDelegate, locationPool) | 27 WebInspector.LiveLocationWithPool = class { |
| 31 { | 28 /** |
| 29 * @param {function(!WebInspector.LiveLocation)} updateDelegate |
| 30 * @param {!WebInspector.LiveLocationPool} locationPool |
| 31 */ |
| 32 constructor(updateDelegate, locationPool) { |
| 32 this._updateDelegate = updateDelegate; | 33 this._updateDelegate = updateDelegate; |
| 33 this._locationPool = locationPool; | 34 this._locationPool = locationPool; |
| 34 this._locationPool._add(this); | 35 this._locationPool._add(this); |
| 35 }; | 36 } |
| 36 | 37 |
| 37 WebInspector.LiveLocationWithPool.prototype = { | 38 /** |
| 38 /** | 39 * @override |
| 39 * @override | 40 */ |
| 40 */ | 41 update() { |
| 41 update: function() | 42 this._updateDelegate(this); |
| 42 { | 43 } |
| 43 this._updateDelegate(this); | |
| 44 }, | |
| 45 | 44 |
| 46 /** | 45 /** |
| 47 * @override | 46 * @override |
| 48 * @return {?WebInspector.UILocation} | 47 * @return {?WebInspector.UILocation} |
| 49 */ | 48 */ |
| 50 uiLocation: function() | 49 uiLocation() { |
| 51 { | 50 throw 'Not implemented'; |
| 52 throw "Not implemented"; | 51 } |
| 53 }, | |
| 54 | 52 |
| 55 /** | 53 /** |
| 56 * @override | 54 * @override |
| 57 */ | 55 */ |
| 58 dispose: function() | 56 dispose() { |
| 59 { | 57 this._locationPool._delete(this); |
| 60 this._locationPool._delete(this); | 58 this._updateDelegate = null; |
| 61 this._updateDelegate = null; | 59 } |
| 62 }, | |
| 63 | 60 |
| 64 /** | 61 /** |
| 65 * @override | 62 * @override |
| 66 * @return {boolean} | 63 * @return {boolean} |
| 67 */ | 64 */ |
| 68 isBlackboxed: function() | 65 isBlackboxed() { |
| 69 { | 66 throw 'Not implemented'; |
| 70 throw "Not implemented"; | 67 } |
| 71 } | |
| 72 }; | 68 }; |
| 73 | 69 |
| 74 /** | 70 /** |
| 75 * @constructor | 71 * @unrestricted |
| 76 */ | 72 */ |
| 77 WebInspector.LiveLocationPool = function() | 73 WebInspector.LiveLocationPool = class { |
| 78 { | 74 constructor() { |
| 79 this._locations = new Set(); | 75 this._locations = new Set(); |
| 76 } |
| 77 |
| 78 /** |
| 79 * @param {!WebInspector.LiveLocation} location |
| 80 */ |
| 81 _add(location) { |
| 82 this._locations.add(location); |
| 83 } |
| 84 |
| 85 /** |
| 86 * @param {!WebInspector.LiveLocation} location |
| 87 */ |
| 88 _delete(location) { |
| 89 this._locations.delete(location); |
| 90 } |
| 91 |
| 92 disposeAll() { |
| 93 for (var location of this._locations) |
| 94 location.dispose(); |
| 95 } |
| 80 }; | 96 }; |
| 81 | |
| 82 WebInspector.LiveLocationPool.prototype = { | |
| 83 /** | |
| 84 * @param {!WebInspector.LiveLocation} location | |
| 85 */ | |
| 86 _add: function(location) | |
| 87 { | |
| 88 this._locations.add(location); | |
| 89 }, | |
| 90 | |
| 91 /** | |
| 92 * @param {!WebInspector.LiveLocation} location | |
| 93 */ | |
| 94 _delete: function(location) | |
| 95 { | |
| 96 this._locations.delete(location); | |
| 97 }, | |
| 98 | |
| 99 disposeAll: function() | |
| 100 { | |
| 101 for (var location of this._locations) | |
| 102 location.dispose(); | |
| 103 } | |
| 104 }; | |
| OLD | NEW |