Auto merge of #21385 - paulrouget:crowSupport, r=jdm

Few fixes to support Crow

With these fixes, the published AAR works for both Android and Crow.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21385)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-08-11 06:43:09 -04:00 committed by GitHub
commit cabf47bfc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 9 deletions

View file

@ -48,7 +48,6 @@ android {
sourceSets {
main {
java.srcDirs = ['src/main/java']
assets.srcDirs = ['../../../../resources']
}
}

View file

@ -110,6 +110,9 @@ android {
}
sourceSets {
main {
assets.srcDirs = ['../../../../resources']
}
armDebug {
jniLibs.srcDirs = [getJniLibsPath(true, 'arm')]
}

View file

@ -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;
}
}

View file

@ -1,3 +1,8 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package com.mozilla.servoview;
import android.annotation.SuppressLint;
@ -23,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;
@ -108,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;
@ -155,7 +159,7 @@ public class ServoSurface {
throw new RuntimeException("Error: createWindowSurface() Failed " + GLUtils.getEGLErrorString(glError));
}
flushGLBuffers();
makeCurrent();
}
@ -194,13 +198,16 @@ public class ServoSurface {
final boolean showLogs = true;
String uri = mInitialUri == null ? null : mInitialUri.toString();
mServo = new Servo(this, surface, mClient, mActivity, mServoArgs, uri, mWidth, mHeight, showLogs);
mGLLooperHandler = new Handler() {
public void handleMessage(Message msg) {
}
};
inUIThread(() -> {
mServo = new Servo(this, surface, mClient, mActivity, mServoArgs, uri, mWidth, mHeight, showLogs);
});
Looper.loop();
}
}

View file

@ -95,7 +95,9 @@ public class ServoView extends GLSurfaceView
}
public void flushGLBuffers() {
inUIThread(() -> {
requestRender();
});
}
// Scroll and click