Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 555 this._messages = []; | 555 this._messages = []; |
| 556 this._messages.push(message); | 556 this._messages.push(message); |
| 557 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageAdded, me ssage); | 557 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageAdded, me ssage); |
| 558 return message; | 558 return message; |
| 559 } | 559 } |
| 560 | 560 |
| 561 /** | 561 /** |
| 562 * @param {!Workspace.UISourceCode.Message} message | 562 * @param {!Workspace.UISourceCode.Message} message |
| 563 */ | 563 */ |
| 564 removeMessage(message) { | 564 removeMessage(message) { |
| 565 if (this._messages && this._messages.remove(message)) | 565 if (this._messages && this._messages.remove(message)) |
|
lushnikov
2017/03/17 01:29:05
let's rather have this._messages a set
luoe
2017/03/17 18:33:00
Done.
| |
| 566 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); | 566 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); |
| 567 } | 567 } |
| 568 | 568 |
| 569 /** | |
| 570 * @param {!Set<!Workspace.UISourceCode.Message>} messagesToRemove | |
| 571 */ | |
| 572 removeMessages(messagesToRemove) { | |
| 573 var remainingMessages = this._messages.filter(message => { | |
| 574 var keep = !messagesToRemove.has(message); | |
| 575 if (!keep) | |
| 576 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemov ed, message); | |
| 577 return keep; | |
| 578 }); | |
| 579 this._messages = remainingMessages; | |
| 580 } | |
| 581 | |
| 569 _removeAllMessages() { | 582 _removeAllMessages() { |
| 570 if (!this._messages) | 583 if (!this._messages) |
| 571 return; | 584 return; |
| 572 for (var message of this._messages) | 585 for (var message of this._messages) |
| 573 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); | 586 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); |
| 574 this._messages = null; | 587 this._messages = null; |
| 575 } | 588 } |
| 576 | 589 |
| 577 /** | 590 /** |
| 578 * @param {number} lineNumber | 591 * @param {number} lineNumber |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 920 Workspace.UISourceCodeMetadata = class { | 933 Workspace.UISourceCodeMetadata = class { |
| 921 /** | 934 /** |
| 922 * @param {?Date} modificationTime | 935 * @param {?Date} modificationTime |
| 923 * @param {?number} contentSize | 936 * @param {?number} contentSize |
| 924 */ | 937 */ |
| 925 constructor(modificationTime, contentSize) { | 938 constructor(modificationTime, contentSize) { |
| 926 this.modificationTime = modificationTime; | 939 this.modificationTime = modificationTime; |
| 927 this.contentSize = contentSize; | 940 this.contentSize = contentSize; |
| 928 } | 941 } |
| 929 }; | 942 }; |
| OLD | NEW |