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 * @param {MetadataCache} metadataCache Metadata cache service. | 6 * @param {MetadataCache} metadataCache Metadata cache service. |
7 * @param {cr.ui.ArrayDataModel} fileList The file list. | 7 * @param {cr.ui.ArrayDataModel} fileList The file list. |
8 * @param {boolean} showHidden If files starting with '.' are shown. | 8 * @param {boolean} showHidden If files starting with '.' are shown. |
9 * @constructor | 9 * @constructor |
10 */ | 10 */ |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 this.allChunksFetched_ = true; | 216 this.allChunksFetched_ = true; |
217 if (!this.scanCancelled_ && this.pendingMetadataRequests_ === 0) | 217 if (!this.scanCancelled_ && this.pendingMetadataRequests_ === 0) |
218 cr.dispatchSimpleEvent(this, 'scan-completed'); | 218 cr.dispatchSimpleEvent(this, 'scan-completed'); |
219 }; | 219 }; |
220 | 220 |
221 /** | 221 /** |
222 * Cache necessary data before a sort happens. | 222 * Cache necessary data before a sort happens. |
223 * | 223 * |
224 * This is called by the table code before a sort happens, so that we can | 224 * This is called by the table code before a sort happens, so that we can |
225 * go fetch data for the sort field that we may not have yet. | 225 * go fetch data for the sort field that we may not have yet. |
226 * @private | |
227 * @param {string} field Sort field. | 226 * @param {string} field Sort field. |
228 * @param {function} callback Called when done. | 227 * @param {function} callback Called when done. |
| 228 * @private |
229 */ | 229 */ |
230 DirectoryContents.prototype.prepareSort_ = function(field, callback) { | 230 DirectoryContents.prototype.prepareSort_ = function(field, callback) { |
231 this.prefetchMetadata(this.fileList_.slice(), callback); | 231 this.prefetchMetadata(this.fileList_.slice(), callback); |
232 }; | 232 }; |
233 | 233 |
234 /** | 234 /** |
235 * @param {Array.<Entry>} entries Files. | 235 * @param {Array.<Entry>} entries Files. |
236 * @param {function} callback Callback on done. | 236 * @param {function} callback Callback on done. |
237 */ | 237 */ |
238 DirectoryContents.prototype.prefetchMetadata = function(entries, callback) { | 238 DirectoryContents.prototype.prefetchMetadata = function(entries, callback) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 /** | 340 /** |
341 * Read next chunk of results from DirectoryReader. | 341 * Read next chunk of results from DirectoryReader. |
342 * @protected | 342 * @protected |
343 */ | 343 */ |
344 DirectoryContentsBasic.prototype.readNextChunk = function() { | 344 DirectoryContentsBasic.prototype.readNextChunk = function() { |
345 this.reader_.readEntries(this.onChunkComplete_.bind(this), | 345 this.reader_.readEntries(this.onChunkComplete_.bind(this), |
346 this.onError.bind(this)); | 346 this.onError.bind(this)); |
347 }; | 347 }; |
348 | 348 |
349 /** | 349 /** |
| 350 * @param {Array.<Entry>} entries File list. |
350 * @private | 351 * @private |
351 * @param {Array.<Entry>} entries File list. | |
352 */ | 352 */ |
353 DirectoryContentsBasic.prototype.onChunkComplete_ = function(entries) { | 353 DirectoryContentsBasic.prototype.onChunkComplete_ = function(entries) { |
354 if (this.scanCancelled_) | 354 if (this.scanCancelled_) |
355 return; | 355 return; |
356 | 356 |
357 if (entries.length == 0) { | 357 if (entries.length == 0) { |
358 this.lastChunkReceived(); | 358 this.lastChunkReceived(); |
359 this.recordMetrics_(); | 359 this.recordMetrics_(); |
360 return; | 360 return; |
361 } | 361 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 }.bind(this); | 627 }.bind(this); |
628 | 628 |
629 getNextChunk(); | 629 getNextChunk(); |
630 }; | 630 }; |
631 | 631 |
632 /** | 632 /** |
633 * We get results for each directory in one go in scanDirectory_. | 633 * We get results for each directory in one go in scanDirectory_. |
634 */ | 634 */ |
635 DirectoryContentsLocalSearch.prototype.readNextChunk = function() { | 635 DirectoryContentsLocalSearch.prototype.readNextChunk = function() { |
636 }; | 636 }; |
OLD | NEW |