diff options
Diffstat (limited to 'Source')
8 files changed, 35 insertions, 66 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index d62f88b..be9f458 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -296,11 +296,10 @@ void GraphicsLayerAndroid::setPosition(const FloatPoint& point) GraphicsLayer::setPosition(point); -#ifdef LAYER_DEBUG_2 ALOGV("(%x) setPosition(%.2f,%.2f) pos(%.2f, %.2f) anchor(%.2f,%.2f) size(%.2f, %.2f)", this, point.x(), point.y(), m_position.x(), m_position.y(), m_anchorPoint.x(), m_anchorPoint.y(), m_size.width(), m_size.height()); -#endif + m_contentLayer->setPosition(point.x(), point.y()); askForSync(); } diff --git a/Source/WebCore/platform/graphics/android/TextureOwner.h b/Source/WebCore/platform/graphics/android/TextureOwner.h index 58ddca2..b12d8b7 100644 --- a/Source/WebCore/platform/graphics/android/TextureOwner.h +++ b/Source/WebCore/platform/graphics/android/TextureOwner.h @@ -38,7 +38,6 @@ class TextureOwner { public: virtual ~TextureOwner() { } virtual bool removeTexture(TileTexture* texture) = 0; - virtual bool samePageAs(Layer* root) { return false; } virtual bool isRepaintPending() = 0; virtual unsigned long long drawCount() = 0; }; diff --git a/Source/WebCore/platform/graphics/android/Tile.cpp b/Source/WebCore/platform/graphics/android/Tile.cpp index 309255e..35fded1 100644 --- a/Source/WebCore/platform/graphics/android/Tile.cpp +++ b/Source/WebCore/platform/graphics/android/Tile.cpp @@ -56,7 +56,6 @@ Tile::Tile(bool isLayerTile) , m_dirty(true) , m_repaintPending(false) , m_fullRepaint(true) - , m_isTexturePainted(false) , m_isLayerTile(isLayerTile) , m_drawCount(0) , m_state(Unpainted) @@ -123,8 +122,8 @@ void Tile::reserveTexture() bool Tile::removeTexture(TileTexture* texture) { - ALOGV("%p removeTexture %p, back %p front %p... page %p", - this, texture, m_backTexture, m_frontTexture, m_page); + ALOGV("%p removeTexture %p, back %p front %p", + this, texture, m_backTexture, m_frontTexture); // We update atomically, so paintBitmap() can see the correct value android::AutoMutex lock(m_atomicSync); if (m_frontTexture == texture) { @@ -181,8 +180,8 @@ void Tile::markAsDirty(const SkRegion& dirtyArea) } else if (m_state != Unpainted) { // TODO: fix it so that they can paint while deferring the markAsDirty // call (or block updates) - ALOGV("Warning: tried to mark tile %p at %d, %d islayertile %d as dirty, state %d, page %p", - this, m_x, m_y, isLayerTile(), m_state, m_page); + ALOGV("Warning: tried to mark tile %p at %d, %d islayertile %d as dirty, state %d", + this, m_x, m_y, isLayerTile(), m_state); // prefetch tiles can be marked dirty while in the process of painting, // due to not using an update lock. force them to fail validate step. @@ -220,14 +219,6 @@ bool Tile::drawGL(float opacity, const SkRect& rect, float scale, if (!m_frontTexture) return false; - // Early return if set to un-usable in purpose! - m_atomicSync.lock(); - bool isTexturePainted = m_isTexturePainted; - m_atomicSync.unlock(); - - if (!isTexturePainted) - return false; - m_frontTexture->drawGL(isLayerTile(), rect, opacity, transform, forceBlending); return true; } @@ -401,8 +392,6 @@ void Tile::paintBitmap(TilePainter* painter) m_atomicSync.lock(); if (texture == m_backTexture) { - m_isTexturePainted = true; - // set the fullrepaint flags m_fullRepaint = false; diff --git a/Source/WebCore/platform/graphics/android/Tile.h b/Source/WebCore/platform/graphics/android/Tile.h index c60a0d5..7010301 100644 --- a/Source/WebCore/platform/graphics/android/Tile.h +++ b/Source/WebCore/platform/graphics/android/Tile.h @@ -161,9 +161,6 @@ private: SkRegion m_dirtyArea; bool m_fullRepaint; - // flag used to know if we have a texture that was painted at least once - bool m_isTexturePainted; - // This mutex serves two purposes. (1) It ensures that certain operations // happen atomically and (2) it makes sure those operations are synchronized // across all threads and cores. diff --git a/Source/WebCore/platform/graphics/android/TileTexture.h b/Source/WebCore/platform/graphics/android/TileTexture.h index 9486073..5fe43b0 100644 --- a/Source/WebCore/platform/graphics/android/TileTexture.h +++ b/Source/WebCore/platform/graphics/android/TileTexture.h @@ -84,7 +84,6 @@ public: private: TextureInfo m_ownTextureInfo; SkSize m_size; - SkBitmap::Config m_config; // Tile owning the texture, only modified by UI thread TextureOwner* m_owner; diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index 109dc88..e8b8cd1 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -239,9 +239,8 @@ void TilesManager::printTextures() x = o->x(); y = o->y(); } - ALOGV("[%d] texture %x owner: %x (%d, %d) page: %x scale: %.2f", - i, texture, - o, x, y, o ? o->page() : 0, o ? o->scale() : 0); + ALOGV("[%d] texture %x owner: %x (%d, %d) scale: %.2f", + i, texture, o, x, y, o ? o->scale() : 0); } ALOGV("------"); #endif // DEBUG diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h index 650e0f1..92c56d3 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.h +++ b/Source/WebCore/platform/graphics/android/TilesManager.h @@ -28,15 +28,10 @@ #if USE(ACCELERATED_COMPOSITING) -/* #include "Tile.h" */ -/* #include "TileTexture.h" */ -/* #include "ImageTexture.h" */ #include "LayerAndroid.h" #include "ShaderProgram.h" -/* #include "SkBitmapRef.h" */ #include "TexturesGenerator.h" #include "TilesProfiler.h" -/* #include "TransferQueue.h" */ #include "VideoLayerManager.h" #include <utils/threads.h> #include <wtf/HashMap.h> diff --git a/Source/WebKit/android/WebCoreSupport/UrlInterceptResponse.cpp b/Source/WebKit/android/WebCoreSupport/UrlInterceptResponse.cpp index 77e3c32..d846daf 100644 --- a/Source/WebKit/android/WebCoreSupport/UrlInterceptResponse.cpp +++ b/Source/WebKit/android/WebCoreSupport/UrlInterceptResponse.cpp @@ -30,6 +30,7 @@ #include "UrlInterceptResponse.h" #include "WebCoreJni.h" +#include <ScopedLocalRef.h> #include <utils/Log.h> namespace android { @@ -38,15 +39,14 @@ class JavaInputStreamWrapper { public: JavaInputStreamWrapper(JNIEnv* env, jobject inputStream) : m_inputStream(env->NewGlobalRef(inputStream)) - , m_buffer(0) { - LOG_ALWAYS_FATAL_IF(!inputStream); - jclass inputStreamClass = env->FindClass("java/io/InputStream"); - LOG_ALWAYS_FATAL_IF(!inputStreamClass); - m_read = env->GetMethodID(inputStreamClass, "read", "([B)I"); + , m_buffer(NULL) { + LOG_ALWAYS_FATAL_IF(!m_inputStream); + ScopedLocalRef<jclass> inputStreamClass(env, env->FindClass("java/io/InputStream")); + LOG_ALWAYS_FATAL_IF(!inputStreamClass.get()); + m_read = env->GetMethodID(inputStreamClass.get(), "read", "([B)I"); LOG_ALWAYS_FATAL_IF(!m_read); - m_close = env->GetMethodID(inputStreamClass, "close", "()V"); + m_close = env->GetMethodID(inputStreamClass.get(), "close", "()V"); LOG_ALWAYS_FATAL_IF(!m_close); - env->DeleteLocalRef(inputStreamClass); } ~JavaInputStreamWrapper() { @@ -63,10 +63,10 @@ public: JNIEnv* env = JSC::Bindings::getJNIEnv(); // Initialize our read buffer to the capacity of out. if (!m_buffer) { - m_buffer = env->NewByteArray(out->capacity()); - m_buffer = (jbyteArray) env->NewGlobalRef(m_buffer); + ScopedLocalRef<jbyteArray> buffer_local(env, env->NewByteArray(out->capacity())); + m_buffer = static_cast<jbyteArray>(env->NewGlobalRef(buffer_local.get())); } - int size = (int) env->CallIntMethod(m_inputStream, m_read, m_buffer); + int size = env->CallIntMethod(m_inputStream, m_read, m_buffer); if (checkException(env) || size < 0) return; // Copy from m_buffer to out. @@ -82,40 +82,32 @@ private: }; UrlInterceptResponse::UrlInterceptResponse(JNIEnv* env, jobject response) { - jclass javaResponse = env->FindClass("android/webkit/WebResourceResponse"); - LOG_ALWAYS_FATAL_IF(!javaResponse); - jfieldID mimeType = env->GetFieldID(javaResponse, "mMimeType", - "Ljava/lang/String;"); + ScopedLocalRef<jclass> javaResponse(env, env->FindClass("android/webkit/WebResourceResponse")); + LOG_ALWAYS_FATAL_IF(!javaResponse.get()); + jfieldID mimeType = env->GetFieldID(javaResponse.get(), "mMimeType", "Ljava/lang/String;"); LOG_ALWAYS_FATAL_IF(!mimeType); - jfieldID encoding = env->GetFieldID(javaResponse, "mEncoding", - "Ljava/lang/String;"); + jfieldID encoding = env->GetFieldID(javaResponse.get(), "mEncoding", "Ljava/lang/String;"); LOG_ALWAYS_FATAL_IF(!encoding); - jfieldID inputStream = env->GetFieldID(javaResponse, "mInputStream", - "Ljava/io/InputStream;"); + jfieldID inputStream = env->GetFieldID(javaResponse.get(), "mInputStream", "Ljava/io/InputStream;"); LOG_ALWAYS_FATAL_IF(!inputStream); - jobject stream = env->GetObjectField(response, inputStream); - if (stream) - m_inputStream.set(new JavaInputStreamWrapper(env, stream)); + ScopedLocalRef<jobject> stream(env, env->GetObjectField(response, inputStream)); + if (stream.get()) + m_inputStream.set(new JavaInputStreamWrapper(env, stream.get())); - jstring mimeStr = (jstring) env->GetObjectField(response, mimeType); - jstring encodingStr = (jstring) env->GetObjectField(response, encoding); + ScopedLocalRef<jstring> mimeStr(env, static_cast<jstring>(env->GetObjectField(response, mimeType))); + ScopedLocalRef<jstring> encodingStr(env, static_cast<jstring>(env->GetObjectField(response, encoding))); - if (mimeStr) { - const char* s = env->GetStringUTFChars(mimeStr, NULL); - m_mimeType.assign(s, env->GetStringUTFLength(mimeStr)); - env->ReleaseStringUTFChars(mimeStr, s); + if (mimeStr.get()) { + const char* s = env->GetStringUTFChars(mimeStr.get(), NULL); + m_mimeType.assign(s, env->GetStringUTFLength(mimeStr.get())); + env->ReleaseStringUTFChars(mimeStr.get(), s); } - if (encodingStr) { - const char* s = env->GetStringUTFChars(encodingStr, NULL); - m_encoding.assign(s, env->GetStringUTFLength(encodingStr)); - env->ReleaseStringUTFChars(encodingStr, s); + if (encodingStr.get()) { + const char* s = env->GetStringUTFChars(encodingStr.get(), NULL); + m_encoding.assign(s, env->GetStringUTFLength(encodingStr.get())); + env->ReleaseStringUTFChars(encodingStr.get(), s); } - - env->DeleteLocalRef(javaResponse); - env->DeleteLocalRef(stream); - env->DeleteLocalRef(mimeStr); - env->DeleteLocalRef(encodingStr); } UrlInterceptResponse::~UrlInterceptResponse() { |
