mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out 083d36bafbc8 (bug 763166) on suspicion of android talos redness. r=me
This commit is contained in:
parent
348425894a
commit
7df3e8d42a
@ -47,21 +47,6 @@ NS_IMPL_THREADSAFE_ISUPPORTS0(nsFilePickerCallback)
|
||||
|
||||
AndroidBridge *AndroidBridge::sBridge = 0;
|
||||
|
||||
AndroidBridge::AndroidBridge()
|
||||
: mLayerClient(NULL)
|
||||
, mJavaVM(NULL)
|
||||
, mJNIEnv(NULL)
|
||||
, mThread(NULL)
|
||||
, mJNIForCompositorThread(NULL)
|
||||
, mCompositorThread(NULL)
|
||||
, mCompositorJNICreationMutex("AndroidBridge.CompositorJNICreation")
|
||||
{
|
||||
}
|
||||
|
||||
AndroidBridge::~AndroidBridge()
|
||||
{
|
||||
}
|
||||
|
||||
AndroidBridge *
|
||||
AndroidBridge::ConstructBridge(JNIEnv *jEnv,
|
||||
jclass jGeckoAppShellClass)
|
||||
@ -91,6 +76,8 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||
|
||||
AutoLocalJNIFrame jniFrame(jEnv);
|
||||
|
||||
mJNIEnv = nsnull;
|
||||
mThread = nsnull;
|
||||
mOpenedGraphicsLibraries = false;
|
||||
mHasNativeBitmapAccess = false;
|
||||
mHasNativeWindowAccess = false;
|
||||
@ -1150,7 +1137,7 @@ AndroidBridge::CallEglCreateWindowSurface(void *dpy, void *config, AndroidGeckoS
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::CallEglCreateWindowSurface");
|
||||
|
||||
JNIEnv *env = GetJNIForCompositorThread();
|
||||
JNIEnv *env = GetJNIForThread(); // called on the compositor thread
|
||||
if (!env)
|
||||
return NULL;
|
||||
|
||||
@ -1204,7 +1191,7 @@ AndroidBridge::RegisterCompositor(JNIEnv *env, bool resetting)
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::RegisterCompositor");
|
||||
if (!env)
|
||||
env = GetJNIForCompositorThread();
|
||||
env = GetJNIForThread(); // called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
@ -2114,6 +2101,15 @@ AndroidBridge::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayRes
|
||||
client->SyncViewportInfo(aDisplayPort, aDisplayResolution, aLayersUpdated, aScrollOffset, aScaleX, aScaleY);
|
||||
}
|
||||
|
||||
AndroidBridge::AndroidBridge()
|
||||
: mLayerClient(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
AndroidBridge::~AndroidBridge()
|
||||
{
|
||||
}
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(nsAndroidBridge, nsIAndroidBridge)
|
||||
|
||||
|
@ -128,48 +128,6 @@ public:
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
static JNIEnv* GetJNIForCompositorThread() {
|
||||
if (NS_LIKELY(sBridge)) {
|
||||
if (sBridge->mCompositorThread) {
|
||||
if ((void*)pthread_self() != sBridge->mCompositorThread) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "AndroidBridge", "Non-compositor thread calling GetJNIForCompositorThread!");
|
||||
NS_ABORT();
|
||||
return NULL;
|
||||
}
|
||||
return sBridge->mJNIForCompositorThread;
|
||||
}
|
||||
|
||||
// first time this is being called, so create the JNI object for the compositor thread.
|
||||
// make sure to do it in a thread-safe manner in case two different threads call this function
|
||||
// at the same time during startup.
|
||||
MutexAutoLock lock(sBridge->mCompositorJNICreationMutex);
|
||||
|
||||
if (sBridge->mCompositorThread) {
|
||||
// this means that another thread executed this function between the time we started executing
|
||||
// it and the time we acquired the mutex. fail.
|
||||
__android_log_print(ANDROID_LOG_ERROR, "AndroidBridge", "Two threads called GetJNIForCompositorThread on startup!");
|
||||
NS_ABORT();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JavaVM *jVm = mozilla::AndroidBridge::GetVM();
|
||||
if (!jVm) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "AndroidBridge", "Null VM in GetJNIForCompositorThread");
|
||||
return NULL;
|
||||
}
|
||||
JNIEnv* env;
|
||||
if (jVm->AttachCurrentThread(&env, NULL)) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "AndroidBridge", "Unable to attach to VM in GetJNIForCompositorThread");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sBridge->mCompositorThread = (void*)pthread_self();
|
||||
sBridge->mJNIForCompositorThread = env;
|
||||
return env;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static jclass GetGeckoAppShellClass() {
|
||||
return sBridge->mGeckoAppShellClass;
|
||||
@ -411,11 +369,6 @@ protected:
|
||||
JNIEnv *mJNIEnv;
|
||||
void *mThread;
|
||||
|
||||
// the JNIEnv for the compositor thread and the lock used when creating it
|
||||
JNIEnv *mJNIForCompositorThread;
|
||||
void* mCompositorThread;
|
||||
Mutex mCompositorJNICreationMutex;
|
||||
|
||||
// the GeckoSurfaceView
|
||||
AndroidGeckoSurfaceView mSurfaceView;
|
||||
|
||||
|
@ -663,7 +663,7 @@ void
|
||||
AndroidGeckoLayerClient::SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SetFirstPaintViewport called on null layer client!");
|
||||
JNIEnv *env = AndroidBridge::GetJNIForCompositorThread();
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
@ -677,7 +677,7 @@ void
|
||||
AndroidGeckoLayerClient::SetPageRect(const gfx::Rect& aCssPageRect)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SetPageRect called on null layer client!");
|
||||
JNIEnv *env = AndroidBridge::GetJNIForCompositorThread();
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
@ -691,7 +691,7 @@ AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, float a
|
||||
nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "SyncViewportInfo called on null layer client!");
|
||||
JNIEnv *env = AndroidBridge::GetJNIForCompositorThread();
|
||||
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
|
@ -2238,7 +2238,7 @@ nsWindow::GetIMEUpdatePreference()
|
||||
void
|
||||
nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect)
|
||||
{
|
||||
JNIEnv *env = AndroidBridge::GetJNIForCompositorThread();
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowUnderlay()!");
|
||||
if (!env)
|
||||
return;
|
||||
@ -2256,7 +2256,7 @@ nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect)
|
||||
void
|
||||
nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect)
|
||||
{
|
||||
JNIEnv *env = AndroidBridge::GetJNIForCompositorThread();
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowOverlay()!");
|
||||
if (!env)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user