diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-12-02 13:22:17 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-12-02 13:22:17 -0800 |
commit | f985ea5d6480fc99f60f140aa74910ab11a688f9 (patch) | |
tree | 3617d12a7d70a170cb9845c3a90d52cae454e57f /Source/WebCore | |
parent | 83d1ce9f7cc95d73e4e431e07dc090f261a9015f (diff) | |
parent | 92e210ad1acfa7a99a4365de54256607afe4b6a1 (diff) | |
download | external_webkit-f985ea5d6480fc99f60f140aa74910ab11a688f9.zip external_webkit-f985ea5d6480fc99f60f140aa74910ab11a688f9.tar.gz external_webkit-f985ea5d6480fc99f60f140aa74910ab11a688f9.tar.bz2 |
Merge "Show the frame perf info for debug purpose"
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/platform/graphics/android/GLWebViewState.cpp | 43 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/GLWebViewState.h | 2 |
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 1850509..0db9a46 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; @@ -568,6 +573,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; @@ -576,12 +606,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 8d89704..cb83562 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; |