Changeset 1014
- Timestamp:
- 07/31/08 06:38:42 (1 month ago)
- Files:
-
- trunk/chrome/content/dta/manager.js (modified) (2 diffs)
- trunk/chrome/content/dta/manager/sessionmanager.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/chrome/content/dta/manager.js
r1013 r1014 153 153 startDownloads(window.arguments[0], window.arguments[1]); 154 154 } 155 156 155 this._initialized = true; 157 156 for (let d in Tree.all) { … … 462 461 close: function D_close() { 463 462 Debug.logString("Close request"); 463 if (!this._initialized) { 464 Debug.logString("not initialized. Going down immediately!"); 465 return true; 466 } 464 467 this.offline = true; 465 468 if (!this._forceClose && !this._canClose()) { trunk/chrome/content/dta/manager/sessionmanager.js
r1009 r1014 77 77 }, 78 78 shutdown: function() { 79 try { 80 for each (let e in ['_addStmt', '_saveStmt', '_savePosStmt', '_delStmt']) { 81 try { 82 this[e].finalize(); 83 delete this[e]; 84 } 85 catch (ex) { 86 // no-op 87 } 88 } 79 // try to kill any loaders 80 if ('_loader' in this) { 81 try { 82 this._loader.cancel(); 83 this.endUpdate(); 84 } 85 catch (ex) { 86 // no-op 87 } 88 } 89 for each (let e in ['_addStmt', '_saveStmt', '_savePosStmt', '_delStmt']) { 90 try { 91 this[e].finalize(); 92 delete this[e]; 93 } 94 catch (ex) { 95 // no-op 96 } 97 } 98 try { 89 99 this._con.executeSimpleSQL('VACUUM'); 90 try {91 this._con.close();92 delete this._con;93 }94 catch (ex) {95 Debug.log("Cannot close!", ex);96 }97 100 } 98 101 catch (ex) { 99 Debug.log("SessionManager::shutdown", ex); 102 // no-op 103 } 104 try { 105 this._con.close(); 106 delete this._con; 107 } 108 catch (ex) { 109 Debug.log("Cannot close!", ex); 100 110 } 101 111 }, … … 158 168 159 169 load: function() { 160 this._loaded = false;161 162 170 let stmt = this._con.createStatement('SELECT COUNT(*) FROM queue'); 163 171 stmt.executeStep(); … … 169 177 this.beginUpdate(); 170 178 Tree.beginUpdate(); 171 new CoThread(179 this._loader = new CoThread( 172 180 function(idx) { 173 loading.value = _('loading', [++idx, count]); 181 if (idx % 500 == 0) { 182 loading.label = _('loading', [idx, count]); 183 } 174 184 // Are we done? 175 185 if (!stmt || !stmt.executeStep()) { 186 delete this._loader; 176 187 this.endUpdate(); 177 188 Tree.endUpdate(); … … 291 302 return true; 292 303 }, 293 200,304 100, 294 305 this 295 ).run(); 306 ); 307 this._loader.run(); 296 308 } 297 309 };
