diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-01-25 14:25:28 -0800 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2012-01-27 11:47:08 -0800 |
commit | e1dfe84b38ed080c7bb7ac00fd9e3c6c590a147d (patch) | |
tree | ebe3660dd305146b68dfd65a4c9579c6888ad44d /Source/WebKit/android/nav/WebView.cpp | |
parent | ce7f402c69fcd625a91611f47cd61d1baa3681b9 (diff) | |
download | external_webkit-e1dfe84b38ed080c7bb7ac00fd9e3c6c590a147d.zip external_webkit-e1dfe84b38ed080c7bb7ac00fd9e3c6c590a147d.tar.gz external_webkit-e1dfe84b38ed080c7bb7ac00fd9e3c6c590a147d.tar.bz2 |
Clean up tranfer queue before EGL context destroy
This will avoid ANR when texture generation thread is stuck b/c transfer queue
is running out of slots, at the same time, EGL context get destroyed and no
more draw call coming to free up more slots.
Abandon the surface texture will also help to be more memory friendly.
Move the highEndGfx check to TilesManager.
bug:5639899
Change-Id: I98f0289ae5ca18361f71dec853327223506e3073
Diffstat (limited to 'Source/WebKit/android/nav/WebView.cpp')
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 78881a9..6c49bb7 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -450,8 +450,9 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, return false; if (!m_glWebViewState) { + TilesManager::instance()->setHighEndGfx(m_isHighEndGfx); + m_glWebViewState = new GLWebViewState(); - m_glWebViewState->setHighEndGfx(m_isHighEndGfx); m_glWebViewState->glExtras()->setCursorRingExtra(&m_ring); m_glWebViewState->glExtras()->setFindOnPageExtra(&m_findOnPage); if (m_baseLayer->content()) { @@ -2640,6 +2641,14 @@ static jstring nativeGetProperty(JNIEnv *env, jobject obj, jstring jkey) static void nativeOnTrimMemory(JNIEnv *env, jobject obj, jint level) { if (TilesManager::hardwareAccelerationEnabled()) { + // When we got TRIM_MEMORY_MODERATE or TRIM_MEMORY_COMPLETE, we should + // make sure the transfer queue is empty and then abandon the Surface + // Texture to avoid ANR b/c framework may destroy the EGL context. + // Refer to WindowManagerImpl.java for conditions we followed. + if (level >= TRIM_MEMORY_MODERATE + && !TilesManager::instance()->highEndGfx()) + TilesManager::instance()->transferQueue()->emptyQueue(); + bool freeAllTextures = (level > TRIM_MEMORY_UI_HIDDEN), glTextures = true; TilesManager::instance()->discardTextures(freeAllTextures, glTextures); } |