diff --git a/gfx/layers/opengl/TexturePoolOGL.cpp b/gfx/layers/opengl/TexturePoolOGL.cpp index 8bd2aee9137e..5b4701c2704f 100644 --- a/gfx/layers/opengl/TexturePoolOGL.cpp +++ b/gfx/layers/opengl/TexturePoolOGL.cpp @@ -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 +{ +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()