Merge "Cleanup Extended frame -> Vsync callback." into tm-dev
This commit is contained in:
@@ -154,13 +154,13 @@ public final class Choreographer {
|
|||||||
private static final int MSG_DO_SCHEDULE_VSYNC = 1;
|
private static final int MSG_DO_SCHEDULE_VSYNC = 1;
|
||||||
private static final int MSG_DO_SCHEDULE_CALLBACK = 2;
|
private static final int MSG_DO_SCHEDULE_CALLBACK = 2;
|
||||||
|
|
||||||
// All frame callbacks posted by applications have this token or EXTENDED_FRAME_CALLBACK_TOKEN.
|
// All frame callbacks posted by applications have this token or VSYNC_CALLBACK_TOKEN.
|
||||||
private static final Object FRAME_CALLBACK_TOKEN = new Object() {
|
private static final Object FRAME_CALLBACK_TOKEN = new Object() {
|
||||||
public String toString() { return "FRAME_CALLBACK_TOKEN"; }
|
public String toString() { return "FRAME_CALLBACK_TOKEN"; }
|
||||||
};
|
};
|
||||||
private static final Object EXTENDED_FRAME_CALLBACK_TOKEN = new Object() {
|
private static final Object VSYNC_CALLBACK_TOKEN = new Object() {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EXTENDED_FRAME_CALLBACK_TOKEN";
|
return "VSYNC_CALLBACK_TOKEN";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -492,12 +492,12 @@ public final class Choreographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Posts an extended frame callback to run on the next frame.
|
* Posts a vsync callback to run on the next frame.
|
||||||
* <p>
|
* <p>
|
||||||
* The callback runs once then is automatically removed.
|
* The callback runs once then is automatically removed.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param callback The extended frame callback to run during the next frame.
|
* @param callback The vsync callback to run during the next frame.
|
||||||
*
|
*
|
||||||
* @see #removeVsyncCallback
|
* @see #removeVsyncCallback
|
||||||
*/
|
*/
|
||||||
@@ -506,7 +506,7 @@ public final class Choreographer {
|
|||||||
throw new IllegalArgumentException("callback must not be null");
|
throw new IllegalArgumentException("callback must not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
postCallbackDelayedInternal(CALLBACK_ANIMATION, callback, EXTENDED_FRAME_CALLBACK_TOKEN, 0);
|
postCallbackDelayedInternal(CALLBACK_ANIMATION, callback, VSYNC_CALLBACK_TOKEN, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -599,9 +599,9 @@ public final class Choreographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a previously posted extended frame callback.
|
* Removes a previously posted vsync callback.
|
||||||
*
|
*
|
||||||
* @param callback The extended frame callback to remove.
|
* @param callback The vsync callback to remove.
|
||||||
*
|
*
|
||||||
* @see #postVsyncCallback
|
* @see #postVsyncCallback
|
||||||
*/
|
*/
|
||||||
@@ -610,7 +610,7 @@ public final class Choreographer {
|
|||||||
throw new IllegalArgumentException("callback must not be null");
|
throw new IllegalArgumentException("callback must not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
removeCallbacksInternal(CALLBACK_ANIMATION, callback, EXTENDED_FRAME_CALLBACK_TOKEN);
|
removeCallbacksInternal(CALLBACK_ANIMATION, callback, VSYNC_CALLBACK_TOKEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1198,7 +1198,7 @@ public final class Choreographer {
|
|||||||
private static final class CallbackRecord {
|
private static final class CallbackRecord {
|
||||||
public CallbackRecord next;
|
public CallbackRecord next;
|
||||||
public long dueTime;
|
public long dueTime;
|
||||||
/** Runnable or FrameCallback or ExtendedFrameCallback object. */
|
/** Runnable or FrameCallback or VsyncCallback object. */
|
||||||
public Object action;
|
public Object action;
|
||||||
/** Denotes the action type. */
|
/** Denotes the action type. */
|
||||||
public Object token;
|
public Object token;
|
||||||
@@ -1213,7 +1213,7 @@ public final class Choreographer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void run(FrameData frameData) {
|
void run(FrameData frameData) {
|
||||||
if (token == EXTENDED_FRAME_CALLBACK_TOKEN) {
|
if (token == VSYNC_CALLBACK_TOKEN) {
|
||||||
((VsyncCallback) action).onVsync(frameData);
|
((VsyncCallback) action).onVsync(frameData);
|
||||||
} else {
|
} else {
|
||||||
run(frameData.getFrameTimeNanos());
|
run(frameData.getFrameTimeNanos());
|
||||||
|
|||||||
Reference in New Issue
Block a user