mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Bug 748189 - Call GetJNIForThread less often on a hot code path. r=blassey a=blassey
This commit is contained in:
parent
e5a69b5c94
commit
0c471f99af
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user