Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: ui/gl/android/surface_texture.cc

Issue 2706653002: Added SurfaceTextureGLOwner to create / own GL objects. (Closed)
Patch Set: stopped including gl_initializer.h Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/android/surface_texture.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/android/surface_texture.cc
diff --git a/ui/gl/android/surface_texture.cc b/ui/gl/android/surface_texture.cc
index 309e55b765fbcc1336dac50f7309bf3787430d38..2cd25173d61bd8fc333a61308402b11280f65ba4 100644
--- a/ui/gl/android/surface_texture.cc
+++ b/ui/gl/android/surface_texture.cc
@@ -16,9 +16,13 @@
namespace gl {
scoped_refptr<SurfaceTexture> SurfaceTexture::Create(int texture_id) {
+ return new SurfaceTexture(CreateJavaSurfaceTexture(texture_id));
+}
+
+base::android::ScopedJavaLocalRef<jobject>
+SurfaceTexture::CreateJavaSurfaceTexture(int texture_id) {
JNIEnv* env = base::android::AttachCurrentThread();
- return new SurfaceTexture(
- Java_SurfaceTexturePlatformWrapper_create(env, texture_id));
+ return Java_SurfaceTexturePlatformWrapper_create(env, texture_id);
}
SurfaceTexture::SurfaceTexture(
@@ -27,8 +31,16 @@ SurfaceTexture::SurfaceTexture(
}
SurfaceTexture::~SurfaceTexture() {
+ DestroyJavaObject();
+}
+
+void SurfaceTexture::DestroyJavaObject() {
+ if (j_surface_texture_.is_null())
+ return;
+
JNIEnv* env = base::android::AttachCurrentThread();
Java_SurfaceTexturePlatformWrapper_destroy(env, j_surface_texture_);
+ j_surface_texture_.Reset();
}
void SurfaceTexture::SetFrameAvailableCallback(
« no previous file with comments | « ui/gl/android/surface_texture.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698