diff options
-rw-r--r-- | WebCore/platform/graphics/android/BaseTile.cpp | 3 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TexturesGenerator.cpp | 54 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TexturesGenerator.h | 8 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TileSet.h | 7 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TiledPage.cpp | 12 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TilesManager.h | 5 | ||||
-rw-r--r-- | WebKit/Android.mk | 4 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp | 4 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h | 1 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp | 7 | ||||
-rw-r--r-- | WebKit/android/jni/CookieManager.cpp | 13 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 16 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 2 |
13 files changed, 104 insertions, 32 deletions
diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp index b72cb6d..47a154c 100644 --- a/WebCore/platform/graphics/android/BaseTile.cpp +++ b/WebCore/platform/graphics/android/BaseTile.cpp @@ -79,8 +79,6 @@ BaseTile::BaseTile(TiledPage* page, int x, int y) BaseTile::~BaseTile() { - removeTexture(); - setUsedLevel(-1); #ifdef DEBUG_COUNT gBaseTileCount--; #endif @@ -144,6 +142,7 @@ bool BaseTile::isBitmapReady() // Called from the texture generation thread bool BaseTile::paintBitmap() { + XLOG("paintBitmap(%x) %d, %d with page %x", this, m_x, m_y, m_page); // the mutex ensures you are reading the most current value m_varLock.lock(); const int x = m_x; diff --git a/WebCore/platform/graphics/android/TexturesGenerator.cpp b/WebCore/platform/graphics/android/TexturesGenerator.cpp index 1b8baa0..f81a297 100644 --- a/WebCore/platform/graphics/android/TexturesGenerator.cpp +++ b/WebCore/platform/graphics/android/TexturesGenerator.cpp @@ -69,6 +69,36 @@ void TexturesGenerator::schedulePaintForTileSet(TileSet* set) m_newRequestLock.unlock(); } +void TexturesGenerator::removeSetsWithPage(TiledPage* page) +{ + mRequestedPixmapsLock.lock(); + typedef Vector<TileSet*>::const_iterator iterator; + iterator end = mRequestedPixmaps.end(); + for (iterator it = mRequestedPixmaps.begin(); it != end; ++it) { + TileSet* set = static_cast<TileSet*>(*it); + if (set->page() == page) + delete *it; + } + TileSet* set = m_currentSet; + if (set && set->page() != page) + set = 0; + if (set) + m_waitForCompletion = true; + mRequestedPixmapsLock.unlock(); + + if (!set) + return; + + // At this point, it means that we are currently painting a set that + // we want to be removed -- we should wait until it is painted, so that + // when we return our caller can be sure that there is no more TileSet + // in the queue for that TiledPage and can safely deallocate the BaseTiles. + mRequestedPixmapsLock.lock(); + mRequestedPixmapsCond.wait(mRequestedPixmapsLock); + m_waitForCompletion = false; + mRequestedPixmapsLock.unlock(); +} + status_t TexturesGenerator::readyToRun() { TilesManager::instance()->enableTextures(); @@ -88,25 +118,29 @@ bool TexturesGenerator::threadLoop() m_newRequestLock.unlock(); XLOG("threadLoop, got signal"); + m_currentSet = 0; bool stop = false; while (!stop) { mRequestedPixmapsLock.lock(); - TileSet* set = 0; - if (mRequestedPixmaps.size()) - set = mRequestedPixmaps.first(); - mRequestedPixmapsLock.unlock(); - - if (set) { - set->paint(); - mRequestedPixmapsLock.lock(); + if (mRequestedPixmaps.size()) { + m_currentSet = mRequestedPixmaps.first(); mRequestedPixmaps.remove(0); - mRequestedPixmapsLock.unlock(); - delete set; } + mRequestedPixmapsLock.unlock(); + + if (m_currentSet) + m_currentSet->paint(); mRequestedPixmapsLock.lock(); + if (m_currentSet) { + delete m_currentSet; + m_currentSet = 0; + mRequestedPixmapsCond.signal(); + } if (!mRequestedPixmaps.size()) stop = true; + if (m_waitForCompletion) + mRequestedPixmapsCond.signal(); mRequestedPixmapsLock.unlock(); } diff --git a/WebCore/platform/graphics/android/TexturesGenerator.h b/WebCore/platform/graphics/android/TexturesGenerator.h index 4d94705..8e64b27 100644 --- a/WebCore/platform/graphics/android/TexturesGenerator.h +++ b/WebCore/platform/graphics/android/TexturesGenerator.h @@ -28,6 +28,7 @@ #if USE(ACCELERATED_COMPOSITING) +#include "TiledPage.h" #include "TileSet.h" #include <utils/threads.h> @@ -37,18 +38,23 @@ using namespace android; class TexturesGenerator : public Thread { public: - TexturesGenerator() : Thread() { } + TexturesGenerator() : Thread() + , m_waitForCompletion(false) { } virtual ~TexturesGenerator() { } virtual status_t readyToRun(); void schedulePaintForTileSet(TileSet* set); + void removeSetsWithPage(TiledPage* page); private: virtual bool threadLoop(); Vector<TileSet*> mRequestedPixmaps; android::Mutex mRequestedPixmapsLock; + android::Condition mRequestedPixmapsCond; android::Mutex m_newRequestLock; android::Condition m_newRequestCond; + TileSet* m_currentSet; + bool m_waitForCompletion; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/android/TileSet.h b/WebCore/platform/graphics/android/TileSet.h index d6d4aec..adf6d13 100644 --- a/WebCore/platform/graphics/android/TileSet.h +++ b/WebCore/platform/graphics/android/TileSet.h @@ -57,6 +57,13 @@ public: m_tiles.append(texture); } + TiledPage* page() + { + if (m_tiles.size()) + return m_tiles[0]->page(); + return 0; + } + private: Vector<BaseTile*> m_tiles; diff --git a/WebCore/platform/graphics/android/TiledPage.cpp b/WebCore/platform/graphics/android/TiledPage.cpp index db87224..f52c2f9 100644 --- a/WebCore/platform/graphics/android/TiledPage.cpp +++ b/WebCore/platform/graphics/android/TiledPage.cpp @@ -60,7 +60,16 @@ TiledPage::TiledPage(int id, GLWebViewState* state) } TiledPage::~TiledPage() { - deleteAllValues(m_baseTiles); + // Stop any pixmap generation + if (m_baseTiles.size()) { + TilesManager::instance()->removeSetsWithPage(this); + } + m_glWebViewState = 0; + // At this point, we can safely deallocate the BaseTiles, as + // there is no more BaseTile painting or scheduled to be painted + // by the TextureGenerator, and as we did reset the BaseLayer in GLWebViewState, + // in WebView's destructor (so no additional painting can be scheduled) + deleteAllValues(m_baseTiles); } BaseTile* TiledPage::getBaseTile(int x, int y) @@ -164,7 +173,6 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, int firstTileX, int firs nbTilesWidth, nbTilesHeight, firstTileX, firstTileY, this); TilesManager::instance()->printTextures(); #endif // DEBUG - highResSet->reserveTextures(); #ifdef DEBUG diff --git a/WebCore/platform/graphics/android/TilesManager.h b/WebCore/platform/graphics/android/TilesManager.h index 8e6ba1b..1f9cd38 100644 --- a/WebCore/platform/graphics/android/TilesManager.h +++ b/WebCore/platform/graphics/android/TilesManager.h @@ -48,6 +48,11 @@ public: m_pixmapsGenerationThread->schedulePaintForTileSet(set); } + void removeSetsWithPage(TiledPage* page) + { + m_pixmapsGenerationThread->removeSetsWithPage(page); + } + ShaderProgram* shader() { return &m_shader; } BackedDoubleBufferedTexture* getAvailableTexture(BaseTile* owner); diff --git a/WebKit/Android.mk b/WebKit/Android.mk index e640e02..7906da3 100644 --- a/WebKit/Android.mk +++ b/WebKit/Android.mk @@ -38,8 +38,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ android/WebCoreSupport/WebRequest.cpp \ android/WebCoreSupport/WebRequestContext.cpp \ android/WebCoreSupport/WebResourceRequest.cpp \ - android/WebCoreSupport/WebResponse.cpp \ - android/jni/CookieManager.cpp + android/WebCoreSupport/WebResponse.cpp else LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ android/WebCoreSupport/ResourceLoaderAndroid.cpp @@ -58,6 +57,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ android/icu/unicode/ucnv.cpp \ \ + android/jni/CookieManager.cpp \ android/jni/DeviceMotionAndOrientationManager.cpp \ android/jni/DeviceMotionClientImpl.cpp \ android/jni/DeviceOrientationClientImpl.cpp \ diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index 3268677..a796084 100644 --- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -201,10 +201,6 @@ bool FrameLoaderClientAndroid::dispatchDidLoadResourceFromMemoryCache(DocumentLo return false; } -void FrameLoaderClientAndroid::dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const ScriptString&) { - return; -} - void FrameLoaderClientAndroid::dispatchDidHandleOnloadEvents() { } diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h index eb0c26e..b40f645 100644 --- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h +++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h @@ -76,7 +76,6 @@ namespace android { virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier); virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&); virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length); - virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const ScriptString&); virtual void dispatchDidHandleOnloadEvents(); virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); diff --git a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp index 96ee9f6..26c377e 100644 --- a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp +++ b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp @@ -49,13 +49,18 @@ namespace android { +static URLRequestContext* WebAutoFillContextGetter() +{ + return WebRequestContext::GetContext(false /* isPrivateBrowsing */); +} + WebAutoFill::WebAutoFill() : mWebViewCore(0) { mFormManager = new FormManager(); mQueryId = 1; - AndroidURLRequestContextGetter::Get()->SetURLRequestContextGetterFunction(&WebRequestContext::GetContext); + AndroidURLRequestContextGetter::Get()->SetURLRequestContextGetterFunction(&WebAutoFillContextGetter); AndroidURLRequestContextGetter::Get()->SetIOThread(WebUrlLoaderClient::ioThread()); mTabContents = new TabContents(); mAutoFillManager = new AutoFillManager(mTabContents.get()); diff --git a/WebKit/android/jni/CookieManager.cpp b/WebKit/android/jni/CookieManager.cpp index 9672160..89f9a4f 100644 --- a/WebKit/android/jni/CookieManager.cpp +++ b/WebKit/android/jni/CookieManager.cpp @@ -36,7 +36,16 @@ namespace android { // JNI for android.webkit.CookieManager static const char* javaCookieManagerClass = "android/webkit/CookieManager"; -static void removeAllCookie(JNIEnv* env, jobject) { +static bool useChromiumHttpStack(JNIEnv*, jobject) { +#if USE(CHROME_NETWORK_STACK) + return true; +#else + return false; +#endif +} + +static void removeAllCookie(JNIEnv*, jobject) { +#if USE(CHROME_NETWORK_STACK) WebRequestContext::GetContext(false)->cookie_store()->GetCookieMonster()->DeleteAllCreatedAfter(Time(), true); // This will lazily create a new private browsing context. However, if the // context doesn't already exist, there's no need to create it, as cookies @@ -44,9 +53,11 @@ static void removeAllCookie(JNIEnv* env, jobject) { // TODO: Consider adding an optimisation to not create the context if it // doesn't already exist. WebRequestContext::GetContext(true)->cookie_store()->GetCookieMonster()->DeleteAllCreatedAfter(Time(), true); +#endif } static JNINativeMethod gCookieManagerMethods[] = { + { "nativeUseChromiumHttpStack", "()Z", (void*) useChromiumHttpStack }, { "nativeRemoveAllCookie", "()V", (void*) removeAllCookie }, }; diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index fe0563a..f56b916 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1094,10 +1094,10 @@ void WebViewCore::doMaxScroll(CacheBuilder::Direction dir) this->scrollBy(dx, dy, true); } -void WebViewCore::setScrollOffset(int moveGeneration, int dx, int dy) +void WebViewCore::setScrollOffset(int moveGeneration, int userScrolled, int dx, int dy) { - DBG_NAV_LOGD("{%d,%d} m_scrollOffset=(%d,%d)", dx, dy, - m_scrollOffsetX, m_scrollOffsetY); + DBG_NAV_LOGD("{%d,%d} m_scrollOffset=(%d,%d), userScrolled=%d", dx, dy, + m_scrollOffsetX, m_scrollOffsetY, userScrolled); if (m_scrollOffsetX != dx || m_scrollOffsetY != dy) { m_scrollOffsetX = dx; m_scrollOffsetY = dy; @@ -1106,7 +1106,9 @@ void WebViewCore::setScrollOffset(int moveGeneration, int dx, int dy) // testing work correctly. m_mainFrame->view()->platformWidget()->setLocation(m_scrollOffsetX, m_scrollOffsetY); - m_mainFrame->eventHandler()->sendScrollEvent(); + if (userScrolled) { + m_mainFrame->eventHandler()->sendScrollEvent(); + } // update the currently visible screen sendPluginVisibleScreen(); @@ -3338,7 +3340,7 @@ static void SetSize(JNIEnv *env, jobject obj, jint width, jint height, screenWidth, screenHeight, anchorX, anchorY, ignoreHeight); } -static void SetScrollOffset(JNIEnv *env, jobject obj, jint gen, jint x, jint y) +static void SetScrollOffset(JNIEnv *env, jobject obj, jint gen, jint userScrolled, jint x, jint y) { #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); @@ -3346,7 +3348,7 @@ static void SetScrollOffset(JNIEnv *env, jobject obj, jint gen, jint x, jint y) WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "need viewImpl"); - viewImpl->setScrollOffset(gen, x, y); + viewImpl->setScrollOffset(gen, userScrolled, x, y); } static void SetGlobalBounds(JNIEnv *env, jobject obj, jint x, jint y, jint h, @@ -3977,7 +3979,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) SendListBoxChoice }, { "nativeSetSize", "(IIIFIIIIZ)V", (void*) SetSize }, - { "nativeSetScrollOffset", "(III)V", + { "nativeSetScrollOffset", "(IIII)V", (void*) SetScrollOffset }, { "nativeSetGlobalBounds", "(IIII)V", (void*) SetGlobalBounds }, diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 2ff517f..eac7e6e 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -300,7 +300,7 @@ namespace android { WebCore::Frame* frame, int x, int y); // set the scroll amount that webview.java is currently showing - void setScrollOffset(int moveGeneration, int dx, int dy); + void setScrollOffset(int moveGeneration, int userScrolled, int dx, int dy); void setGlobalBounds(int x, int y, int h, int v); |