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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js

Issue 1748993002: DevTools: Initial implementation of line-level CPU profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaseline 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
Index: third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js
index df56d748899a2be33b825c6110a4fb8679790baa..f0f6561272c2ee02fb95a1c587fefb0c1f9835b5 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js
@@ -41,6 +41,8 @@ WebInspector.UISourceCodeFrame = function(uiSourceCode)
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyCommitted, this);
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.MessageAdded, this._onMessageAdded, this);
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.MessageRemoved, this._onMessageRemoved, this);
+ this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.LineMarkerAdded, this._onLineMarkerAdded, this);
+ this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.LineMarkerRemoved, this._onLineMarkerRemoved, this);
this._updateStyle();
this._errorPopoverHelper = new WebInspector.PopoverHelper(this.element, this._getErrorAnchor.bind(this), this._showErrorPopover.bind(this));
@@ -118,6 +120,7 @@ WebInspector.UISourceCodeFrame.prototype = {
WebInspector.SourceFrame.prototype.onTextEditorContentLoaded.call(this);
for (var message of this._uiSourceCode.messages())
this._addMessageToSource(message);
+ this._populateLineMarkers();
pfeldman 2016/03/07 19:57:50 _decorateLineMarkers?
alph 2016/03/08 00:57:43 Done.
},
/**
@@ -330,6 +333,40 @@ WebInspector.UISourceCodeFrame.prototype = {
}
},
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _onLineMarkerAdded: function(event)
+ {
+ var marker = /** @type {!WebInspector.UISourceCode.LineMarker} */ (event.data);
+ this._decorateLineMarker(marker);
pfeldman 2016/03/07 19:57:50 Didn't you want to throttle these in a single CM o
alph 2016/03/08 00:57:42 Done.
+ },
+
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _onLineMarkerRemoved: function(event)
+ {
+ var marker = /** @type {!WebInspector.UISourceCode.LineMarker} */ (event.data);
+ this._textEditor.setGutterMarker(marker.line(), marker.type(), null);
+ },
+
+ _populateLineMarkers: function()
+ {
+ for (var markers of this.uiSourceCode().lineMarkers().values())
+ markers.forEach(this._decorateLineMarker.bind(this));
+ },
+
+ _decorateLineMarker: function(marker)
pfeldman 2016/03/07 19:57:50 JSDocs are missing.
alph 2016/03/08 00:57:43 Done.
+ {
+ this._lineMarkerDecorator(marker.type()).then(decorator => this._textEditor.setGutterMarker(marker.line(), marker.type(), decorator.decorate(marker.data())));
+ },
+
+ _lineMarkerDecorator: function(type)
pfeldman 2016/03/07 19:57:50 ditto
alph 2016/03/08 00:57:42 Done.
+ {
+ return self.runtime.instancePromise("line-marker-decorator-" + type);
pfeldman 2016/03/07 19:57:50 Decorator should be named after interface it imple
alph 2016/03/08 00:57:42 Done.
+ },
+
__proto__: WebInspector.SourceFrame.prototype
}

Powered by Google App Engine
This is Rietveld 408576698