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

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

Issue 2752333002: DevTools: more efficiently dispose messages on console clear (Closed)
Patch Set: Set instead of array Created 3 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/source_frame/UISourceCodeFrame.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 4fa5b554791586c37976b94c5f63d1532deb9929..0a30bd5fe4732e51c2e81acb62015aede0bef832 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -62,7 +62,7 @@ Workspace.UISourceCode = class extends Common.Object {
this._decorations = null;
/** @type {?Array.<!Workspace.Revision>} */
this._history = null;
- /** @type {?Array<!Workspace.UISourceCode.Message>} */
+ /** @type {?Set<!Workspace.UISourceCode.Message>} */
this._messages = null;
this._contentLoaded = false;
/** @type {?string} */
@@ -525,10 +525,10 @@ Workspace.UISourceCode = class extends Common.Object {
}
/**
- * @return {!Array<!Workspace.UISourceCode.Message>}
+ * @return {!Set<!Workspace.UISourceCode.Message>}
*/
messages() {
- return this._messages ? this._messages.slice() : [];
+ return this._messages ? new Set(this._messages) : new Set();
}
/**
@@ -552,8 +552,8 @@ Workspace.UISourceCode = class extends Common.Object {
addMessage(level, text, range) {
var message = new Workspace.UISourceCode.Message(this, level, text, range);
if (!this._messages)
- this._messages = [];
- this._messages.push(message);
+ this._messages = new Set();
+ this._messages.add(message);
this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageAdded, message);
return message;
}
@@ -562,7 +562,7 @@ Workspace.UISourceCode = class extends Common.Object {
* @param {!Workspace.UISourceCode.Message} message
*/
removeMessage(message) {
- if (this._messages && this._messages.remove(message))
+ if (this._messages && this._messages.delete(message))
this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved, message);
}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/source_frame/UISourceCodeFrame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698