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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 * | 380 * |
381 * This should be used when changing directory or initiating a new search. | 381 * This should be used when changing directory or initiating a new search. |
382 * | 382 * |
383 * @private | 383 * @private |
384 * @param {DirectoryContentes} newDirContents New DirectoryContents instance to | 384 * @param {DirectoryContentes} newDirContents New DirectoryContents instance to |
385 * replace currentDirContents_. | 385 * replace currentDirContents_. |
386 * @param {Function} opt_callback Called on success. | 386 * @param {Function} opt_callback Called on success. |
387 */ | 387 */ |
388 DirectoryModel.prototype.clearAndScan_ = function(newDirContents, | 388 DirectoryModel.prototype.clearAndScan_ = function(newDirContents, |
389 opt_callback) { | 389 opt_callback) { |
| 390 this.currentDirContents_.cancelScan(); |
390 this.currentDirContents_ = newDirContents; | 391 this.currentDirContents_ = newDirContents; |
391 this.clearRescanTimeout_(); | 392 this.clearRescanTimeout_(); |
392 | 393 |
393 if (this.pendingScan_) | 394 if (this.pendingScan_) |
394 this.pendingScan_ = false; | 395 this.pendingScan_ = false; |
395 | 396 |
396 if (this.runningScan_) { | 397 if (this.runningScan_) { |
397 this.runningScan_.cancelScan(); | 398 this.runningScan_.cancelScan(); |
398 this.runningScan_ = null; | 399 this.runningScan_ = null; |
399 } | 400 } |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 }.bind(this)); | 1324 }.bind(this)); |
1324 } | 1325 } |
1325 }; | 1326 }; |
1326 | 1327 |
1327 /** | 1328 /** |
1328 * @return {DirectoryEntry} Current watched directory entry. | 1329 * @return {DirectoryEntry} Current watched directory entry. |
1329 */ | 1330 */ |
1330 FileWatcher.prototype.getWatchedDirectoryEntry = function() { | 1331 FileWatcher.prototype.getWatchedDirectoryEntry = function() { |
1331 return this.watchedDirectoryEntry_; | 1332 return this.watchedDirectoryEntry_; |
1332 }; | 1333 }; |
OLD | NEW |