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 // If directory files changes too often, don't rescan directory more than once | 5 // If directory files changes too often, don't rescan directory more than once |
6 // per specified interval | 6 // per specified interval |
7 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; | 7 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; |
8 // Used for operations that require almost instant rescan. | 8 // Used for operations that require almost instant rescan. |
9 var SHORT_RESCAN_INTERVAL = 100; | 9 var SHORT_RESCAN_INTERVAL = 100; |
10 | 10 |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 if (entries.length == 0) { | 1253 if (entries.length == 0) { |
1254 this.successCallback_(); | 1254 this.successCallback_(); |
1255 this.recordMetrics_(); | 1255 this.recordMetrics_(); |
1256 return; | 1256 return; |
1257 } | 1257 } |
1258 | 1258 |
1259 // Splice takes the to-be-spliced-in array as individual parameters, | 1259 // Splice takes the to-be-spliced-in array as individual parameters, |
1260 // rather than as an array, so we need to perform some acrobatics... | 1260 // rather than as an array, so we need to perform some acrobatics... |
1261 var spliceArgs = [].slice.call(entries); | 1261 var spliceArgs = [].slice.call(entries); |
1262 | 1262 |
1263 for (filterName in this.filters_) { | 1263 for (var filterName in this.filters_) { |
1264 spliceArgs = spliceArgs.filter(this.filters_[filterName]); | 1264 spliceArgs = spliceArgs.filter(this.filters_[filterName]); |
1265 } | 1265 } |
1266 | 1266 |
1267 var self = this; | 1267 var self = this; |
1268 self.preprocessChunk_(spliceArgs, function() { | 1268 self.preprocessChunk_(spliceArgs, function() { |
1269 spliceArgs.unshift(0, 0); // index, deleteCount | 1269 spliceArgs.unshift(0, 0); // index, deleteCount |
1270 self.list_.splice.apply(self.list_, spliceArgs); | 1270 self.list_.splice.apply(self.list_, spliceArgs); |
1271 | 1271 |
1272 // Keep reading until entries.length is 0. | 1272 // Keep reading until entries.length is 0. |
1273 self.readNextChunk_(); | 1273 self.readNextChunk_(); |
1274 }); | 1274 }); |
1275 }; | 1275 }; |
1276 | 1276 |
1277 /** | 1277 /** |
1278 * @private | 1278 * @private |
1279 */ | 1279 */ |
1280 DirectoryModel.Scanner.prototype.recordMetrics_ = function() { | 1280 DirectoryModel.Scanner.prototype.recordMetrics_ = function() { |
1281 metrics.recordInterval('DirectoryScan'); | 1281 metrics.recordInterval('DirectoryScan'); |
1282 if (this.dir_.fullPath == | 1282 if (this.dir_.fullPath == |
1283 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) { | 1283 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) { |
1284 metrics.recordMediumCount('DownloadsCount', this.list_.length); | 1284 metrics.recordMediumCount('DownloadsCount', this.list_.length); |
1285 } | 1285 } |
1286 }; | 1286 }; |
OLD | NEW |