49 const Cc = Components.classes;
50 const Ci = Components.interfaces;
51 const Cr = Components.results;
52 const Cu = Components.utils;
97 this._genIterStack = [];
98 this._genIterStack.push(aEntryPoint);
116 function GeneratorThread_terminateCurrentThread() {
131 var scheduleStartTime = this.
currentThread._scheduleStartTime;
134 var currentTime = (
new Date()).getTime();
137 if ((currentTime - scheduleStartTime) >= yieldThreshold)
147 GeneratorThread.yieldIfShould =
function GeneratorThread_yieldIfShould() {
183 _scheduleStartTime: 0,
196 start:
function GeneratorThread_start() {
198 this._yieldThreshold = (this.
period * this.maxPctCPU) / 100;
201 this.
_timer =
Cc[
"@mozilla.org/timer;1"].createInstance(
Ci.nsITimer);
205 var func =
function() { _this._run(); };
206 this.
_timer.initWithCallback(func,
208 Ci.nsITimer.TYPE_REPEATING_SLACK);
216 terminate:
function GeneratorThread_terminate() {
219 while (genIter = this._genIterStack.pop()) {
230 this._genIterStack = [];
244 _run:
function GeneratorThread__run() {
246 this._scheduleStartTime = (
new Date()).getTime();
256 if (this._genIterStack.length == 0)
271 _runStack:
function GeneratorThread__runStack() {
273 var nextGenIter = this._genIterStack[this._genIterStack.length - 1];
280 var exception =
null;
281 while (nextGenIter) {
283 var genIter = nextGenIter;
292 nextGenIter = genIter.next();
294 var throwException = exception;
296 nextGenIter = genIter.throw(throwException);
302 this._genIterStack.push(nextGenIter);
306 this._genIterStack.pop();
307 if (this._genIterStack.length > 0)
308 nextGenIter = this._genIterStack[this._genIterStack.length - 1];
313 if (!(ex instanceof StopIteration))
320 var
msg =
"GeneratorThread exception: " + exception +
321 " at " + exception.fileName +
322 ", line " + exception.lineNumber;
333 _adjustTimer:
function GeneratorThread__adjustTimer() {
339 var scheduleEndTime = (
new Date()).getTime();
343 var adjTime = scheduleEndTime -
344 this._scheduleStartTime -
345 this._yieldThreshold;
354 var newDelay = this.
period + adjTime;
355 if (this.
_timer.delay != newDelay)
356 this.
_timer.delay = newDelay;
GeneratorThread currentThread
function GeneratorThread(aEntryPoint)
sbDeviceFirmwareAutoCheckForUpdate prototype _timer
DataRemote prototype constructor