| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Scanner of the entries. | 6 * Scanner of the entries. |
| 7 * @constructor | 7 * @constructor |
| 8 */ | 8 */ |
| 9 function ContentScanner() { | 9 function ContentScanner() { |
| 10 this.cancelled_ = false; | 10 this.cancelled_ = false; |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 this.fileList_ = new cr.ui.ArrayDataModel(fileList); | 679 this.fileList_ = new cr.ui.ArrayDataModel(fileList); |
| 680 this.makeSpaceInMetadataCache_(this.fileList_.length); | 680 this.makeSpaceInMetadataCache_(this.fileList_.length); |
| 681 }; | 681 }; |
| 682 | 682 |
| 683 /** | 683 /** |
| 684 * Creates snapshot of metadata in the directory. | 684 * Creates snapshot of metadata in the directory. |
| 685 * @return {!Object} Metadata snapshot of current directory contents. | 685 * @return {!Object} Metadata snapshot of current directory contents. |
| 686 */ | 686 */ |
| 687 DirectoryContents.prototype.createMetadataSnapshot = function() { | 687 DirectoryContents.prototype.createMetadataSnapshot = function() { |
| 688 var snapshot = {}; | 688 var snapshot = {}; |
| 689 var entries = this.fileList_.slice(); | 689 var entries = /** @type {!Array<!Entry>} */ (this.fileList_.slice()); |
| 690 var metadata = this.context_.fileSystemMetadata.getCache( | 690 var metadata = this.context_.fileSystemMetadata.getCache( |
| 691 entries, ['modificationTime']); | 691 entries, ['modificationTime']); |
| 692 for (var i = 0; i < entries.length; i++) { | 692 for (var i = 0; i < entries.length; i++) { |
| 693 snapshot[entries[i].toURL()] = metadata[i]; | 693 snapshot[entries[i].toURL()] = metadata[i]; |
| 694 } | 694 } |
| 695 return snapshot; | 695 return snapshot; |
| 696 } | 696 } |
| 697 | 697 |
| 698 /** | 698 /** |
| 699 * Sets metadata snapshot which is used to check changed files. | 699 * Sets metadata snapshot which is used to check changed files. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 717 var spliceArgs = this.fileList_.slice(); | 717 var spliceArgs = this.fileList_.slice(); |
| 718 var fileList = this.context_.fileList; | 718 var fileList = this.context_.fileList; |
| 719 spliceArgs.unshift(0, fileList.length); | 719 spliceArgs.unshift(0, fileList.length); |
| 720 fileList.splice.apply(fileList, spliceArgs); | 720 fileList.splice.apply(fileList, spliceArgs); |
| 721 this.fileList_ = fileList; | 721 this.fileList_ = fileList; |
| 722 this.makeSpaceInMetadataCache_(this.fileList_.length); | 722 this.makeSpaceInMetadataCache_(this.fileList_.length); |
| 723 | 723 |
| 724 // Check updated files and dispatch change events. | 724 // Check updated files and dispatch change events. |
| 725 if (this.metadataSnapshot_) { | 725 if (this.metadataSnapshot_) { |
| 726 var updatedIndexes = []; | 726 var updatedIndexes = []; |
| 727 var entries = this.fileList_.slice(); | 727 var entries = /** @type {!Array<!Entry>} */ (this.fileList_.slice()); |
| 728 var newMetadatas = this.context_.fileSystemMetadata.getCache( | 728 var newMetadatas = this.context_.fileSystemMetadata.getCache( |
| 729 entries, ['modificationTime']); | 729 entries, ['modificationTime']); |
| 730 | 730 |
| 731 for (var i = 0; i < entries.length; i++) { | 731 for (var i = 0; i < entries.length; i++) { |
| 732 var url = entries[i].toURL(); | 732 var url = entries[i].toURL(); |
| 733 var newMetadata = newMetadatas[i]; | 733 var newMetadata = newMetadatas[i]; |
| 734 if (this.metadataSnapshot_[url] && | 734 if (this.metadataSnapshot_[url] && |
| 735 this.metadataSnapshot_[url].modificationTime && | 735 this.metadataSnapshot_[url].modificationTime && |
| 736 this.metadataSnapshot_[url].modificationTime.getTime() !== | 736 this.metadataSnapshot_[url].modificationTime.getTime() !== |
| 737 newMetadata.modificationTime.getTime()) | 737 newMetadata.modificationTime.getTime()) |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 DirectoryContents.createForDriveMetadataSearch = function( | 1099 DirectoryContents.createForDriveMetadataSearch = function( |
| 1100 context, fakeDirectoryEntry, searchType) { | 1100 context, fakeDirectoryEntry, searchType) { |
| 1101 return new DirectoryContents( | 1101 return new DirectoryContents( |
| 1102 context, | 1102 context, |
| 1103 true, // Search | 1103 true, // Search |
| 1104 fakeDirectoryEntry, | 1104 fakeDirectoryEntry, |
| 1105 function() { | 1105 function() { |
| 1106 return new DriveMetadataSearchContentScanner(searchType); | 1106 return new DriveMetadataSearchContentScanner(searchType); |
| 1107 }); | 1107 }); |
| 1108 }; | 1108 }; |
| OLD | NEW |