Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Few fixes to support Crow #21385

Merged
merged 3 commits into from Aug 11, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Execute callbacks in proper threads

  • Loading branch information
paulrouget committed Aug 11, 2018
commit b16b0b4a15dea917d8d03951db15b3ff01775217
@@ -126,15 +126,17 @@ public void wakeup() {
}

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 void onHistoryChanged(boolean canGoBack, boolean canGoForward) {
stream.close();
return bytes;
} catch (IOException e) {
Log.e(LOGTAG, e.getMessage());
Log.e(LOGTAG, "readfile error: " + e.getMessage());
return null;
}
}
@@ -28,6 +28,7 @@
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 void loadUri(Uri uri) {
}

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 void loadUri(Uri uri) {
throw new RuntimeException("Error: createWindowSurface() Failed " + GLUtils.getEGLErrorString(glError));
}

flushGLBuffers();
makeCurrent();
}


@@ -205,7 +204,9 @@ public void handleMessage(Message msg) {
}
};

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();
}
@@ -95,7 +95,9 @@ public void loadUri(Uri uri) {
}

public void flushGLBuffers() {
inUIThread(() -> {
requestRender();
});
}

// Scroll and click
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.