diff options
author | Alon Albert <aalbert@google.com> | 2010-12-22 11:07:54 -0800 |
---|---|---|
committer | Alon Albert <aalbert@google.com> | 2010-12-22 14:40:43 -0800 |
commit | d41fe75f09fa09fc708d389572639511d745c20e (patch) | |
tree | ab87fedfb86f69804aa2443f4c2a29b027ad8886 /graphics/java/android/renderscript/ProgramRaster.java | |
parent | 0c8ad64d64b23e2bdd62bc217e327c7e0583784b (diff) |
Improved ignore-backoff handling
Allow a non-epidited ignore-backoff op to pass through
an expidited backed off op.
To do this, I first refactored the complicated if statement:
if (best == null
|| ((bestSyncableIsUnknownAndNotARetry == syncableIsUnknownAndNotARetry)
? (best.expedited == op.expedited
? opRunTime < bestRunTime
: op.expedited)
: syncableIsUnknownAndNotARetry)) {
best = op;
bestSyncableIsUnknownAndNotARetry = syncableIsUnknownAndNotARetry;
bestRunTime = opRunTime;
}
Into a more readable:
boolean setBest = false;
if (best == null) {
setBest = true;
} else if (bestSyncableIsUnknownAndNotARetry == syncableIsUnknownAndNotARetry) {
if (best.expedited == op.expedited) {
if (opRunTime < bestRunTime) {
// if both have same level, earlier time wins
setBest = true;
}
} else {
if (op.expedited) {
setBest = true;
}
}
} else {
if (syncableIsUnknownAndNotARetry) {
setBest = true;
}
}
if (setBest) {
best = op;
bestSyncableIsUnknownAndNotARetry = syncableIsUnknownAndNotARetry;
bestRunTime = opRunTime;
}
The refactoring was all done automatically with IntelliJ to avoid human error
in the conversion.
After verifying this code still behaved as expected including the error
condition in the bug, I added handling for the cases when a non-expidited op
may override an expedited op if certain conditions occur, specificaly, if the
expidited op is backed off and the non-expidited op is not.
Finally, refactored to make it testable and added tests and logging.
Bug: 3128963
Change-Id: I131cbcec6073ea5fe425f6b5aa88ca56c02b6598
Diffstat (limited to 'graphics/java/android/renderscript/ProgramRaster.java')
0 files changed, 0 insertions, 0 deletions