summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-12-01 10:51:31 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2011-12-02 10:50:09 -0800
commit92e210ad1acfa7a99a4365de54256607afe4b6a1 (patch)
tree7a607c235c200fa90f3c4085f6b8e829507a5a61 /Source
parent931e90d171935ef706b6906c5867a51fc491a83d (diff)
downloadexternal_webkit-92e210ad1acfa7a99a4365de54256607afe4b6a1.zip
external_webkit-92e210ad1acfa7a99a4365de54256607afe4b6a1.tar.gz
external_webkit-92e210ad1acfa7a99a4365de54256607afe4b6a1.tar.bz2
Show the frame perf info for debug purpose
At the same time, fix the compiler error when turning on MEASURES_PERF. Change-Id: Ie1c038cb611947d4baddabdf3b844eb52e1d15ee
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp43
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.h2
2 files changed, 39 insertions, 6 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index cf91c00..5a1a9d2 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -69,6 +69,11 @@
#define MIN_SCALE_WARNING 0.1
#define MAX_SCALE_WARNING 10
+// fps indicator is FPS_INDICATOR_HEIGHT pixels high.
+// The max width is equal to MAX_FPS_VALUE fps.
+#define FPS_INDICATOR_HEIGHT 10
+#define MAX_FPS_VALUE 60
+
namespace WebCore {
using namespace android;
@@ -566,6 +571,31 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
resetFrameworkInval();
}
+ showFrameInfo(rect);
+
+#ifdef DEBUG
+ TilesManager::instance()->getTilesTracker()->showTrackTextures();
+ ImagesManager::instance()->showImages();
+#endif
+
+ return ret;
+}
+
+void GLWebViewState::showFrameInfo(const IntRect& rect)
+{
+ bool showVisualIndicator = TilesManager::instance()->getShowVisualIndicator();
+
+ bool drawOrDumpFrameInfo = showVisualIndicator;
+#ifdef MEASURES_PERF
+ drawOrDumpFrameInfo |= m_measurePerfs;
+#endif
+ if (!drawOrDumpFrameInfo)
+ return;
+
+ double currentDrawTime = WTF::currentTime();
+ double delta = currentDrawTime - m_prevDrawTime;
+ m_prevDrawTime = currentDrawTime;
+
#ifdef MEASURES_PERF
if (m_measurePerfs) {
m_delayTimes[m_timeCounter++] = delta;
@@ -574,12 +604,13 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
}
#endif
-#ifdef DEBUG
- TilesManager::instance()->getTilesTracker()->showTrackTextures();
- ImagesManager::instance()->showImages();
-#endif
-
- return ret;
+ IntRect fpsIndicatorRect = rect;
+ fpsIndicatorRect.setHeight(FPS_INDICATOR_HEIGHT);
+ double ratio = (1.0 / delta) / MAX_FPS_VALUE;
+ glScissor(fpsIndicatorRect.x(), fpsIndicatorRect.y(),
+ fpsIndicatorRect.width() * ratio, fpsIndicatorRect.height());
+ glClearColor(1, 0, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h
index cffd28f..d10be5b 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h
@@ -254,6 +254,8 @@ public:
private:
void inval(const IntRect& rect);
+ void showFrameInfo(const IntRect& rect);
+ double m_prevDrawTime;
ZoomManager m_zoomManager;
android::Mutex m_tiledPageLock;