Merge "Do pause painting better"

This commit is contained in:
John Reck
2012-03-27 13:38:11 -07:00
committed by Android (Google) Code Review
3 changed files with 15 additions and 9 deletions

View File

@@ -42,12 +42,7 @@ class DebugFlags {
public static final boolean WEB_BACK_FORWARD_LIST = false;
public static final boolean WEB_SETTINGS = false;
public static final boolean WEB_SYNC_MANAGER = false;
public static final boolean WEB_TEXT_VIEW = false;
public static final boolean WEB_VIEW = false;
public static final boolean WEB_VIEW_CORE = false;
/*
* Set to true to allow the WebTextView to draw on top of the web page in a
* different color with no background so you can see how the two line up.
*/
public static final boolean DRAW_WEBTEXTVIEW = false;
public static final boolean MEASURE_PAGE_SWAP_FPS = false;
}

View File

@@ -4717,10 +4717,10 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
queueFull = nativeSetBaseLayer(mNativeClass, layer, invalRegion,
showVisualIndicator, isPictureAfterFirstLayout);
if (layer == 0 || isPictureAfterFirstLayout) {
mWebViewCore.resumeWebKitDraw();
} else if (queueFull) {
if (queueFull) {
mWebViewCore.pauseWebKitDraw();
} else {
mWebViewCore.resumeWebKitDraw();
}
if (mHTML5VideoViewProxy != null) {
@@ -8615,9 +8615,19 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
void onPageSwapOccurred(boolean notifyAnimationStarted);
}
long mLastSwapTime;
double mAverageSwapFps;
/** Called by JNI when pages are swapped (only occurs with hardware
* acceleration) */
protected void pageSwapCallback(boolean notifyAnimationStarted) {
if (DebugFlags.MEASURE_PAGE_SWAP_FPS) {
long now = System.currentTimeMillis();
long diff = now - mLastSwapTime;
mAverageSwapFps = ((1000.0 / diff) + mAverageSwapFps) / 2;
Log.d(LOGTAG, "page swap fps: " + mAverageSwapFps);
mLastSwapTime = now;
}
mWebViewCore.resumeWebKitDraw();
if (notifyAnimationStarted) {
mWebViewCore.sendMessage(EventHub.NOTIFY_ANIMATION_STARTED);

View File

@@ -2271,6 +2271,7 @@ public final class WebViewCore {
mFirstLayoutForNonStandardLoad = false;
}
if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw NEW_PICTURE_MSG_ID");
pauseWebKitDraw();
Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.NEW_PICTURE_MSG_ID, draw).sendToTarget();
}