summaryrefslogtreecommitdiffstats
path: root/tests/TileBenchmark
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-02-02 15:44:28 -0800
committerChris Craik <ccraik@google.com>2012-02-03 16:07:11 -0800
commit4390c6b4a6b38b1c25fdf6b10b1310ff73c4f9ce (patch)
tree2a1fdbd18c4c53aa830af9e89070944100ec0ada /tests/TileBenchmark
parent6baed6c11090fe6eb0a612ca4acee590e904ca58 (diff)
downloadframeworks_base-4390c6b4a6b38b1c25fdf6b10b1310ff73c4f9ce.zip
frameworks_base-4390c6b4a6b38b1c25fdf6b10b1310ff73c4f9ce.tar.gz
frameworks_base-4390c6b4a6b38b1c25fdf6b10b1310ff73c4f9ce.tar.bz2
Pause webkit painting when UI tile painting queue is full
Change-Id: I8836d7951f8f02d7f966dc22d807ea785ac9e637
Diffstat (limited to 'tests/TileBenchmark')
-rw-r--r--tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java b/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java
index a706f78..a38ac25 100644
--- a/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java
+++ b/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java
@@ -40,8 +40,11 @@ public class ProfiledWebView extends WebView {
private long mContentInvalMillis;
private static final int LOAD_STALL_MILLIS = 2000; // nr of millis after load,
// before test is forced
- private double mLoadTime;
- private double mAnimationTime;
+
+ // ignore anim end events until this many millis after load
+ private static final long ANIM_SAFETY_THRESHOLD = 200;
+ private long mLoadTime;
+ private long mAnimationTime;
public ProfiledWebView(Context context) {
super(context);
@@ -131,7 +134,6 @@ public class ProfiledWebView extends WebView {
// invalidate all content, and kick off redraw
Log.d("ProfiledWebView",
"kicking off test with callback registration, and tile discard...");
- registerPageSwapCallback();
discardAllTextures();
invalidate();
mIsScrolling = true;
@@ -150,10 +152,11 @@ public class ProfiledWebView extends WebView {
*/
@Override
protected void pageSwapCallback(boolean startAnim) {
+ super.pageSwapCallback(startAnim);
+
if (!mIsTesting && mIsScrolling) {
// kick off testing
mContentInvalMillis = System.currentTimeMillis() - mContentInvalMillis;
- super.pageSwapCallback(startAnim);
Log.d("ProfiledWebView", "REDRAW TOOK " + mContentInvalMillis + "millis");
mIsTesting = true;
invalidate(); // ensure a redraw so that auto-scrolling can occur
@@ -166,14 +169,14 @@ public class ProfiledWebView extends WebView {
String updatesString = settings.getProperty("tree_updates");
int updates = (updatesString == null) ? -1 : Integer.parseInt(updatesString);
- double animationTime;
- if (mAnimationTime == 0) {
+ long animationTime;
+ if (mAnimationTime == 0 || mAnimationTime - mLoadTime < ANIM_SAFETY_THRESHOLD) {
animationTime = System.currentTimeMillis() - mLoadTime;
} else {
animationTime = mAnimationTime - mLoadTime;
}
- return updates * 1000 / animationTime;
+ return updates * 1000.0 / animationTime;
}
public void setDoubleBuffering(boolean useDoubleBuffering) {