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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 // If directory files changes too often, don't rescan directory more than once | 7 // If directory files changes too often, don't rescan directory more than once |
8 // per specified interval | 8 // per specified interval |
9 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; | 9 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; |
10 // Used for operations that require almost instant rescan. | 10 // Used for operations that require almost instant rescan. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Removes the metadata of invalid entries. | 176 // Removes the metadata of invalid entries. |
177 if (result.failureUrls.length > 0) | 177 if (result.failureUrls.length > 0) |
178 this.metadataCache_.clearByUrl(result.failureUrls, '*'); | 178 this.metadataCache_.clearByUrl(result.failureUrls, '*'); |
179 | 179 |
180 // Rescans after force-refreshing the metadata of the changed entries. | 180 // Rescans after force-refreshing the metadata of the changed entries. |
181 var entries = result.entries; | 181 var entries = result.entries; |
182 if (entries.length) { | 182 if (entries.length) { |
183 this.currentDirContents_.prefetchMetadata(entries, true, function() { | 183 this.currentDirContents_.prefetchMetadata(entries, true, function() { |
184 this.rescanSoon(false); | 184 this.rescanSoon(false); |
185 }.bind(this)); | 185 }.bind(this)); |
| 186 } else { |
| 187 this.rescanSoon(false); |
186 } | 188 } |
187 }.bind(this)).catch(function(error) { | 189 }.bind(this)).catch(function(error) { |
188 console.error('Error in proceeding the changed event.', error, | 190 console.error('Error in proceeding the changed event.', error, |
189 'Fallback to force-refresh'); | 191 'Fallback to force-refresh'); |
190 this.rescanSoon(true); | 192 this.rescanSoon(true); |
191 }.bind(this)); | 193 }.bind(this)); |
192 } else { | 194 } else { |
193 // Invokes force refresh if the detailed information isn't provided. | 195 // Invokes force refresh if the detailed information isn't provided. |
194 this.rescanSoon(true); | 196 this.rescanSoon(true); |
195 } | 197 } |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 if (this.onSearchCompleted_) { | 1031 if (this.onSearchCompleted_) { |
1030 this.removeEventListener('scan-completed', this.onSearchCompleted_); | 1032 this.removeEventListener('scan-completed', this.onSearchCompleted_); |
1031 this.onSearchCompleted_ = null; | 1033 this.onSearchCompleted_ = null; |
1032 } | 1034 } |
1033 | 1035 |
1034 if (this.onClearSearch_) { | 1036 if (this.onClearSearch_) { |
1035 this.onClearSearch_(); | 1037 this.onClearSearch_(); |
1036 this.onClearSearch_ = null; | 1038 this.onClearSearch_ = null; |
1037 } | 1039 } |
1038 }; | 1040 }; |
OLD | NEW |