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

Unified Diff: third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js

Issue 2781593003: [Devtools] DataGrid & ViewportDataGrid now should resetNode for children (Closed)
Patch Set: [Devtools] DataGrid & ViewportDataGrid now should resetNode for children 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
Index: third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js
diff --git a/third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js b/third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js
index 4b264c5b72b136cec2427b9192deacf7dd891f13..0e2757475c96ab5f8796d0c62e84be6984b625e1 100644
--- a/third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js
+++ b/third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js
@@ -1596,6 +1596,26 @@ DataGrid.DataGridNode = class extends Common.Object {
}
/**
+ * @param {boolean=} onlyCaches
+ */
+ resetNode(onlyCaches) {
+ // @TODO(allada) This is a hack to make sure ViewportDataGrid can clean up these caches. Try Not To Use.
+ delete this._depth;
+ delete this._revealed;
+ if (onlyCaches)
+ return;
+ if (this.previousSibling)
+ this.previousSibling.nextSibling = this.nextSibling;
+ if (this.nextSibling)
+ this.nextSibling.previousSibling = this.previousSibling;
+ this.dataGrid = null;
+ this.parent = null;
+ this.nextSibling = null;
+ this.previousSibling = null;
+ this._attached = false;
+ }
+
+ /**
* @param {!NODE_TYPE} child
* @param {number} index
*/
@@ -1621,16 +1641,12 @@ DataGrid.DataGridNode = class extends Common.Object {
child.dataGrid = this.dataGrid;
child.recalculateSiblings(index);
- child._depth = undefined;
dgozman 2017/03/27 21:15:23 Who does this now?
allada 2017/03/27 21:55:04 resetNode() "delete this._depth;"
- child._revealed = undefined;
- child._attached = false;
child._shouldRefreshChildren = true;
var current = child.children[0];
while (current) {
+ current.resetNode(true);
current.dataGrid = this.dataGrid;
- current._depth = undefined;
- current._revealed = undefined;
current._attached = false;
dgozman 2017/03/27 22:47:01 Don't need this.
allada 2017/03/27 23:18:24 In this case we do need it because we don't know i
current._shouldRefreshChildren = true;
current = current.traverseNextNode(false, child, true);
@@ -1658,20 +1674,11 @@ DataGrid.DataGridNode = class extends Common.Object {
if (this.dataGrid)
this.dataGrid.updateSelectionBeforeRemoval(child, false);
- child._detach();
+ child._detach();
+ child.resetNode();
this.children.remove(child, true);
- if (child.previousSibling)
- child.previousSibling.nextSibling = child.nextSibling;
- if (child.nextSibling)
- child.nextSibling.previousSibling = child.previousSibling;
-
- child.dataGrid = null;
- child.parent = null;
- child.nextSibling = null;
- child.previousSibling = null;
-
if (this.children.length <= 0)
this.setHasChildren(false);
}
@@ -1682,10 +1689,7 @@ DataGrid.DataGridNode = class extends Common.Object {
for (var i = 0; i < this.children.length; ++i) {
var child = this.children[i];
child._detach();
- child.dataGrid = null;
- child.parent = null;
- child.nextSibling = null;
- child.previousSibling = null;
+ child.resetNode();
}
this.children = [];

Powered by Google App Engine
This is Rietveld 408576698