Bug 748189 - Call GetJNIForThread less often on a hot code path. r=blassey a=blassey

This commit is contained in:
Kartikaya Gupta 2012-04-23 21:06:41 -04:00
parent e5a69b5c94
commit 0c471f99af
2 changed files with 8 additions and 11 deletions

View File

@ -703,8 +703,8 @@ AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, float a
NS_ABORT_IF_FALSE(viewTransformJObj, "No view transform object!");
viewTransform.Init(viewTransformJObj);
aScrollOffset = nsIntPoint(viewTransform.GetX(), viewTransform.GetY());
aScaleX = aScaleY = viewTransform.GetScale();
aScrollOffset = nsIntPoint(viewTransform.GetX(env), viewTransform.GetY(env));
aScaleX = aScaleY = viewTransform.GetScale(env);
}
jobject
@ -830,27 +830,24 @@ AndroidLayerRendererFrame::EndDrawing()
}
float
AndroidViewTransform::GetX()
AndroidViewTransform::GetX(JNIEnv *env)
{
JNIEnv *env = GetJNIForThread();
if (!env)
return 0.0f;
return env->GetFloatField(wrapped_obj, jXField);
}
float
AndroidViewTransform::GetY()
AndroidViewTransform::GetY(JNIEnv *env)
{
JNIEnv *env = GetJNIForThread();
if (!env)
return 0.0f;
return env->GetFloatField(wrapped_obj, jYField);
}
float
AndroidViewTransform::GetScale()
AndroidViewTransform::GetScale(JNIEnv *env)
{
JNIEnv *env = GetJNIForThread();
if (!env)
return 0.0f;
return env->GetFloatField(wrapped_obj, jScaleField);

View File

@ -162,9 +162,9 @@ public:
AndroidViewTransform() {}
AndroidViewTransform(jobject jobj) { Init(jobj); }
float GetX();
float GetY();
float GetScale();
float GetX(JNIEnv *env);
float GetY(JNIEnv *env);
float GetScale(JNIEnv *env);
private:
static jclass jViewTransformClass;