summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2011-06-04 00:46:45 -0700
committer John Reck <jreck@google.com> 2011-06-04 19:50:29 -0700
commit83e5929d4cee2d69ff98d1656d91c7f408ea0afb (patch)
tree66e3bf0342fe8516f4ae448b66db2c8ad259b2fe
parent8cdda442357bc5c5ab673b6369ee1560ebe1b086 (diff)
Delay set picture if necessary
Normally this wouldn't happen as a new picture should come after webcore has initialized. However, now that a view state can be loaded, setting a new picture needs to be delayed until after everything has initialized. Change-Id: I823bc17eb939eab0436d7a398ebcbe849c0fb945
-rw-r--r--core/java/android/webkit/WebView.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 9e61ecf0413c..a68ca600f823 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -6503,6 +6503,8 @@ public class WebView extends AbsoluteLayout
// arrow key events, not trackball events, from one child to the next
private boolean mMapTrackballToArrowKeys = true;
+ private DrawData mDelaySetPicture;
+
public void setMapTrackballToArrowKeys(boolean setMap) {
checkThread();
mMapTrackballToArrowKeys = setMap;
@@ -7912,7 +7914,8 @@ public class WebView extends AbsoluteLayout
// after WebView's destroy() is called, skip handling messages.
return;
}
- if (mBlockWebkitViewMessages) {
+ if (mBlockWebkitViewMessages
+ && msg.what != WEBCORE_INITIALIZED_MSG_ID) {
// Blocking messages from webkit
return;
}
@@ -8060,6 +8063,10 @@ public class WebView extends AbsoluteLayout
BrowserFrame.DRAWABLEDIR, mContext);
AssetManager am = mContext.getAssets();
nativeCreate(msg.arg1, drawableDir, am);
+ if (mDelaySetPicture != null) {
+ setNewPicture(mDelaySetPicture);
+ mDelaySetPicture = null;
+ }
break;
case UPDATE_TEXTFIELD_TEXT_MSG_ID:
// Make sure that the textfield is currently focused
@@ -8371,6 +8378,15 @@ public class WebView extends AbsoluteLayout
}
void setNewPicture(final WebViewCore.DrawData draw) {
+ if (mNativeClass == 0) {
+ if (mDelaySetPicture != null) {
+ throw new IllegalStateException(
+ "Tried to setNewPicture with a delay picture already set! (memory leak)");
+ }
+ // Not initialized yet, delay set
+ mDelaySetPicture = draw;
+ return;
+ }
WebViewCore.ViewState viewState = draw.mViewState;
boolean isPictureAfterFirstLayout = viewState != null;
setBaseLayer(draw.mBaseLayer, draw.mInvalRegion,