Bug 1322650 - Allow access to TexturePoolOGL from Java r=jchen

This commit is contained in:
James Willcox 2017-03-03 15:15:13 -06:00
Родитель 2e6e69148c
Коммит 83de9ddd9d
1 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -10,6 +10,10 @@
#include "nsDebug.h" // for NS_ASSERTION, NS_ERROR, etc
#include "nsDeque.h" // for nsDeque
#ifdef MOZ_WIDGET_ANDROID
#include "GeneratedJNINatives.h"
#endif
#define TEXTURE_POOL_SIZE 10
namespace mozilla {
@ -20,6 +24,19 @@ static GLContext* sActiveContext = nullptr;
static Monitor* sMonitor = nullptr;
static nsDeque* sTextures = nullptr;
#ifdef MOZ_WIDGET_ANDROID
class GeckoSurfaceTextureSupport final
: public java::GeckoSurfaceTexture::Natives<GeckoSurfaceTextureSupport>
{
public:
static int32_t NativeAcquireTexture() {
return TexturePoolOGL::AcquireTexture();
}
};
#endif // MOZ_WIDGET_ANDROID
GLuint TexturePoolOGL::AcquireTexture()
{
NS_ASSERTION(sMonitor, "not initialized");
@ -111,6 +128,12 @@ void TexturePoolOGL::Init()
{
sMonitor = new Monitor("TexturePoolOGL.sMonitor");
sTextures = new nsDeque();
#ifdef MOZ_WIDGET_ANDROID
if (jni::IsAvailable()) {
GeckoSurfaceTextureSupport::Init();
}
#endif
}
void TexturePoolOGL::Shutdown()