summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp10
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.cpp3
-rw-r--r--Source/WebCore/platform/graphics/android/TilesProfiler.cpp36
-rw-r--r--Source/WebCore/platform/graphics/android/TilesProfiler.h24
-rw-r--r--Source/WebKit/android/nav/WebView.cpp92
5 files changed, 81 insertions, 84 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index 2832017..2e379bc 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -236,6 +236,7 @@ void GLWebViewState::inval(const IntRect& rect)
} else {
m_invalidateRegion.op(rect.x(), rect.y(), rect.maxX(), rect.maxY(), SkRegion::kUnion_Op);
}
+ TilesManager::instance()->getProfiler()->nextInval(rect, m_currentScale);
}
void GLWebViewState::resetRings()
@@ -504,10 +505,11 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
{
glFinish();
TilesManager::instance()->registerGLWebViewState(this);
- TilesManager::instance()->getProfiler()->nextFrame(viewport.fLeft * scale,
- viewport.fTop * scale,
- viewport.fRight * scale,
- viewport.fBottom * scale);
+ TilesManager::instance()->getProfiler()->nextFrame(viewport.fLeft,
+ viewport.fTop,
+ viewport.fRight,
+ viewport.fBottom,
+ scale);
#ifdef DEBUG
TilesManager::instance()->getTilesTracker()->clear();
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp
index 477ae7c..a8be501 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp
@@ -336,8 +336,7 @@ void TiledPage::draw(float transparency, const SkIRect& tileBounds)
tile.draw(transparency, rect, m_scale);
}
- TilesManager::instance()->getProfiler()->nextTile(tile.x(), tile.y(), tile.isTileReady(),
- tile.usedLevel(), tileInView);
+ TilesManager::instance()->getProfiler()->nextTile(tile, m_invScale, tileInView);
}
}
diff --git a/Source/WebCore/platform/graphics/android/TilesProfiler.cpp b/Source/WebCore/platform/graphics/android/TilesProfiler.cpp
index 5c6aaa0..466923a 100644
--- a/Source/WebCore/platform/graphics/android/TilesProfiler.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesProfiler.cpp
@@ -28,6 +28,7 @@
#if USE(ACCELERATED_COMPOSITING)
+#include "TilesManager.h"
#include <wtf/CurrentTime.h>
#ifdef DEBUG
@@ -47,6 +48,7 @@
// Hard limit on amount of frames (and thus memory) profiling can take
#define MAX_PROF_FRAMES 400
+#define INVAL_CODE -2
namespace WebCore {
TilesProfiler::TilesProfiler()
@@ -77,7 +79,7 @@ void TilesProfiler::clear()
m_records.clear();
}
-void TilesProfiler::nextFrame(int l, int t, int r, int b)
+void TilesProfiler::nextFrame(int left, int top, int right, int bottom, float scale)
{
if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
return;
@@ -96,22 +98,44 @@ void TilesProfiler::nextFrame(int l, int t, int r, int b)
m_records.append(WTF::Vector<TileProfileRecord>());
//first two records designate viewport
- m_records.last().append(TileProfileRecord(l, t, true, (int)(timeDelta * 1000)));
- m_records.last().append(TileProfileRecord(r, b, true, -1));
-
+ m_records.last().append(TileProfileRecord(
+ left, top, right, bottom,
+ scale, true, (int)(timeDelta * 1000)));
}
-void TilesProfiler::nextTile(int x, int y, bool isReady, int level, bool inView)
+void TilesProfiler::nextTile(BaseTile& tile, float scale, bool inView)
{
if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
return;
+
+ bool isReady = tile.isTileReady();
+ int left = tile.x() * TilesManager::tileWidth();
+ int top = tile.y() * TilesManager::tileWidth();
+ int right = left + TilesManager::tileWidth();
+ int bottom = top + TilesManager::tileWidth();
+
if (inView) {
if (isReady)
m_goodTiles++;
else
m_badTiles++;
}
- m_records.last().append(TileProfileRecord(x, y, isReady, level));
+ m_records.last().append(TileProfileRecord(
+ left, top, right, bottom,
+ scale, isReady, tile.usedLevel()));
+ XLOG("adding tile %d %d %d %d, scale %f", left, top, right, bottom, scale);
+}
+
+void TilesProfiler::nextInval(const IntRect& rect, float scale)
+{
+ if (!m_enabled || (m_records.size() > MAX_PROF_FRAMES))
+ return;
+
+ m_records.last().append(TileProfileRecord(
+ rect.x(), rect.y(),
+ rect.maxX(), rect.maxY(), scale, false, INVAL_CODE));
+ XLOG("adding inval region %d %d %d %d, scale %f", rect.x(), rect.y(),
+ rect.maxX(), rect.maxY(), scale);
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/TilesProfiler.h b/Source/WebCore/platform/graphics/android/TilesProfiler.h
index 84f8f20..286d350 100644
--- a/Source/WebCore/platform/graphics/android/TilesProfiler.h
+++ b/Source/WebCore/platform/graphics/android/TilesProfiler.h
@@ -28,20 +28,26 @@
#if USE(ACCELERATED_COMPOSITING)
+#include "BaseTile.h"
+#include "IntRect.h"
#include "Vector.h"
namespace WebCore {
struct TileProfileRecord {
- TileProfileRecord(int x, int y, int isReady, int level) {
- this->x = x;
- this->y = y;
+ TileProfileRecord(int left, int top, int right, int bottom, float scale, int isReady, int level) {
+ this->left = left;
+ this->top = top;
+ this->right = right;
+ this->bottom = bottom;
+ this->scale = scale;
this->isReady = isReady;
this->level = level;
}
- int x, y;
+ int left, top, right, bottom;
bool isReady;
int level;
+ float scale;
};
class TilesProfiler {
@@ -51,9 +57,9 @@ public:
void start();
float stop();
void clear();
- void nextFrame(int l, int t, int r, int b);
- void nextTile(int x, int y, bool isReady, int level, bool inView);
-
+ void nextFrame(int left, int top, int right, int bottom, float scale);
+ void nextTile(BaseTile& tile, float scale, bool inView);
+ void nextInval(const IntRect& rect, float scale);
int numFrames() {
return m_records.size();
};
@@ -62,8 +68,8 @@ public:
return m_records[frame].size();
}
- TileProfileRecord getTile(int frame, int tile) {
- return m_records[frame][tile];
+ TileProfileRecord* getTile(int frame, int tile) {
+ return &m_records[frame][tile];
}
private:
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 0dc9781..7057a54 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -1495,42 +1495,6 @@ BaseLayerAndroid* getBaseLayer() {
return m_baseLayer;
}
-void tileProfilingStart() {
- TilesManager::instance()->getProfiler()->start();
-}
-
-float tileProfilingStop() {
- return TilesManager::instance()->getProfiler()->stop();
-}
-
-void tileProfilingClear() {
- TilesManager::instance()->getProfiler()->clear();
-}
-
-int tileProfilingNumFrames() {
- return TilesManager::instance()->getProfiler()->numFrames();
-}
-
-int tileProfilingNumTilesInFrame(int frame) {
- return TilesManager::instance()->getProfiler()->numTilesInFrame(frame);
-}
-
-int tileProfilingGetX(int frame, int tile) {
- return TilesManager::instance()->getProfiler()->getTile(frame, tile).x;
-}
-
-int tileProfilingGetY(int frame, int tile) {
- return TilesManager::instance()->getProfiler()->getTile(frame, tile).y;
-}
-
-bool tileProfilingGetReady(int frame, int tile) {
- return TilesManager::instance()->getProfiler()->getTile(frame, tile).isReady;
-}
-
-int tileProfilingGetLevel(int frame, int tile) {
- return TilesManager::instance()->getProfiler()->getTile(frame, tile).level;
-}
-
private: // local state for WebView
// private to getFrameCache(); other functions operate in a different thread
CachedRoot* m_frameCacheUI; // navigation data ready for use
@@ -2484,47 +2448,53 @@ static void nativeSetSelectionPointer(JNIEnv *env, jobject obj, jboolean set,
static void nativeTileProfilingStart(JNIEnv *env, jobject obj)
{
- GET_NATIVE_VIEW(env, obj)->tileProfilingStart();
+ TilesManager::instance()->getProfiler()->start();
}
static float nativeTileProfilingStop(JNIEnv *env, jobject obj)
{
- return GET_NATIVE_VIEW(env, obj)->tileProfilingStop();
+ return TilesManager::instance()->getProfiler()->stop();
}
static void nativeTileProfilingClear(JNIEnv *env, jobject obj)
{
- GET_NATIVE_VIEW(env, obj)->tileProfilingClear();
+ TilesManager::instance()->getProfiler()->clear();
}
static int nativeTileProfilingNumFrames(JNIEnv *env, jobject obj)
{
- return GET_NATIVE_VIEW(env, obj)->tileProfilingNumFrames();
+ return TilesManager::instance()->getProfiler()->numFrames();
}
static int nativeTileProfilingNumTilesInFrame(JNIEnv *env, jobject obj, int frame)
{
- return GET_NATIVE_VIEW(env, obj)->tileProfilingNumTilesInFrame(frame);
-}
-
-static int nativeTileProfilingGetX(JNIEnv *env, jobject obj, int frame, int tile)
-{
- return GET_NATIVE_VIEW(env, obj)->tileProfilingGetX(frame, tile);
-}
-
-static int nativeTileProfilingGetY(JNIEnv *env, jobject obj, int frame, int tile)
-{
- return GET_NATIVE_VIEW(env, obj)->tileProfilingGetY(frame, tile);
+ return TilesManager::instance()->getProfiler()->numTilesInFrame(frame);
}
-static bool nativeTileProfilingGetReady(JNIEnv *env, jobject obj, int frame, int tile)
+static int nativeTileProfilingGetInt(JNIEnv *env, jobject obj, int frame, int tile, jstring jkey)
{
- return GET_NATIVE_VIEW(env, obj)->tileProfilingGetReady(frame, tile);
+ WTF::String key = jstringToWtfString(env, jkey);
+ TileProfileRecord* record = TilesManager::instance()->getProfiler()->getTile(frame, tile);
+
+ if (key == "left")
+ return record->left;
+ if (key == "top")
+ return record->top;
+ if (key == "right")
+ return record->right;
+ if (key == "bottom")
+ return record->bottom;
+ if (key == "level")
+ return record->level;
+ if (key == "isReady")
+ return record->isReady ? 1 : 0;
+ return -1;
}
-static int nativeTileProfilingGetLevel(JNIEnv *env, jobject obj, int frame, int tile)
+static float nativeTileProfilingGetFloat(JNIEnv *env, jobject obj, int frame, int tile, jstring jkey)
{
- return GET_NATIVE_VIEW(env, obj)->tileProfilingGetLevel(frame, tile);
+ TileProfileRecord* record = TilesManager::instance()->getProfiler()->getTile(frame, tile);
+ return record->scale;
}
#ifdef ANDROID_DUMP_DISPLAY_TREE
@@ -2811,14 +2781,10 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeTileProfilingNumFrames },
{ "nativeTileProfilingNumTilesInFrame", "(I)I",
(void*) nativeTileProfilingNumTilesInFrame },
- { "nativeTileProfilingGetX", "(II)I",
- (void*) nativeTileProfilingGetX },
- { "nativeTileProfilingGetY", "(II)I",
- (void*) nativeTileProfilingGetY },
- { "nativeTileProfilingGetReady", "(II)Z",
- (void*) nativeTileProfilingGetReady },
- { "nativeTileProfilingGetLevel", "(II)I",
- (void*) nativeTileProfilingGetLevel },
+ { "nativeTileProfilingGetInt", "(IILjava/lang/String;)I",
+ (void*) nativeTileProfilingGetInt },
+ { "nativeTileProfilingGetFloat", "(IILjava/lang/String;)F",
+ (void*) nativeTileProfilingGetFloat },
{ "nativeStartSelection", "(II)Z",
(void*) nativeStartSelection },
{ "nativeStopGL", "()V",