diff options
author | Nicolas Roard <nicolas@android.com> | 2011-01-23 15:01:19 -0800 |
---|---|---|
committer | Nicolas Roard <nicolas@android.com> | 2011-01-23 15:22:37 -0800 |
commit | 245e0cdd9ea80915059080a2bedbb9ebb5cc646c (patch) | |
tree | 54c5301592a888869aa712582d00da3bfb476336 /WebCore/platform/graphics/android/GLWebViewState.cpp | |
parent | f0425628b4e83bf9e1c8275d809d433baeaf768c (diff) | |
download | external_webkit-245e0cdd9ea80915059080a2bedbb9ebb5cc646c.zip external_webkit-245e0cdd9ea80915059080a2bedbb9ebb5cc646c.tar.gz external_webkit-245e0cdd9ea80915059080a2bedbb9ebb5cc646c.tar.bz2 |
Implement tiles synchronization
When a tiledPage is painted, we want to avoid updating the base
layer. GLWebViewState and WebView.cpp are now refcounting the
base layer, delaying updating the base layer we use to paint
until we are done with a full tile paint.
bug:3224744
Change-Id: Ica2b8f1db146a1e059fc0735dc53107fc40da07a
Diffstat (limited to 'WebCore/platform/graphics/android/GLWebViewState.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/GLWebViewState.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp index 45915e5..326f360 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -70,11 +70,14 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex) , m_updateTime(-1) , m_transitionTime(-1) , m_baseLayer(0) + , m_currentBaseLayer(0) , m_currentPictureCounter(0) , m_usePageA(true) , m_globalButtonMutex(buttonMutex) + , m_baseLayerUpdate(true) { m_viewport.setEmpty(); + m_previousViewport.setEmpty(); m_futureViewportTileBounds.setEmpty(); m_viewportTileBounds.setEmpty(); m_preZoomBounds.setEmpty(); @@ -88,6 +91,7 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex) GLWebViewState::~GLWebViewState() { + m_currentBaseLayer->safeUnref(); delete m_tiledPageA; delete m_tiledPageB; #ifdef DEBUG_COUNT @@ -107,10 +111,30 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect) m_baseLayer = layer; if (m_baseLayer) { m_baseLayer->setGLWebViewState(this); + } + // We only update the layers if we are not currently + // waiting for a tiledPage to be painted + if (m_baseLayerUpdate) { + m_currentBaseLayer->safeUnref(); + m_currentBaseLayer = layer; + m_currentBaseLayer->safeRef(); inval(rect); + } else { + m_invalidateRect.unite(rect); } } +void GLWebViewState::unlockBaseLayerUpdate() { + m_baseLayerUpdate = true; + android::Mutex::Autolock lock(m_baseLayerLock); + m_currentBaseLayer->safeUnref(); + m_currentBaseLayer = m_baseLayer; + m_currentBaseLayer->safeRef(); + inval(m_invalidateRect); + IntRect empty; + m_invalidateRect = empty; +} + void GLWebViewState::setExtra(BaseLayerAndroid* layer, SkPicture& picture, const IntRect& rect) { @@ -136,9 +160,9 @@ void GLWebViewState::inval(const IntRect& rect) unsigned int GLWebViewState::paintBaseLayerContent(SkCanvas* canvas) { android::Mutex::Autolock lock(m_baseLayerLock); - if (m_baseLayer) { + if (m_currentBaseLayer) { m_globalButtonMutex->lock(); - m_baseLayer->drawCanvas(canvas); + m_currentBaseLayer->drawCanvas(canvas); m_globalButtonMutex->unlock(); } return m_currentPictureCounter; @@ -189,6 +213,11 @@ float GLWebViewState::transparency(double currentTime) return fmin(1, fmax(0, t)); } +TiledPage* GLWebViewState::sibling(TiledPage* page) +{ + return (page == m_tiledPageA) ? m_tiledPageB : m_tiledPageA; +} + TiledPage* GLWebViewState::frontPage() { android::Mutex::Autolock lock(m_tiledPageLock); @@ -213,16 +242,17 @@ void GLWebViewState::swapPages() int GLWebViewState::baseContentWidth() { - return m_baseLayer ? m_baseLayer->getWidth() : 0; + return m_currentBaseLayer ? m_currentBaseLayer->getWidth() : 0; } int GLWebViewState::baseContentHeight() { - return m_baseLayer ? m_baseLayer->getHeight() : 0; + return m_currentBaseLayer ? m_currentBaseLayer->getHeight() : 0; } void GLWebViewState::setViewport(SkRect& viewport, float scale) { + m_previousViewport = m_viewport; if (m_viewport == viewport) return; |