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 /** | 7 /** |
8 * @constructor | 8 * @constructor |
9 */ | 9 */ |
10 function FileCopyManager() { | 10 function FileCopyManager() { |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 if (task.pendingDirectories.length + task.pendingFiles.length == 0) { | 739 if (task.pendingDirectories.length + task.pendingFiles.length == 0) { |
740 if (task.deleteAfterCopy) { | 740 if (task.deleteAfterCopy) { |
741 deleteOriginals(); | 741 deleteOriginals(); |
742 } else { | 742 } else { |
743 successCallback(); | 743 successCallback(); |
744 } | 744 } |
745 return; | 745 return; |
746 } | 746 } |
747 | 747 |
748 self.sendProgressEvent_('PROGRESS'); | 748 self.sendProgressEvent_('PROGRESS'); |
749 | 749 self.serviceNextCopyTaskEntry_(task, onEntryServiced, errorCallback); |
750 // We yield a few ms between copies to give the browser a chance to service | |
751 // events (like perhaps the user clicking to cancel the copy, for example). | |
752 setTimeout(function() { | |
753 self.serviceNextCopyTaskEntry_(task, onEntryServiced, errorCallback); | |
754 }, 10); | |
755 }; | 750 }; |
756 | 751 |
757 this.serviceNextCopyTaskEntry_(task, onEntryServiced, errorCallback); | 752 this.serviceNextCopyTaskEntry_(task, onEntryServiced, errorCallback); |
758 }; | 753 }; |
759 | 754 |
760 /** | 755 /** |
761 * Service the next entry in a given task. | 756 * Service the next entry in a given task. |
762 * TODO(olege): Refactor this method into a separate class. | 757 * TODO(olege): Refactor this method into a separate class. |
763 * | 758 * |
764 * @param {FileManager.Task} task A task. | 759 * @param {FileManager.Task} task A task. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 // Assume self.cancelRequested_ == false. | 1275 // Assume self.cancelRequested_ == false. |
1281 // This moved us from 0 to 1 active tasks, let the servicing begin! | 1276 // This moved us from 0 to 1 active tasks, let the servicing begin! |
1282 self.serviceAllTasks_(); | 1277 self.serviceAllTasks_(); |
1283 } else { | 1278 } else { |
1284 // Force to update the progress of butter bar when there are new tasks | 1279 // Force to update the progress of butter bar when there are new tasks |
1285 // coming while servicing current task. | 1280 // coming while servicing current task. |
1286 self.sendProgressEvent_('PROGRESS'); | 1281 self.sendProgressEvent_('PROGRESS'); |
1287 } | 1282 } |
1288 }); | 1283 }); |
1289 }; | 1284 }; |
OLD | NEW |