Chromium Code Reviews| 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 e535581587b9244229274af30104a06f603a2453..6b3582e548ff4466ad145f1ee5c570594d089491 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js |
| @@ -52,6 +52,8 @@ WebInspector.UISourceCode = function(project, url, contentType) |
| this._requestContentCallback = null; |
| /** @type {?Promise<?string>} */ |
| this._requestContentPromise = null; |
| + /** @type {!Map<string, !Array<!WebInspector.UISourceCode.LineMarker>>} */ |
| + this._lineMarkers = new Map(); |
| /** @type {!Array.<!WebInspector.Revision>} */ |
| this.history = []; |
| @@ -71,6 +73,8 @@ WebInspector.UISourceCode.Events = { |
| SourceMappingChanged: "SourceMappingChanged", |
| MessageAdded: "MessageAdded", |
| MessageRemoved: "MessageRemoved", |
| + LineMarkerAdded: "LineMarkerAdded", |
| + LineMarkerRemoved: "LineMarkerRemoved" |
| } |
| WebInspector.UISourceCode.prototype = { |
| @@ -644,6 +648,44 @@ WebInspector.UISourceCode.prototype = { |
| this.dispatchEventToListeners(WebInspector.UISourceCode.Events.MessageRemoved, message); |
| }, |
| + /** |
| + * @param {number} lineNumber |
| + * @param {string} type |
| + * @param {?} data |
| + */ |
| + addLineMarker: function(lineNumber, type, data) |
| + { |
| + var markers = this._lineMarkers.get(type); |
| + if (!markers) { |
| + markers = []; |
| + this._lineMarkers.set(type, markers); |
| + } |
| + var marker = new WebInspector.UISourceCode.LineMarker(lineNumber, type, data); |
| + markers.push(marker); |
| + this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineMarkerAdded, marker); |
| + }, |
| + |
| + /** |
| + * @param {string} type |
| + */ |
| + removeAllLineMarkers: function(type) |
| + { |
| + var markers = this._lineMarkers.get(type) || []; |
| + markers.forEach(this.dispatchEventToListeners.bind(this, WebInspector.UISourceCode.Events.LineMarkerRemoved)); |
| + this._lineMarkers.delete(type); |
| + }, |
| + |
| + /** |
| + * @return {!Array<!WebInspector.UISourceCode.LineMarker>} |
| + */ |
| + lineMarkers: function() |
|
pfeldman
2016/03/03 02:38:42
Lets return them by type - that's the way decorato
alph
2016/03/05 00:37:08
Done.
|
| + { |
| + var result = []; |
| + for (var markers of this._lineMarkers.values()) |
| + result = result.concat(markers); |
| + return result; |
| + }, |
| + |
| __proto__: WebInspector.Object.prototype |
| } |
| @@ -837,7 +879,8 @@ WebInspector.UISourceCode.Message.prototype = { |
| /** |
| * @return {!WebInspector.TextRange} |
| */ |
| - range: function() { |
| + range: function() |
| + { |
| return this._range; |
| }, |
| @@ -871,3 +914,42 @@ WebInspector.UISourceCode.Message.prototype = { |
| this._uiSourceCode.removeMessage(this); |
| } |
| } |
| + |
| +/** |
| + * @constructor |
| + * @param {number} line |
| + * @param {string} type |
| + * @param {?} data |
| + */ |
| +WebInspector.UISourceCode.LineMarker = function(line, type, data) |
| +{ |
| + this._line = line; |
| + this._type = type; |
| + this._data = data; |
| +} |
| + |
| +WebInspector.UISourceCode.LineMarker.prototype = { |
| + /** |
| + * @return {number} |
| + */ |
| + line: function() |
| + { |
| + return this._line; |
| + }, |
| + |
| + /** |
| + * @return {string} |
| + */ |
| + type: function() |
| + { |
| + return this._type; |
| + }, |
| + |
| + /** |
| + * @return {?} |
|
pfeldman
2016/03/03 02:38:42
*
alph
2016/03/05 00:37:08
Done.
|
| + */ |
| + data: function() |
| + { |
| + return this._data; |
| + } |
| +} |