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

Unified Diff: Source/WebCore/inspector/front-end/DOMStorageItemsView.js

Issue 12700007: Revert 142161 "Web Inspector: CPU pegged when inspecting LocalSt..." (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 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: Source/WebCore/inspector/front-end/DOMStorageItemsView.js
===================================================================
--- Source/WebCore/inspector/front-end/DOMStorageItemsView.js (revision 145492)
+++ Source/WebCore/inspector/front-end/DOMStorageItemsView.js (working copy)
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008 Nokia Inc. All rights reserved.
- * Copyright (C) 2013 Samsung Electronics. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,12 +27,11 @@
* @constructor
* @extends {WebInspector.View}
*/
-WebInspector.DOMStorageItemsView = function(domStorage, domStorageModel)
+WebInspector.DOMStorageItemsView = function(domStorage)
{
WebInspector.View.call(this);
this.domStorage = domStorage;
- this.domStorageModel = domStorageModel;
this.element.addStyleClass("storage-view");
this.element.addStyleClass("table");
@@ -44,11 +42,6 @@
this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
this.refreshButton.addEventListener("click", this._refreshButtonClicked, this);
-
- this.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageItemsCleared, this._domStorageItemsCleared, this);
- this.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageItemRemoved, this._domStorageItemRemoved, this);
- this.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageItemAdded, this._domStorageItemAdded, this);
- this.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageItemUpdated, this._domStorageItemUpdated, this);
}
WebInspector.DOMStorageItemsView.prototype = {
@@ -59,7 +52,7 @@
wasShown: function()
{
- this._update();
+ this.update();
},
willHide: function()
@@ -67,94 +60,8 @@
this.deleteButton.visible = false;
},
- /**
- * @param {WebInspector.Event} event
- */
- _domStorageItemsCleared: function(event)
+ update: function()
{
- if (!this.isShowing())
- return;
-
- this._dataGrid.rootNode().removeChildren();
- this._dataGrid.addCreationNode(false);
- this.deleteButton.visible = false;
- event.consume(true);
- },
-
- /**
- * @param {WebInspector.Event} event
- */
- _domStorageItemRemoved: function(event)
- {
- if (!this.isShowing())
- return;
-
- var storageData = event.data;
- var rootNode = this._dataGrid.rootNode();
- var children = rootNode.children;
-
- event.consume(true);
-
- for (var i = 0; i < children.length; ++i) {
- var childNode = children[i];
- if (childNode.data.key === storageData.key) {
- rootNode.removeChild(childNode);
- this.deleteButton.visible = (children.length > 1);
- return;
- }
- }
- },
-
- /**
- * @param {WebInspector.Event} event
- */
- _domStorageItemAdded: function(event)
- {
- if (!this.isShowing())
- return;
-
- var storageData = event.data;
- var rootNode = this._dataGrid.rootNode();
- var children = rootNode.children;
-
- event.consume(true);
- this.deleteButton.visible = true;
-
- for (var i = 0; i < children.length; ++i)
- if (children[i].data.key === storageData.key)
- return;
-
- var childNode = new WebInspector.DataGridNode({key: storageData.key, value: storageData.newValue}, false);
- rootNode.insertChild(childNode, children.length - 1);
- },
-
- /**
- * @param {WebInspector.Event} event
- */
- _domStorageItemUpdated: function(event)
- {
- if (!this.isShowing())
- return;
-
- var storageData = event.data;
- var rootNode = this._dataGrid.rootNode();
- var children = rootNode.children;
-
- event.consume(true);
-
- for (var i = 0; i < children.length; ++i) {
- var childNode = children[i];
- if (childNode.data.key === storageData.key) {
- childNode.data.value = storageData.newValue;
- childNode.refresh();
- this.deleteButton.visible = true;
- return;
- }
- }
- },
-
- _update: function()
- {
this.detachChildViews();
this.domStorage.getEntries(this._showDOMStorageEntries.bind(this));
},
@@ -167,7 +74,7 @@
this._dataGrid = this._dataGridForDOMStorageEntries(entries);
this._dataGrid.show(this.element);
this._dataGrid.autoSizeColumns(10);
- this.deleteButton.visible = (this._dataGrid.rootNode().children.length > 1);
+ this.deleteButton.visible = true;
},
_dataGridForDOMStorageEntries: function(entries)
@@ -213,7 +120,7 @@
_refreshButtonClicked: function(event)
{
- this._update();
+ this.update();
},
_editingCallback: function(editingNode, columnIdentifier, oldText, newText)
@@ -224,8 +131,11 @@
domStorage.removeItem(oldText);
domStorage.setItem(newText, editingNode.data.value);
- } else
+ } else {
domStorage.setItem(editingNode.data.key, newText);
+ }
+
+ this.update();
},
_deleteCallback: function(node)
@@ -235,6 +145,8 @@
if (this.domStorage)
this.domStorage.removeItem(node.data.key);
+
+ this.update();
},
__proto__: WebInspector.View.prototype
« no previous file with comments | « Source/WebCore/inspector/front-end/DOMStorage.js ('k') | Source/WebCore/inspector/front-end/ResourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698