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..9424ca14d8107358ca53f714da669ea65b0cf804 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,41 @@ 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) |
|
pfeldman
2016/03/07 19:57:50
removeLineMarkers (not all)
alph
2016/03/08 00:57:43
I don't need this API. Let's add it when we see th
|
| + { |
| + var markers = this._lineMarkers.get(type) || []; |
| + markers.forEach(this.dispatchEventToListeners.bind(this, WebInspector.UISourceCode.Events.LineMarkerRemoved)); |
| + this._lineMarkers.delete(type); |
| + }, |
| + |
| + /** |
| + * @return {!Map<string, !Array<!WebInspector.UISourceCode.LineMarker>>} |
| + */ |
| + lineMarkers: function() |
| + { |
| + return this._lineMarkers; |
| + }, |
| + |
| __proto__: WebInspector.Object.prototype |
| } |
| @@ -837,7 +876,8 @@ WebInspector.UISourceCode.Message.prototype = { |
| /** |
| * @return {!WebInspector.TextRange} |
| */ |
| - range: function() { |
| + range: function() |
| + { |
| return this._range; |
| }, |
| @@ -871,3 +911,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 {*} |
| + */ |
| + data: function() |
| + { |
| + return this._data; |
| + } |
| +} |