summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2012-05-23 13:38:49 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-23 13:38:49 -0700
commita6645da2a8bfb194b7ee9c790f1da607e0e984c0 (patch)
treef4173b36fac46990e61c9f3daa503a9dc6c58f45 /Source/WebCore/platform/graphics/android
parent7f33cb9c658dd731469489f217b45b2316a214bc (diff)
parent6c4c0302dd154e5090966c57bb4b6b216644fb01 (diff)
downloadexternal_webkit-a6645da2a8bfb194b7ee9c790f1da607e0e984c0.zip
external_webkit-a6645da2a8bfb194b7ee9c790f1da607e0e984c0.tar.gz
external_webkit-a6645da2a8bfb194b7ee9c790f1da607e0e984c0.tar.bz2
Merge "Correctly handle the EGL context recreation." into jb-dev
Diffstat (limited to 'Source/WebCore/platform/graphics/android')
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp44
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TilesManager.h1
2 files changed, 21 insertions, 24 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
index 03ef714..0b4ba7b 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp
@@ -456,15 +456,26 @@ void TilesManager::cleanupGLResources()
void TilesManager::updateTilesIfContextVerified()
{
- if (updateContextIfChanged()) {
- // A change in EGL context is an unexpected error, but we don't want to
- // crash or ANR. Therefore, abandon the Surface Texture and GL resources;
- // they'll be recreated later in setupDrawing. (We can't delete them
- // since the context is gone)
- transferQueue()->resetQueue();
- shader()->forceNeedsInit();
- videoLayerManager()->forceNeedsInit();
- markAllGLTexturesZero();
+ EGLContext ctx = eglGetCurrentContext();
+ GLUtils::checkEglError("contextChanged");
+ if (ctx != m_eglContext) {
+ if (m_eglContext != EGL_NO_CONTEXT) {
+ // A change in EGL context is an unexpected error, but we don't want to
+ // crash or ANR. Therefore, abandon the Surface Texture and GL resources;
+ // they'll be recreated later in setupDrawing. (We can't delete them
+ // since the context is gone)
+ ALOGE("Unexpected : EGLContext changed! current %x , expected %x",
+ ctx, m_eglContext);
+ transferQueue()->resetQueue();
+ shader()->forceNeedsInit();
+ videoLayerManager()->forceNeedsInit();
+ markAllGLTexturesZero();
+ } else {
+ // This is the first time we went into this new EGL context.
+ // We will have the GL resources to be re-inited and we can't update
+ // dirty tiles yet.
+ ALOGD("new EGLContext from framework: %x ", ctx);
+ }
} else {
// Here before we draw, update the Tile which has updated content.
// Inside this function, just do GPU blits from the transfer queue into
@@ -473,21 +484,8 @@ void TilesManager::updateTilesIfContextVerified()
// Clean up GL textures for video layer.
videoLayerManager()->deleteUnusedTextures();
}
-}
-
-// Return true if context has changed, which indicate an error we should look
-// into.
-bool TilesManager::updateContextIfChanged()
-{
- bool changed = false;
- EGLContext ctx = eglGetCurrentContext();
- GLUtils::checkEglError("contextChanged");
- if (ctx != m_eglContext && m_eglContext != EGL_NO_CONTEXT) {
- ALOGE("Unexpected : EGLContext changed! current %x , expected %x", ctx, m_eglContext);
- changed = true;
- }
m_eglContext = ctx;
- return changed;
+ return;
}
int TilesManager::tileWidth()
diff --git a/Source/WebCore/platform/graphics/android/rendering/TilesManager.h b/Source/WebCore/platform/graphics/android/rendering/TilesManager.h
index ce5904f..f0d2eac 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TilesManager.h
+++ b/Source/WebCore/platform/graphics/android/rendering/TilesManager.h
@@ -173,7 +173,6 @@ private:
bool deallocateGLTextures);
void dirtyTexturesVector(WTF::Vector<TileTexture*>& textures);
void markAllGLTexturesZero();
- bool updateContextIfChanged();
int getMaxTextureAllocation();
WTF::Vector<TileTexture*> m_textures;