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

Unified Diff: ui/file_manager/file_manager/foreground/js/directory_model.js

Issue 520553002: Correct cache-size calculation of MetadataCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment for metadata size synchronization. Created 6 years, 4 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 | « ui/file_manager/file_manager/foreground/js/directory_contents.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/directory_model.js
diff --git a/ui/file_manager/file_manager/foreground/js/directory_model.js b/ui/file_manager/file_manager/foreground/js/directory_model.js
index a123154e4ae817bf8c4248025e872b9644bb14c6..56039f147c970fc25e1920aff66b0c4cd38ca2a5 100644
--- a/ui/file_manager/file_manager/foreground/js/directory_model.js
+++ b/ui/file_manager/file_manager/foreground/js/directory_model.js
@@ -385,6 +385,7 @@ DirectoryModel.prototype.clearAndScan_ = function(newDirContents,
callback) {
if (this.currentDirContents_.isScanning())
this.currentDirContents_.cancelScan();
+ this.currentDirContents_.dispose();
this.currentDirContents_ = newDirContents;
this.clearRescanTimeout_();
@@ -597,10 +598,13 @@ DirectoryModel.prototype.scan_ = function(
};
/**
- * @param {DirectoryContents} dirContents DirectoryContents instance.
+ * @param {DirectoryContents} dirContents DirectoryContents instance. This must
+ * be a different instance from this.currentDirContents_.
* @private
*/
DirectoryModel.prototype.replaceDirectoryContents_ = function(dirContents) {
+ console.assert(this.currentDirContents_ !== dirContents,
+ 'Give directory contents instance must be different from current one.');
cr.dispatchSimpleEvent(this, 'begin-update-files');
this.updateSelectionAndPublishEvent_(this.fileListSelection_, function() {
var selectedEntries = this.getSelectedEntries_();
@@ -610,9 +614,10 @@ DirectoryModel.prototype.replaceDirectoryContents_ = function(dirContents) {
var leadIndex = this.fileListSelection_.leadIndex;
var leadEntry = this.getLeadEntry_();
- this.currentDirContents_.dispose();
+ var previousDirContents = this.currentDirContents_;
this.currentDirContents_ = dirContents;
- dirContents.replaceContextFileList();
+ this.currentDirContents_.replaceContextFileList();
+ previousDirContents.dispose();
this.setSelectedEntries_(selectedEntries);
this.fileListSelection_.leadIndex = leadIndex;
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/directory_contents.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698