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

Side by Side 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: add decorators 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 23 matching lines...) Expand all
34 WebInspector.UISourceCodeFrame = function(uiSourceCode) 34 WebInspector.UISourceCodeFrame = function(uiSourceCode)
35 { 35 {
36 this._uiSourceCode = uiSourceCode; 36 this._uiSourceCode = uiSourceCode;
37 WebInspector.SourceFrame.call(this, this._uiSourceCode); 37 WebInspector.SourceFrame.call(this, this._uiSourceCode);
38 this.textEditor.setAutocompleteDelegate(new WebInspector.SimpleAutocompleteD elegate()); 38 this.textEditor.setAutocompleteDelegate(new WebInspector.SimpleAutocompleteD elegate());
39 this._rowMessageBuckets = {}; 39 this._rowMessageBuckets = {};
40 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._onWorkingCopyChanged, this); 40 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._onWorkingCopyChanged, this);
41 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyCommitted, this._onWorkingCopyCommitted, this); 41 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyCommitted, this._onWorkingCopyCommitted, this);
42 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Added, this._onMessageAdded, this); 42 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Added, this._onMessageAdded, this);
43 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Removed, this._onMessageRemoved, this); 43 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Removed, this._onMessageRemoved, this);
44 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.LineMar kersChanged, this._updateMarkerDecorations, this);
44 this._updateStyle(); 45 this._updateStyle();
45 46
46 this._errorPopoverHelper = new WebInspector.PopoverHelper(this.element, this ._getErrorAnchor.bind(this), this._showErrorPopover.bind(this)); 47 this._errorPopoverHelper = new WebInspector.PopoverHelper(this.element, this ._getErrorAnchor.bind(this), this._showErrorPopover.bind(this));
47 this._errorPopoverHelper.setTimeout(100, 100); 48 this._errorPopoverHelper.setTimeout(100, 100);
48 } 49 }
49 50
50 WebInspector.UISourceCodeFrame.prototype = { 51 WebInspector.UISourceCodeFrame.prototype = {
51 /** 52 /**
52 * @return {!WebInspector.UISourceCode} 53 * @return {!WebInspector.UISourceCode}
53 */ 54 */
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 }, 112 },
112 113
113 /** 114 /**
114 * @override 115 * @override
115 */ 116 */
116 onTextEditorContentLoaded: function() 117 onTextEditorContentLoaded: function()
117 { 118 {
118 WebInspector.SourceFrame.prototype.onTextEditorContentLoaded.call(this); 119 WebInspector.SourceFrame.prototype.onTextEditorContentLoaded.call(this);
119 for (var message of this._uiSourceCode.messages()) 120 for (var message of this._uiSourceCode.messages())
120 this._addMessageToSource(message); 121 this._addMessageToSource(message);
122 this._updateMarkerDecorations();
121 }, 123 },
122 124
123 /** 125 /**
124 * @override 126 * @override
125 * @param {!WebInspector.TextRange} oldRange 127 * @param {!WebInspector.TextRange} oldRange
126 * @param {!WebInspector.TextRange} newRange 128 * @param {!WebInspector.TextRange} newRange
127 */ 129 */
128 onTextChanged: function(oldRange, newRange) 130 onTextChanged: function(oldRange, newRange)
129 { 131 {
130 WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, ne wRange); 132 WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, ne wRange);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 }, 325 },
324 326
325 _updateBucketDecorations: function() 327 _updateBucketDecorations: function()
326 { 328 {
327 for (var line in this._rowMessageBuckets) { 329 for (var line in this._rowMessageBuckets) {
328 var bucket = this._rowMessageBuckets[line]; 330 var bucket = this._rowMessageBuckets[line];
329 bucket._updateDecoration(); 331 bucket._updateDecoration();
330 } 332 }
331 }, 333 },
332 334
335 _updateMarkerDecorations: function()
336 {
337 this._textEditor.removeAllLineMarkers();
pfeldman 2016/03/02 19:48:59 Should we make this granular? then you would go o
alph 2016/03/03 02:02:52 Done.
338 var lineMarkers = this._uiSourceCode.lineMarkers();
339 if (!lineMarkers)
340 return;
341 for (var marker of lineMarkers) {
342 var lineNumber = marker.line();
343 var element = createElementWithClass("div", "text-editor-line-marker ");
344 element.textContent = marker.text();
345 element.style.backgroundColor = marker.color();
346 this._textEditor.addLineMarker(lineNumber, element);
347 }
348 },
349
333 __proto__: WebInspector.SourceFrame.prototype 350 __proto__: WebInspector.SourceFrame.prototype
334 } 351 }
335 352
336 WebInspector.UISourceCodeFrame._iconClassPerLevel = {}; 353 WebInspector.UISourceCodeFrame._iconClassPerLevel = {};
337 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "error-icon"; 354 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "error-icon";
338 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "warning-icon"; 355 WebInspector.UISourceCodeFrame._iconClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "warning-icon";
339 356
340 WebInspector.UISourceCodeFrame._lineClassPerLevel = {}; 357 WebInspector.UISourceCodeFrame._lineClassPerLevel = {};
341 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "text-editor-line-with-error"; 358 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Error] = "text-editor-line-with-error";
342 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "text-editor-line-with-warning"; 359 WebInspector.UISourceCodeFrame._lineClassPerLevel[WebInspector.UISourceCode.Mess age.Level.Warning] = "text-editor-line-with-warning";
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 564
548 /** 565 /**
549 * @param {!WebInspector.UISourceCode.Message} a 566 * @param {!WebInspector.UISourceCode.Message} a
550 * @param {!WebInspector.UISourceCode.Message} b 567 * @param {!WebInspector.UISourceCode.Message} b
551 * @return {number} 568 * @return {number}
552 */ 569 */
553 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b) 570 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b)
554 { 571 {
555 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] - WebInspector.UISourceCode.Message._messageLevelPriority[b.level()]; 572 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] - WebInspector.UISourceCode.Message._messageLevelPriority[b.level()];
556 } 573 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698