Changeset 1045
- Timestamp:
- 2008-08-18 03:09:50 (3 months ago)
- Files:
-
- trunk/chrome/content/dta/manager.js (modified) (5 diffs)
- trunk/chrome/content/dta/manager/prefs.js (modified) (1 diff)
- trunk/defaults/preferences/dta.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/chrome/content/dta/manager.js
r1044 r1045 84 84 const STREAMS_FREQ = 200; 85 85 86 const END_FIRST_SIZE = 2 * 1024 * 1024; 87 86 88 let Prompts = {}; 87 89 Components.utils.import('resource://dta/prompts.jsm', Prompts); … … 1685 1687 download.chunks.push(chunk); 1686 1688 download.chunks.sort(function(a,b) { return a.start - b.start; }); 1687 downloadChunk(download, chunk, header); 1688 download.sessionConnctions = 0; 1689 downloadChunk(download, chunk, header); 1689 1690 } 1690 1691 function downloadChunk(download, chunk, header) { … … 1710 1711 if (this.chunks.length == 0) { 1711 1712 downloadNewChunk(this, 0, 0, true); 1713 this.sessionConnections = 0; 1712 1714 return false; 1713 1715 } 1714 1716 1715 1717 // start some new chunks 1716 var paused = this.chunks.filter( 1717 function (chunk) { 1718 return !(chunk.running || chunk.complete); 1719 } 1720 ); 1718 let paused = this.chunks.filter(function (chunk) !(chunk.running || chunk.complete)); 1719 1721 1720 while (this.activeChunks < this.maxChunks) { 1722 1721 … … 1727 1726 continue; 1728 1727 } 1728 1729 if (this.chunks.length == 1 && Prefs.loadEndFirst && this.chunks[0].remainder > 3 * END_FIRST_SIZE) { 1730 // we should download the end first! 1731 let c = this.chunks[0]; 1732 let end = c.end; 1733 c.end -= END_FIRST_SIZE; 1734 downloadNewChunk(this, c.end + 1, end); 1735 rv = true; 1736 continue; 1737 } 1729 1738 1730 1739 // find biggest chunk 1731 1740 let biggest = null; 1732 this.chunks.forEach( 1733 function (chunk) { 1734 if (chunk.running && chunk.remainder > MIN_CHUNK_SIZE * 2) { 1735 if (!biggest || biggest.remainder < chunk.remainder) { 1736 biggest = chunk; 1737 } 1741 for each (let chunk in this.chunks) { 1742 if (chunk.running && chunk.remainder > MIN_CHUNK_SIZE * 2) { 1743 if (!biggest || biggest.remainder < chunk.remainder) { 1744 biggest = chunk; 1738 1745 } 1739 1746 } 1740 );1747 } 1741 1748 1742 1749 // nothing found, break … … 1744 1751 break; 1745 1752 } 1746 var end = biggest.end; 1747 var bend = biggest.start + biggest.written + Math.floor(biggest.remainder / 2); 1748 biggest.end = bend; 1753 let end = biggest.end; 1754 biggest.end = biggest.start + biggest.written + Math.floor(biggest.remainder / 2); 1749 1755 downloadNewChunk(this, biggest.end + 1, end); 1750 1756 rv = true; trunk/chrome/content/dta/manager/prefs.js
r993 r1045 61 61 ['confirmRemove', true], 62 62 ['permissions', 384], 63 ['loadEndFirst', false] 63 64 ], 64 65 trunk/defaults/preferences/dta.js
r827 r1045 68 68 pref("extensions.dta.confirmremove", true); 69 69 pref("extensions.dta.permissions", 384); 70 pref("extensions.dta.loadendfirst", false); 70 71 71 72 // Seamonkey specific
