diff --git a/support/android/apk/servoview/src/main/java/com/mozilla/servoview/Servo.java b/support/android/apk/servoview/src/main/java/com/mozilla/servoview/Servo.java index 3f07dbb50ac..268669e5c45 100644 --- a/support/android/apk/servoview/src/main/java/com/mozilla/servoview/Servo.java +++ b/support/android/apk/servoview/src/main/java/com/mozilla/servoview/Servo.java @@ -126,15 +126,17 @@ public class Servo { } public void flush() { - mRunCallback.inUIThread(() -> mGfxCb.flushGLBuffers()); + // Up to the callback to execute this in the right thread + mGfxCb.flushGLBuffers(); } public void makeCurrent() { - mRunCallback.inUIThread(() -> mGfxCb.makeCurrent()); + // Up to the callback to execute this in the right thread + mGfxCb.makeCurrent(); } public void onAnimatingChanged(boolean animating) { - mRunCallback.inUIThread(() -> mGfxCb.animationStateChanged(animating)); + mRunCallback.inGLThread(() -> mGfxCb.animationStateChanged(animating)); } public void onLoadStarted() { @@ -165,7 +167,7 @@ public class Servo { stream.close(); return bytes; } catch (IOException e) { - Log.e(LOGTAG, e.getMessage()); + Log.e(LOGTAG, "readfile error: " + e.getMessage()); return null; } } diff --git a/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoSurface.java b/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoSurface.java index 7e5af252d38..b2848e764fc 100644 --- a/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoSurface.java +++ b/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoSurface.java @@ -28,6 +28,7 @@ import static android.opengl.EGL14.EGL_CONTEXT_CLIENT_VERSION; import static android.opengl.EGL14.EGL_OPENGL_ES2_BIT; public class ServoSurface { + private static final String LOGTAG = "ServoSurface"; private final GLThread mGLThread; private final Handler mMainLooperHandler; private Handler mGLLooperHandler; @@ -113,8 +114,6 @@ public class ServoSurface { } static class GLSurface implements GfxCallbacks { - private static final String LOGTAG = "ServoSurface"; - private EGLConfig[] mEGLConfigs; private EGLDisplay mEglDisplay; private EGLContext mEglContext; @@ -160,7 +159,7 @@ public class ServoSurface { throw new RuntimeException("Error: createWindowSurface() Failed " + GLUtils.getEGLErrorString(glError)); } - flushGLBuffers(); + makeCurrent(); } @@ -205,7 +204,9 @@ public class ServoSurface { } }; - mServo = new Servo(this, surface, mClient, mActivity, mServoArgs, uri, mWidth, mHeight, showLogs); + inUIThread(() -> { + mServo = new Servo(this, surface, mClient, mActivity, mServoArgs, uri, mWidth, mHeight, showLogs); + }); Looper.loop(); } diff --git a/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoView.java b/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoView.java index 9999568a2a3..7385b8a29e1 100644 --- a/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoView.java +++ b/support/android/apk/servoview/src/main/java/com/mozilla/servoview/ServoView.java @@ -95,7 +95,9 @@ public class ServoView extends GLSurfaceView } public void flushGLBuffers() { + inUIThread(() -> { requestRender(); + }); } // Scroll and click