summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp7
-rw-r--r--WebCore/platform/graphics/android/BaseLayerAndroid.cpp1
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.cpp56
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.h18
-rw-r--r--WebCore/platform/graphics/android/TextureOwner.cpp57
-rw-r--r--WebCore/platform/graphics/android/TextureOwner.h10
-rw-r--r--WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp6
-rw-r--r--WebCore/platform/text/android/HyphenationAndroid.cpp2
8 files changed, 81 insertions, 76 deletions
diff --git a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
index d16b53e..7cfa480 100644
--- a/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
+++ b/WebCore/platform/graphics/android/BackedDoubleBufferedTexture.cpp
@@ -133,10 +133,9 @@ void BackedDoubleBufferedTexture::setNotBusy()
android::Mutex::Autolock lock(m_busyLock);
m_busy = false;
if (m_delayedRelease) {
- if (m_owner == m_delayedReleaseOwner) {
- m_owner->removeOwned(this);
+ if (m_owner == m_delayedReleaseOwner)
m_owner = 0;
- }
+
m_delayedRelease = false;
m_delayedReleaseOwner = 0;
}
@@ -207,7 +206,6 @@ bool BackedDoubleBufferedTexture::setOwner(TextureOwner* owner)
if (proceed) {
m_owner = owner;
- owner->addOwned(this);
return true;
}
}
@@ -219,7 +217,6 @@ bool BackedDoubleBufferedTexture::release(TextureOwner* owner)
android::Mutex::Autolock lock(m_busyLock);
if (m_owner == owner) {
if (!m_busy) {
- m_owner->removeOwned(this);
m_owner = 0;
return true;
} else {
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index 2166e9d..584add1 100644
--- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -334,7 +334,6 @@ bool BaseLayerAndroid::drawGL(IntRect& viewRect, SkRect& visibleRect,
TilesManager::instance()->cleanupLayersTextures(0);
}
- glFinish();
glBindBuffer(GL_ARRAY_BUFFER, 0);
m_previousVisible = visibleRect;
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp
index b3c5b02..c25a6e8 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -32,13 +32,16 @@
#include "ClassTracker.h"
#include "LayerAndroid.h"
#include "TilesManager.h"
-
-#ifdef DEBUG
+#include <wtf/CurrentTime.h>
#include <cutils/log.h>
-#include <wtf/CurrentTime.h>
#include <wtf/text/CString.h>
+#undef XLOGC
+#define XLOGC(...) android_printLog(ANDROID_LOG_DEBUG, "GLWebViewState", __VA_ARGS__)
+
+#ifdef DEBUG
+
#undef XLOG
#define XLOG(...) android_printLog(ANDROID_LOG_DEBUG, "GLWebViewState", __VA_ARGS__)
@@ -52,6 +55,8 @@
#define FIRST_TILED_PAGE_ID 1
#define SECOND_TILED_PAGE_ID 2
+#define FRAMERATE_CAP 0.01666 // We cap at 60 fps
+
namespace WebCore {
using namespace android;
@@ -69,6 +74,7 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex)
, m_globalButtonMutex(buttonMutex)
, m_baseLayerUpdate(true)
, m_backgroundColor(SK_ColorWHITE)
+ , m_prevDrawTime(0)
{
m_viewport.setEmpty();
m_previousViewport.setEmpty();
@@ -81,6 +87,11 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex)
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("GLWebViewState");
#endif
+#ifdef MEASURES_PERF
+ m_timeCounter = 0;
+ m_totalTimeCounter = 0;
+ m_measurePerfs = false;
+#endif
}
GLWebViewState::~GLWebViewState()
@@ -116,6 +127,12 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect,
}
inval(rect);
+#ifdef MEASURES_PERF
+ if (m_measurePerfs && !showVisualIndicator)
+ dumpMeasures();
+ m_measurePerfs = showVisualIndicator;
+#endif
+
TilesManager::instance()->setShowVisualIndicator(showVisualIndicator);
}
@@ -299,15 +316,48 @@ void GLWebViewState::setViewport(SkRect& viewport, float scale)
m_tiledPageB->updateBaseTileSize();
}
+#ifdef MEASURES_PERF
+void GLWebViewState::dumpMeasures()
+{
+ for (int i = 0; i < m_timeCounter; i++) {
+ XLOGC("%d delay: %d ms", m_totalTimeCounter + i,
+ static_cast<int>(m_delayTimes[i]*1000));
+ m_delayTimes[i] = 0;
+ }
+ m_totalTimeCounter += m_timeCounter;
+ m_timeCounter = 0;
+}
+#endif // MEASURES_PERF
+
bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, float scale, SkColor color)
{
+ glFinish();
+
+ double currentTime = WTF::currentTime();
+ double delta = currentTime - m_prevDrawTime;
+
+ if (delta < FRAMERATE_CAP)
+ return true;
+
+ m_prevDrawTime = currentTime;
+
m_baseLayerLock.lock();
BaseLayerAndroid* baseLayer = m_currentBaseLayer;
SkSafeRef(baseLayer);
m_baseLayerLock.unlock();
if (!baseLayer)
return false;
+
bool ret = baseLayer->drawGL(rect, viewport, scale, color);
+
+#ifdef MEASURES_PERF
+ if (m_measurePerfs) {
+ m_delayTimes[m_timeCounter++] = delta;
+ if (m_timeCounter >= MAX_MEASURES_PERF)
+ dumpMeasures();
+ }
+#endif
+
SkSafeUnref(baseLayer);
return ret;
}
diff --git a/WebCore/platform/graphics/android/GLWebViewState.h b/WebCore/platform/graphics/android/GLWebViewState.h
index d265b41..b8194f4 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/WebCore/platform/graphics/android/GLWebViewState.h
@@ -35,6 +35,12 @@
#include "TiledPage.h"
#include <utils/threads.h>
+// Performance measurements probe
+// To use it, enable the visual indicators in debug mode.
+// turning off the visual indicators will flush the measures.
+// #define MEASURES_PERF
+#define MAX_MEASURES_PERF 2000
+
namespace WebCore {
class BaseLayerAndroid;
@@ -211,6 +217,10 @@ public:
void setBackgroundColor(SkColor color) { m_backgroundColor = color; }
SkColor getBackgroundColor() { return m_backgroundColor; }
+#ifdef MEASURES_PERF
+ void dumpMeasures();
+#endif
+
private:
void inval(const IntRect& rect); // caller must hold m_baseLayerLock
@@ -252,6 +262,14 @@ private:
IntRect m_invalidateRect;
SkColor m_backgroundColor;
+ double m_prevDrawTime;
+
+#ifdef MEASURES_PERF
+ unsigned int m_totalTimeCounter;
+ int m_timeCounter;
+ double m_delayTimes[MAX_MEASURES_PERF];
+ bool m_measurePerfs;
+#endif
};
} // namespace WebCore
diff --git a/WebCore/platform/graphics/android/TextureOwner.cpp b/WebCore/platform/graphics/android/TextureOwner.cpp
deleted file mode 100644
index c4446d7..0000000
--- a/WebCore/platform/graphics/android/TextureOwner.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "TextureOwner.h"
-
-#include "BackedDoubleBufferedTexture.h"
-
-namespace WebCore {
-
-TextureOwner::~TextureOwner()
-{
- if (m_ownedTextures.size()) {
- // This TextureOwner owns textures still!
- HashSet<BackedDoubleBufferedTexture*> textures;
- // Swap to a local copy because release will modify the iterator.
- textures.swap(m_ownedTextures);
- HashSet<BackedDoubleBufferedTexture*>::const_iterator it = textures.begin();
- for (; it != textures.end(); ++it)
- (*it)->release(this);
- }
-}
-
-void TextureOwner::addOwned(BackedDoubleBufferedTexture* t)
-{
- // This TextureOwner now owns texture t
- m_ownedTextures.add(t);
-}
-
-void TextureOwner::removeOwned(BackedDoubleBufferedTexture* t)
-{
- // This textureowner no longer owns texture t.
- m_ownedTextures.remove(t);
-}
-}
diff --git a/WebCore/platform/graphics/android/TextureOwner.h b/WebCore/platform/graphics/android/TextureOwner.h
index 684efac..aebbf90 100644
--- a/WebCore/platform/graphics/android/TextureOwner.h
+++ b/WebCore/platform/graphics/android/TextureOwner.h
@@ -26,8 +26,6 @@
#ifndef TextureOwner_h
#define TextureOwner_h
-#include <wtf/HashSet.h>
-
namespace WebCore {
class TiledPage;
@@ -35,15 +33,9 @@ class BackedDoubleBufferedTexture;
class TextureOwner {
public:
- virtual ~TextureOwner();
+ virtual ~TextureOwner() { }
virtual bool removeTexture(BackedDoubleBufferedTexture* texture) = 0;
virtual TiledPage* page() = 0;
-
- void addOwned(BackedDoubleBufferedTexture*);
- void removeOwned(BackedDoubleBufferedTexture*);
-
-private:
- WTF::HashSet<BackedDoubleBufferedTexture*> m_ownedTextures;
};
}
diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index a2b9f8e..855ba24 100644
--- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -222,6 +222,12 @@ public:
// jpeglib cannot convert these to rgb, but it can convert ycck
// to cmyk.
m_info.out_color_space = JCS_CMYK;
+
+ // Same as with grayscale images, we convert CMYK images to RGBA
+ // ones. When we keep the color profiles of these CMYK images,
+ // CoreGraphics will convert their colors again. So, we discard
+ // their color profiles to prevent color corruption.
+ m_decoder->setIgnoreGammaAndColorProfile(true);
break;
default:
return m_decoder->setFailed();
diff --git a/WebCore/platform/text/android/HyphenationAndroid.cpp b/WebCore/platform/text/android/HyphenationAndroid.cpp
index cff0a66..d1bd839 100644
--- a/WebCore/platform/text/android/HyphenationAndroid.cpp
+++ b/WebCore/platform/text/android/HyphenationAndroid.cpp
@@ -75,7 +75,7 @@ size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeI
return 0;
char word[maxWordLen];
- int wordLength = 0;
+ size_t wordLength = 0;
for (size_t i = 0; i < length; ++i) {
const UChar ch = characters[i];
// Only English for now.