Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 this._decoration._messageBucket = this; | 568 this._decoration._messageBucket = this; |
| 569 this._wave = this._decoration.createChild('div', 'text-editor-line-decoratio n-wave'); | 569 this._wave = this._decoration.createChild('div', 'text-editor-line-decoratio n-wave'); |
| 570 this._icon = this._wave.createChild('label', 'text-editor-line-decoration-ic on', 'dt-icon-label'); | 570 this._icon = this._wave.createChild('label', 'text-editor-line-decoration-ic on', 'dt-icon-label'); |
| 571 this._hasDecoration = false; | 571 this._hasDecoration = false; |
| 572 | 572 |
| 573 this._messagesDescriptionElement = createElementWithClass('div', 'text-edito r-messages-description-container'); | 573 this._messagesDescriptionElement = createElementWithClass('div', 'text-edito r-messages-description-container'); |
| 574 /** @type {!Array.<!SourceFrame.UISourceCodeFrame.RowMessage>} */ | 574 /** @type {!Array.<!SourceFrame.UISourceCodeFrame.RowMessage>} */ |
| 575 this._messages = []; | 575 this._messages = []; |
| 576 | 576 |
| 577 this._level = null; | 577 this._level = null; |
| 578 this._throttler = new Common.Throttler(50); | |
| 578 } | 579 } |
| 579 | 580 |
| 580 /** | 581 /** |
| 581 * @param {number} lineNumber | 582 * @param {number} lineNumber |
| 582 * @param {number} columnNumber | 583 * @param {number} columnNumber |
| 583 */ | 584 */ |
| 584 _updateWavePosition(lineNumber, columnNumber) { | 585 _updateWavePosition(lineNumber, columnNumber) { |
| 585 lineNumber = Math.min(lineNumber, this.textEditor.linesCount - 1); | 586 lineNumber = Math.min(lineNumber, this.textEditor.linesCount - 1); |
| 586 var lineText = this.textEditor.line(lineNumber); | 587 var lineText = this.textEditor.line(lineNumber); |
| 587 columnNumber = Math.min(columnNumber, lineText.length); | 588 columnNumber = Math.min(columnNumber, lineText.length); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 620 * @return {number} | 621 * @return {number} |
| 621 */ | 622 */ |
| 622 uniqueMessagesCount() { | 623 uniqueMessagesCount() { |
| 623 return this._messages.length; | 624 return this._messages.length; |
| 624 } | 625 } |
| 625 | 626 |
| 626 /** | 627 /** |
| 627 * @param {!Workspace.UISourceCode.Message} message | 628 * @param {!Workspace.UISourceCode.Message} message |
| 628 */ | 629 */ |
| 629 addMessage(message) { | 630 addMessage(message) { |
| 630 for (var i = 0; i < this._messages.length; ++i) { | 631 for (var i = 0; i < this._messages.length; ++i) { |
|
lushnikov
2017/04/19 20:41:28
isn't this part the one which hurts us most? This
luoe
2017/04/20 23:43:59
Unfortunately we cannot take advantage of somethin
| |
| 631 var rowMessage = this._messages[i]; | 632 var rowMessage = this._messages[i]; |
| 632 if (rowMessage.message().isEqual(message)) { | 633 if (rowMessage.message().isEqual(message)) { |
| 633 rowMessage.setRepeatCount(rowMessage.repeatCount() + 1); | 634 rowMessage.setRepeatCount(rowMessage.repeatCount() + 1); |
| 634 return; | 635 return; |
| 635 } | 636 } |
| 636 } | 637 } |
| 637 | 638 |
| 638 var rowMessage = new SourceFrame.UISourceCodeFrame.RowMessage(message); | 639 var rowMessage = new SourceFrame.UISourceCodeFrame.RowMessage(message); |
| 639 this._messages.push(rowMessage); | 640 this._messages.push(rowMessage); |
| 640 this._updateDecoration(); | 641 this._throttler.schedule(() => { |
| 642 this._updateDecoration(); | |
| 643 return Promise.resolve(); | |
| 644 }); | |
| 641 } | 645 } |
| 642 | 646 |
| 643 /** | 647 /** |
| 644 * @param {!Workspace.UISourceCode.Message} message | 648 * @param {!Workspace.UISourceCode.Message} message |
| 645 */ | 649 */ |
| 646 removeMessage(message) { | 650 removeMessage(message) { |
| 647 for (var i = 0; i < this._messages.length; ++i) { | 651 for (var i = 0; i < this._messages.length; ++i) { |
| 648 var rowMessage = this._messages[i]; | 652 var rowMessage = this._messages[i]; |
| 649 if (!rowMessage.message().isEqual(message)) | 653 if (!rowMessage.message().isEqual(message)) |
| 650 continue; | 654 continue; |
| 651 rowMessage.setRepeatCount(rowMessage.repeatCount() - 1); | 655 rowMessage.setRepeatCount(rowMessage.repeatCount() - 1); |
| 652 if (!rowMessage.repeatCount()) | 656 if (!rowMessage.repeatCount()) |
| 653 this._messages.splice(i, 1); | 657 this._messages.splice(i, 1); |
| 654 this._updateDecoration(); | 658 this._throttler.schedule(() => { |
| 659 this._updateDecoration(); | |
| 660 return Promise.resolve(); | |
| 661 }); | |
| 655 return; | 662 return; |
| 656 } | 663 } |
| 657 } | 664 } |
| 658 | 665 |
| 659 _updateDecoration() { | 666 _updateDecoration() { |
| 660 if (!this._sourceFrame.isEditorShowing()) | 667 if (!this._sourceFrame.isEditorShowing()) |
| 661 return; | 668 return; |
| 662 if (!this._messages.length) | 669 if (!this._messages.length) |
| 663 return; | 670 return; |
| 664 var position = this._lineHandle.resolve(); | 671 var position = this._lineHandle.resolve(); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 695 | 702 |
| 696 /** | 703 /** |
| 697 * @param {!Workspace.UISourceCode.Message} a | 704 * @param {!Workspace.UISourceCode.Message} a |
| 698 * @param {!Workspace.UISourceCode.Message} b | 705 * @param {!Workspace.UISourceCode.Message} b |
| 699 * @return {number} | 706 * @return {number} |
| 700 */ | 707 */ |
| 701 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) { | 708 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) { |
| 702 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] - | 709 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] - |
| 703 Workspace.UISourceCode.Message._messageLevelPriority[b.level()]; | 710 Workspace.UISourceCode.Message._messageLevelPriority[b.level()]; |
| 704 }; | 711 }; |
| OLD | NEW |