diff options
13 files changed, 63 insertions, 30 deletions
diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp index 02168a9..ced0c2e 100644 --- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp +++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp @@ -25,8 +25,9 @@ #include "config.h" #include "BackedDoubleBufferedTexture.h" - #include "BaseTile.h" +#include "DeleteTextureOperation.h" +#include "TilesManager.h" #include "GLUtils.h" #define LOG_NDEBUG 1 @@ -54,6 +55,23 @@ BackedDoubleBufferedTexture::~BackedDoubleBufferedTexture() delete m_canvas; } +void BackedDoubleBufferedTexture::onDestroy(SharedTexture** textures) +{ + int x = 0; + while (textures[x] != 0) { + // We need to delete the source texture and EGLImage in the texture + // generation thread. In theory we should be able to delete the EGLImage + // from either thread, but it currently throws an error if not deleted + // in the same EGLContext from which it was created. + textures[x]->lock(); + DeleteTextureOperation* operation = new DeleteTextureOperation( + textures[x]->getSourceTextureId(), textures[x]->getEGLImage()); + textures[x]->unlock(); + TilesManager::instance()->scheduleOperation(operation); + x++; + } +} + TextureInfo* BackedDoubleBufferedTexture::producerLock() { m_busyLock.lock(); diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h index b07cdd1..76b9f36 100644 --- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h +++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.h @@ -75,6 +75,9 @@ public: // This is to be only used for debugging on the producer thread bool busy() { return m_busy; } +protected: + virtual void onDestroy(SharedTexture** textures); + private: SkBitmap m_bitmap; SkCanvas* m_canvas; diff --git a/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp index 31a1186..a3ae5ab 100644 --- a/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp +++ b/WebCore/platform/graphics/android/DoubleBufferedTexture.cpp @@ -58,6 +58,8 @@ DoubleBufferedTexture::DoubleBufferedTexture(EGLContext sharedContext) DoubleBufferedTexture::~DoubleBufferedTexture() { + SharedTexture* textures[3] = { &m_textureA, &m_textureB, 0 }; + onDestroy(textures); #ifdef DEBUG_COUNT gDoubleBufferedTextureCount--; #endif diff --git a/WebCore/platform/graphics/android/DoubleBufferedTexture.h b/WebCore/platform/graphics/android/DoubleBufferedTexture.h index 2b2fd03..c028302 100644 --- a/WebCore/platform/graphics/android/DoubleBufferedTexture.h +++ b/WebCore/platform/graphics/android/DoubleBufferedTexture.h @@ -50,6 +50,12 @@ public: TextureInfo* consumerLock(); void consumerRelease(); +protected: + // enables sub-classes to signal the provider thread that the consumer is + // being deleted and therefore should clean up any producer specific + // textures or EGLImages + virtual void onDestroy(SharedTexture** textures) { }; + private: SharedTexture* getReadableTexture(); SharedTexture* getWriteableTexture(); diff --git a/WebCore/platform/graphics/android/SharedTexture.cpp b/WebCore/platform/graphics/android/SharedTexture.cpp index 56f9279..16ec97f 100644 --- a/WebCore/platform/graphics/android/SharedTexture.cpp +++ b/WebCore/platform/graphics/android/SharedTexture.cpp @@ -24,9 +24,7 @@ */ #include "config.h" -#include "DeleteTextureOperation.h" #include "SharedTexture.h" -#include "TilesManager.h" #include "GLUtils.h" #define LOG_NDEBUG 1 @@ -73,16 +71,12 @@ SharedTexture::SharedTexture() { } // called by the consumer when it no longer wants to consume and after it has -// terminated all providers. If EGLImages are used, we schedule a delete -// operation (see DeleteTextureOperation.h) to the textures generation thread. +// terminated all providers. If EGLImages are used, the deletion of the +// source texture and EGLImage is the responsibility of the caller. In the case +// of double buffered textures this is handled in the onDestroy(...) method. SharedTexture::~SharedTexture() { if (m_supportsEGLImage) { GLUtils::deleteTexture(&m_targetTexture.m_textureId); - // We need to delete the EGLImage and the source texture - // in the textures generation thread. - DeleteTextureOperation* operation = new DeleteTextureOperation( - m_sourceTexture.m_textureId, m_eglImage); - TilesManager::instance()->scheduleOperation(operation); } else { GLUtils::deleteTexture(&m_sourceTexture.m_textureId); } diff --git a/WebCore/platform/graphics/android/SharedTexture.h b/WebCore/platform/graphics/android/SharedTexture.h index dc5dfd3..581ad77 100644 --- a/WebCore/platform/graphics/android/SharedTexture.h +++ b/WebCore/platform/graphics/android/SharedTexture.h @@ -82,6 +82,7 @@ public: void initSourceTexture(); // producer thread only GLuint getSourceTextureId() { return m_sourceTexture.m_textureId; } GLuint getTargetTextureId() { return m_targetTexture.m_textureId; } + EGLImageKHR getEGLImage() { return m_eglImage; } private: /** diff --git a/WebCore/platform/graphics/android/TexturesGenerator.cpp b/WebCore/platform/graphics/android/TexturesGenerator.cpp index 836dd64..26090b0 100644 --- a/WebCore/platform/graphics/android/TexturesGenerator.cpp +++ b/WebCore/platform/graphics/android/TexturesGenerator.cpp @@ -29,7 +29,6 @@ #if USE(ACCELERATED_COMPOSITING) #include "GLUtils.h" -#include "PaintTileSetOperation.h" #include "TilesManager.h" #ifdef DEBUG @@ -50,12 +49,6 @@ namespace WebCore { -void TexturesGenerator::schedulePaintForTileSet(TileSet* set) -{ - PaintTileSetOperation* operation = new PaintTileSetOperation(set); - scheduleOperation(operation); -} - void TexturesGenerator::scheduleOperation(QueuedOperation* operation) { android::Mutex::Autolock lock(mRequestedOperationsLock); diff --git a/WebCore/platform/graphics/android/TexturesGenerator.h b/WebCore/platform/graphics/android/TexturesGenerator.h index 573d94f..ae02d14 100644 --- a/WebCore/platform/graphics/android/TexturesGenerator.h +++ b/WebCore/platform/graphics/android/TexturesGenerator.h @@ -44,7 +44,6 @@ public: virtual ~TexturesGenerator() { } virtual status_t readyToRun(); - void schedulePaintForTileSet(TileSet* set); void removeOperationsForPage(TiledPage* page); void scheduleOperation(QueuedOperation* operation); diff --git a/WebCore/platform/graphics/android/TiledPage.cpp b/WebCore/platform/graphics/android/TiledPage.cpp index 815fda0..3a08f9b 100644 --- a/WebCore/platform/graphics/android/TiledPage.cpp +++ b/WebCore/platform/graphics/android/TiledPage.cpp @@ -30,6 +30,7 @@ #include "GLUtils.h" #include "IntRect.h" +#include "PaintTileSetOperation.h" #include "TilesManager.h" #ifdef DEBUG @@ -270,9 +271,10 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound prepareRow(goingLeft, nbTilesWidth, firstTileX, firstTileY + i, highResSet); } - // schedulePaintForTileSet will take ownership of the highResSet here, - // so no delete necessary. - TilesManager::instance()->schedulePaintForTileSet(highResSet); + // The paint operation will take ownership of the tileSet here, so no delete + // is necessary. + PaintTileSetOperation* operation = new PaintTileSetOperation(highResSet); + TilesManager::instance()->scheduleOperation(operation); } bool TiledPage::ready(const SkIRect& tileBounds) diff --git a/WebCore/platform/graphics/android/TilesManager.h b/WebCore/platform/graphics/android/TilesManager.h index 1a3eb05..f855738 100644 --- a/WebCore/platform/graphics/android/TilesManager.h +++ b/WebCore/platform/graphics/android/TilesManager.h @@ -43,11 +43,6 @@ class TilesManager { public: static TilesManager* instance(); - void schedulePaintForTileSet(TileSet* set) - { - m_pixmapsGenerationThread->schedulePaintForTileSet(set); - } - void removeOperationsForPage(TiledPage* page) { m_pixmapsGenerationThread->removeOperationsForPage(page); diff --git a/WebKit/android/WebCoreSupport/WebResponse.h b/WebKit/android/WebCoreSupport/WebResponse.h index 84a93ab..f03e4bb 100644 --- a/WebKit/android/WebCoreSupport/WebResponse.h +++ b/WebKit/android/WebCoreSupport/WebResponse.h @@ -71,7 +71,15 @@ private: std::string m_mime; std::string m_url; - std::map<std::string, std::string> m_headerFields; + struct CaseInsensitiveLessThan { + bool operator()(const std::string& lhs, const std::string& rhs) const { + return strcasecmp(lhs.c_str(), rhs.c_str()) < 0; + } + }; + + // Header fields are case insensitive, so we use a case-insensitive map. + // See RFC 822, 3.4.7, "CASE INDEPENDENCE". + std::map<std::string, std::string, CaseInsensitiveLessThan> m_headerFields; void setMimeType(const std::string &mimeType); }; diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 228c16b..c62ae0e 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1346,9 +1346,15 @@ WebCore::HTMLAnchorElement* WebViewCore::retrieveAnchorElement(int x, int y) return 0; } Node* node = hitTestResult.innerNode(); - if (!node->hasTagName(WebCore::HTMLNames::aTag)) + Node* element = node; + while (element && !element->isElementNode()) + element = element->parentNode(); + DBG_NAV_LOGD("node=%p element=%p x=%d y=%d nodeName=%s tagName=%s", node, + element, x, y, node->nodeName().utf8().data(), + ((Element*) element)->tagName().utf8().data()); + if (!element->hasTagName(WebCore::HTMLNames::aTag)) return 0; - return static_cast<WebCore::HTMLAnchorElement*>(node); + return static_cast<WebCore::HTMLAnchorElement*>(element); } WTF::String WebViewCore::retrieveHref(int x, int y) diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index e8bd0da..c5ed5e5 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -231,6 +231,12 @@ void hideCursor() if (!root) return; DBG_NAV_LOG(""); + hideCursor(root); +} + +void hideCursor(CachedRoot* root) +{ + DBG_NAV_LOG("inner"); m_viewImpl->m_hasCursorBounds = false; root->hideCursor(); viewInvalidate(); @@ -405,7 +411,7 @@ void drawCursorPostamble() invalBounds.intersect(m_ring.m_absBounds); postInvalidateDelayed(m_ringAnimationEnd - time, invalBounds); } else { - hideCursor(); + hideCursor(const_cast<CachedRoot*>(m_ring.m_root)); } } |