| Index: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
|
| index 466760c4472fb45a9438172a56c7032edbd560ae..a9c07be267063b0722cb284ac7f12e5ae1d835de 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
|
| @@ -60,8 +60,11 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
|
| this._requestContentCallback = null;
|
| /** @type {?Promise<?string>} */
|
| this._requestContentPromise = null;
|
| - /** @type {!Map<string, !Map<number, !WebInspector.UISourceCode.LineMarker>>} */
|
| - this._lineDecorations = new Map();
|
| +
|
| + /** @type {!Multimap<string, !WebInspector.UISourceCode.LineMarker>} */
|
| + this._typeDecorations = new Multimap();
|
| + /** @type {!Multimap<number, !WebInspector.UISourceCode.LineMarker>} */
|
| + this._lineDecorations = new Multimap();
|
|
|
| /** @type {!Array.<!WebInspector.Revision>} */
|
| this.history = [];
|
| @@ -606,13 +609,12 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
|
| * @param {?} data
|
| */
|
| addLineDecoration(lineNumber, type, data) {
|
| - var markers = this._lineDecorations.get(type);
|
| - if (!markers) {
|
| - markers = new Map();
|
| - this._lineDecorations.set(type, markers);
|
| - }
|
| +
|
| var marker = new WebInspector.UISourceCode.LineMarker(lineNumber, type, data);
|
| - markers.set(lineNumber, marker);
|
| +
|
| + this._typeDecorations.set(type, marker);
|
| + this._lineDecorations.set(lineNumber, marker);
|
| +
|
| this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationAdded, marker);
|
| }
|
|
|
| @@ -621,26 +623,32 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
|
| * @param {string} type
|
| */
|
| removeLineDecoration(lineNumber, type) {
|
| - var markers = this._lineDecorations.get(type);
|
| + var markers = this._lineDecorations.get(lineNumber);
|
| if (!markers)
|
| return;
|
| - var marker = markers.get(lineNumber);
|
| - if (!marker)
|
| - return;
|
| - markers.delete(lineNumber);
|
| - this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationRemoved, marker);
|
| - if (!markers.size)
|
| - this._lineDecorations.delete(type);
|
| +
|
| + for (var decoration of markers) {
|
| + if (decoration.type() === type) {
|
| +
|
| + this._typeDecorations.remove(type, decoration);
|
| +
|
| + this._lineDecorations.remove(lineNumber, decoration);
|
| + this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationRemoved, decoration);
|
| + }
|
| + }
|
| }
|
|
|
| /**
|
| * @param {string} type
|
| */
|
| removeAllLineDecorations(type) {
|
| - var markers = this._lineDecorations.get(type);
|
| + var markers = this._typeDecorations.get(type);
|
| if (!markers)
|
| return;
|
| - this._lineDecorations.delete(type);
|
| +
|
| + markers.forEach(marker => this._lineDecorations.remove(marker.line(), marker));
|
| + this._typeDecorations.removeAll(type);
|
| +
|
| markers.forEach(marker => {
|
| this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationRemoved, marker);
|
| });
|
| @@ -648,10 +656,10 @@ WebInspector.UISourceCode = class extends WebInspector.Object {
|
|
|
| /**
|
| * @param {string} type
|
| - * @return {?Map<number, !WebInspector.UISourceCode.LineMarker>}
|
| + * @return {?Set<!WebInspector.UISourceCode.LineMarker>}
|
| */
|
| lineDecorations(type) {
|
| - return this._lineDecorations.get(type) || null;
|
| + return this._typeDecorations.get(type) || null;
|
| }
|
| };
|
|
|
|
|