| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 var pathComponents = WebInspector.ParsedURL.splitURLIntoPathComponents(url); | 45 var pathComponents = WebInspector.ParsedURL.splitURLIntoPathComponents(url); |
| 46 this._origin = pathComponents[0]; | 46 this._origin = pathComponents[0]; |
| 47 this._parentURL = pathComponents.slice(0, -1).join("/"); | 47 this._parentURL = pathComponents.slice(0, -1).join("/"); |
| 48 this._name = pathComponents[pathComponents.length - 1]; | 48 this._name = pathComponents[pathComponents.length - 1]; |
| 49 | 49 |
| 50 this._contentType = contentType; | 50 this._contentType = contentType; |
| 51 /** @type {?function(?string)} */ | 51 /** @type {?function(?string)} */ |
| 52 this._requestContentCallback = null; | 52 this._requestContentCallback = null; |
| 53 /** @type {?Promise<?string>} */ | 53 /** @type {?Promise<?string>} */ |
| 54 this._requestContentPromise = null; | 54 this._requestContentPromise = null; |
| 55 /** @type {!Map<string, !Array<!WebInspector.UISourceCode.LineMarker>>} */ | 55 /** @type {!Map<string, !Map<number, !WebInspector.UISourceCode.LineMarker>>
} */ |
| 56 this._lineDecorations = new Map(); | 56 this._lineDecorations = new Map(); |
| 57 | 57 |
| 58 /** @type {!Array.<!WebInspector.Revision>} */ | 58 /** @type {!Array.<!WebInspector.Revision>} */ |
| 59 this.history = []; | 59 this.history = []; |
| 60 this._hasUnsavedCommittedChanges = false; | 60 this._hasUnsavedCommittedChanges = false; |
| 61 | 61 |
| 62 /** @type {!Array<!WebInspector.UISourceCode.Message>} */ | 62 /** @type {!Array<!WebInspector.UISourceCode.Message>} */ |
| 63 this._messages = []; | 63 this._messages = []; |
| 64 } | 64 } |
| 65 | 65 |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 650 |
| 651 /** | 651 /** |
| 652 * @param {number} lineNumber | 652 * @param {number} lineNumber |
| 653 * @param {string} type | 653 * @param {string} type |
| 654 * @param {?} data | 654 * @param {?} data |
| 655 */ | 655 */ |
| 656 addLineDecoration: function(lineNumber, type, data) | 656 addLineDecoration: function(lineNumber, type, data) |
| 657 { | 657 { |
| 658 var markers = this._lineDecorations.get(type); | 658 var markers = this._lineDecorations.get(type); |
| 659 if (!markers) { | 659 if (!markers) { |
| 660 markers = []; | 660 markers = new Map(); |
| 661 this._lineDecorations.set(type, markers); | 661 this._lineDecorations.set(type, markers); |
| 662 } | 662 } |
| 663 var marker = new WebInspector.UISourceCode.LineMarker(lineNumber, type,
data); | 663 var marker = new WebInspector.UISourceCode.LineMarker(lineNumber, type,
data); |
| 664 markers.push(marker); | 664 markers.set(lineNumber, marker); |
| 665 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecor
ationAdded, marker); | 665 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecor
ationAdded, marker); |
| 666 }, | 666 }, |
| 667 | 667 |
| 668 /** | 668 /** |
| 669 * @param {number} lineNumber |
| 670 * @param {string} type |
| 671 */ |
| 672 removeLineDecoration: function(lineNumber, type) |
| 673 { |
| 674 var markers = this._lineDecorations.get(type); |
| 675 if (!markers) |
| 676 return; |
| 677 var marker = markers.get(lineNumber); |
| 678 if (!marker) |
| 679 return; |
| 680 markers.delete(lineNumber); |
| 681 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecor
ationRemoved, marker); |
| 682 if (!markers.size) |
| 683 this._lineDecorations.delete(type); |
| 684 }, |
| 685 |
| 686 /** |
| 669 * @param {string} type | 687 * @param {string} type |
| 670 */ | 688 */ |
| 671 removeAllLineDecorations: function(type) | 689 removeAllLineDecorations: function(type) |
| 672 { | 690 { |
| 673 var markers = this._lineDecorations.get(type) || []; | 691 var markers = this._lineDecorations.get(type); |
| 674 markers.forEach(this.dispatchEventToListeners.bind(this, WebInspector.UI
SourceCode.Events.LineDecorationRemoved)); | 692 if (!markers) |
| 693 return; |
| 675 this._lineDecorations.delete(type); | 694 this._lineDecorations.delete(type); |
| 695 markers.forEach(marker => { |
| 696 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineD
ecorationRemoved, marker); |
| 697 }); |
| 676 }, | 698 }, |
| 677 | 699 |
| 678 /** | 700 /** |
| 679 * @param {string} type | 701 * @param {string} type |
| 680 * @return {?Array<!WebInspector.UISourceCode.LineMarker>} | 702 * @return {?Map<number, !WebInspector.UISourceCode.LineMarker>} |
| 681 */ | 703 */ |
| 682 lineDecorations: function(type) | 704 lineDecorations: function(type) |
| 683 { | 705 { |
| 684 return this._lineDecorations.get(type) || null; | 706 return this._lineDecorations.get(type) || null; |
| 685 }, | 707 }, |
| 686 | 708 |
| 687 __proto__: WebInspector.Object.prototype | 709 __proto__: WebInspector.Object.prototype |
| 688 } | 710 } |
| 689 | 711 |
| 690 /** | 712 /** |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 }, | 966 }, |
| 945 | 967 |
| 946 /** | 968 /** |
| 947 * @return {*} | 969 * @return {*} |
| 948 */ | 970 */ |
| 949 data: function() | 971 data: function() |
| 950 { | 972 { |
| 951 return this._data; | 973 return this._data; |
| 952 } | 974 } |
| 953 } | 975 } |
| OLD | NEW |