diff options
author | Cary Clark <cary@android.com> | 2011-01-19 09:58:30 -0500 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2011-01-19 12:30:25 -0500 |
commit | f3cef498906fce0a2d7787f7475f6df232baaead (patch) | |
tree | 6cacb5b6460ab5d63c219320739ad7e8153940f7 | |
parent | 07f392a57e45b228e53dd45cb7bd464edde5e23d (diff) | |
download | external_webkit-f3cef498906fce0a2d7787f7475f6df232baaead.zip external_webkit-f3cef498906fce0a2d7787f7475f6df232baaead.tar.gz external_webkit-f3cef498906fce0a2d7787f7475f6df232baaead.tar.bz2 |
don't draw buttons while they are created
There are three threads all hammering at the same resource.
The WebViewCore thread records the buttons on the page.
The WebView thread rerecords the button pictures to show selection and focus.
The GLWebViewState thread draws the picture containing the button pictures
into the tile.
Prevent drawing the picture while the buttons are recorded
by sharing the button mutext with the GL tile creation.
bug:3354678
Change-Id: I245ed47ad5a6d1fe28ea870bd7c557937eed1164
-rw-r--r-- | WebCore/platform/graphics/android/GLWebViewState.cpp | 8 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GLWebViewState.h | 3 | ||||
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp index 1c32848..45915e5 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -63,7 +63,7 @@ int GLWebViewState::count() } #endif -GLWebViewState::GLWebViewState() +GLWebViewState::GLWebViewState(android::Mutex* buttonMutex) : m_scaleRequestState(kNoScaleRequest) , m_currentScale(1) , m_futureScale(1) @@ -72,6 +72,7 @@ GLWebViewState::GLWebViewState() , m_baseLayer(0) , m_currentPictureCounter(0) , m_usePageA(true) + , m_globalButtonMutex(buttonMutex) { m_viewport.setEmpty(); m_futureViewportTileBounds.setEmpty(); @@ -135,8 +136,11 @@ void GLWebViewState::inval(const IntRect& rect) unsigned int GLWebViewState::paintBaseLayerContent(SkCanvas* canvas) { android::Mutex::Autolock lock(m_baseLayerLock); - if (m_baseLayer) + if (m_baseLayer) { + m_globalButtonMutex->lock(); m_baseLayer->drawCanvas(canvas); + m_globalButtonMutex->unlock(); + } return m_currentPictureCounter; } diff --git a/WebCore/platform/graphics/android/GLWebViewState.h b/WebCore/platform/graphics/android/GLWebViewState.h index c627a6e..8d2216e 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.h +++ b/WebCore/platform/graphics/android/GLWebViewState.h @@ -152,7 +152,7 @@ public: }; typedef int32_t GLScaleState; - GLWebViewState(); + GLWebViewState(android::Mutex* globalButtonMutex); ~GLWebViewState(); GLScaleState scaleRequestState() const { return m_scaleRequestState; } void setScaleRequestState(GLScaleState state) { m_scaleRequestState = state; } @@ -222,6 +222,7 @@ private: TiledPage* m_tiledPageA; TiledPage* m_tiledPageB; SkIRect m_lastInval; + android::Mutex* m_globalButtonMutex; }; } // namespace WebCore diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 4c4d6b5..2b1e854 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -425,7 +425,7 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras) return false; if (!m_glWebViewState) { - m_glWebViewState = new GLWebViewState(); + m_glWebViewState = new GLWebViewState(&m_viewImpl->gButtonMutex); if (m_baseLayer->content()) { IntRect rect(0, 0, m_baseLayer->content()->width(), m_baseLayer->content()->height()); m_glWebViewState->setBaseLayer(m_baseLayer, rect); |