Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(844)

Unified Diff: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js

Issue 1811773002: DevTools: Use live location for line level profile presentation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5e78d0a3681a5a12860ad832a3ae49dff3c69d0f..e37d5c28ec10e6fc2ed5fee553fb207cc1124e0e 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -52,7 +52,7 @@ WebInspector.UISourceCode = function(project, url, contentType)
this._requestContentCallback = null;
/** @type {?Promise<?string>} */
this._requestContentPromise = null;
- /** @type {!Map<string, !Array<!WebInspector.UISourceCode.LineMarker>>} */
+ /** @type {!Map<string, !Map<number, !WebInspector.UISourceCode.LineMarker>>} */
this._lineDecorations = new Map();
/** @type {!Array.<!WebInspector.Revision>} */
@@ -657,27 +657,49 @@ WebInspector.UISourceCode.prototype = {
{
var markers = this._lineDecorations.get(type);
if (!markers) {
- markers = [];
+ markers = new Map();
this._lineDecorations.set(type, markers);
}
var marker = new WebInspector.UISourceCode.LineMarker(lineNumber, type, data);
- markers.push(marker);
+ markers.set(lineNumber, marker);
this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationAdded, marker);
},
/**
+ * @param {number} lineNumber
+ * @param {string} type
+ */
+ removeLineDecoration: function(lineNumber, type)
+ {
+ var markers = this._lineDecorations.get(type);
+ 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);
+ },
+
+ /**
* @param {string} type
*/
removeAllLineDecorations: function(type)
{
- var markers = this._lineDecorations.get(type) || [];
- markers.forEach(this.dispatchEventToListeners.bind(this, WebInspector.UISourceCode.Events.LineDecorationRemoved));
+ var markers = this._lineDecorations.get(type);
+ if (!markers)
+ return;
this._lineDecorations.delete(type);
+ markers.forEach(marker => {
+ this.dispatchEventToListeners(WebInspector.UISourceCode.Events.LineDecorationRemoved, marker);
+ });
},
/**
* @param {string} type
- * @return {?Array<!WebInspector.UISourceCode.LineMarker>}
+ * @return {?Map<number, !WebInspector.UISourceCode.LineMarker>}
*/
lineDecorations: function(type)
{
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698