| Package | org.flexunit.internals.runners.statements |
| Class | public class StackAndFrameManagement |
| Inheritance | StackAndFrameManagement Object |
| Implements | IAsyncStatement |
StackAndFrameManagement decorator implements green threading to deal with flash
frames. This class allows us to break execution across frames and ensure a stack overflow does not
occur. It does this by starting a timer when it is asked to evaluate itself. When the timer fires,
which will be the following frame, execution will resume.
Each time we get to the beginning of a new test, we calculate the elapsed time versus the framerate.
If we get to the point where we have used mroe than about 80% of a given frame, we then defer until the
next one. This prevents the player from being locked into a single frame for the entire duration of the
tests preventing it from communicating with external servers, updating the UI and potentially timing out
after 15 seconds.
| Method | Defined By | ||
|---|---|---|---|
StackAndFrameManagement(statement:IAsyncStatement)
Constructor. | StackAndFrameManagement | ||
evaluate(previousToken:AsyncTestToken):void
Determines if there is time in the frame to start running the IAsyncStatement. | StackAndFrameManagement | ||
handleNextExecuteComplete(result:ChildResult):void
Report any errors the ChildResult has encountered to the parentToken, notifying
the parentToken that we are done. | StackAndFrameManagement | ||
| Method | Defined By | ||
|---|---|---|---|
handleTimerComplete(event:TimerEvent):void
Evaluates the IAsyncStatement after the timer has waited and the player is
now in the next frame. | StackAndFrameManagement | ||
| StackAndFrameManagement | () | Constructor |
public function StackAndFrameManagement(statement:IAsyncStatement)Constructor.
Parametersstatement:IAsyncStatement — The current object that implements the IAsyncStatement to decorate.
|
| evaluate | () | method |
public function evaluate(previousToken:AsyncTestToken):void
Determines if there is time in the frame to start running the IAsyncStatement. If there is still time,
the IAsyncStatement will be evaluated; otherwise, a timer will be started that will wait until the
next frame before the IAsyncStatement is evaluated.
Parameters
previousToken:AsyncTestToken — The token to be notified when that IAsyncStatement has finished executing.
|
| handleNextExecuteComplete | () | method |
public function handleNextExecuteComplete(result:ChildResult):void
Report any errors the ChildResult has encountered to the parentToken, notifying
the parentToken that we are done.
Parameters
result:ChildResult — The ChildResult to check to see if there is an error.
|
| handleTimerComplete | () | method |
protected function handleTimerComplete(event:TimerEvent):void
Evaluates the IAsyncStatement after the timer has waited and the player is
now in the next frame.
Parameters
event:TimerEvent |